You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »


01. 개요

02. Concept Diagram

Local PC에서 실행시

03. 사전조건

04. Azure Application Insights 생성

  • Azure Log Analytics Workspace는 로그 데이터가 수집되고 저장되는 논리적 저장소 단위입니다.

04-01. Create Log Analytics workspace

04-02. Create Application Insights

05. Spring Boot Application 준비

05-01. Git Clone

C:\workspace$ git clone https://github.com/Sanses/springboot-reactive-shorturl-webui
Cloning into 'reactive-shorturl-webui'...
remote: Enumerating objects: 43, done.
remote: Counting objects: 100% (43/43), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 43 (delta 2), reused 39 (delta 1), pack-reused 0
Unpacking objects: 100% (43/43), done.
C:\workspace$ cd springboot-reactive-shorturl-webui

05-02. reactive-shorturl-webui Application  소개

C:\workspace\springboot-reactive-shorturl-webui$ 
C:\workspace\springboot-reactive-shorturl-webui>mvnw clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.sansae:shorturl >-------------------------
[INFO] Building shorturl 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
~~~~~~~~~~~~~~~~~~~~ 중략 ~~~~~~~~~~~~~~~~~~
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  23.120 s
[INFO] Finished at: 2021-01-02T11:23:04+09:00
[INFO] ------------------------------------------------------------------------

C:\workspace\springboot-reactive-shorturl-webui>java -jar target/shorturl-0.0.1-SNAPSHOT.jar
2021-01-02 11:24:43.050  INFO 356 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port(s): 8080
2021-01-02 11:24:43.192  INFO 356 --- [           main] com.sansae.shorturl.ShorturlApplication  : Started ShorturlApplication in 10.698 seconds (JVM running for 12.343)



01. 사전조건

02. applicationinsights-agent 설정

02-01. Applicationinsights-agent-3.0.0를 다운로드 합니다.

02-02. Spring Boot Application에 'ApplicationInsights-agent' 폴더를 만들고 jar파일을 위치 시킵니다.

applicationinsights.json
{
  "connectionString": "InstrumentationKey=23bb2ca3-8a38-4a3c-b5b5-f45f2ea33a7d;IngestionEndpoint=https://koreacentral-0.in.applicationinsights.azure.com/"
}
AI-Agent.xml
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsightsAgent>
    <Instrumentation>
        <BuiltIn enabled="true">

            <!-- capture logging via Log4j 1.2, Log4j2, and Logback, default is true -->
            <Logging enabled="true" />

            <!-- capture outgoing HTTP calls performed through Apache HttpClient, OkHttp,
                 and java.net.HttpURLConnection, default is true -->
            <HTTP enabled="true" />

            <!-- capture JDBC queries, default is true -->
            <JDBC enabled="true" />

            <!-- capture Redis calls, default is true -->
            <Jedis enabled="true" />

            <!-- capture query plans for JDBC queries that exceed this value (MySQL, PostgreSQL),
                 default is 10000 milliseconds -->
            <MaxStatementQueryLimitInMS>1000</MaxStatementQueryLimitInMS>

        </BuiltIn>
    </Instrumentation>
</ApplicationInsightsAgent>

02-03. JVM환경변수로 javaagent를 설정합니다.

  • VM options
    • -javaagent:C:\workspace\reactive-shorturl-webui\ApplicationInsights-agent\applicationinsights-agent-3.0.0.jar

02-04. Spring Boot Application을 실행하면, Java Agent관련 로그가 확인 됩니다.

"C:\Program Files\Java\jdk-11.0.2\bin\java.exe" -javaagent:C:\workspace\reactive-shorturl-webui\ApplicationInsights-agent\applicationinsights-agent-3.0.0.jar -javaagent:C:\Users\sansae\AppData\Local\JetBrains\Toolbox\apps\IDEA-C\ch-0\202.8194.7\lib\idea_rt.jar=54632:C:\Users\sansae\AppData\Local\JetBrains\Toolbox\apps\IDEA-C\ch-0\202.8194.7\bin -Dfile.encoding=UTF-8 

~~~~~~~~~~~~~~~~~~~~~~~ 중략 ~~~~~~~~~~~~~~~~~~~~~~~ 

2021-01-04 12:20:41.147+09 INFO  c.m.applicationinsights.agent - ApplicationInsights Java Agent started successfully

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.7.RELEASE)

2021-01-02 12:20:44.929  INFO 6312 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 19ms. Found 0 Redis repository interfaces.
2021-01-02 12:20:47.585  WARN 6312 --- [           main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2021-01-02 12:20:49.115  INFO 6312 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port(s): 8080
2021-01-02 12:20:49.130  INFO 6312 --- [           main] com.sansae.shorturl.ShorturlApplication  : Started ShorturlApplication in 7.332 seconds (JVM running for 18.768)

03. Application Insights 확인

03-01. Application map

03-02. Performance



  • No labels