Skip to content

Commit 0372dcc

Browse files
committed
feat(application-insights agent)!: add sampling + bump agent + support for spring v2/v3
1 parent a216486 commit 0372dcc

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
FROM eclipse-temurin:17-jre@sha256:0adcf8486107fbd706de4b4fdde64c2d2e3ead4c689b2fb7ae4947010e1f00b4
22

3-
RUN addgroup spring
4-
RUN useradd -g spring spring
3+
RUN addgroup spring&& useradd -g spring spring
54
USER spring:spring
65

76
# https://github.com/microsoft/ApplicationInsights-Java/releases
8-
ADD --chown=spring:spring https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.19/applicationinsights-agent-3.4.19.jar /applicationinsights-agent.jar
7+
ADD --chown=spring:spring https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.6.0/applicationinsights-agent-3.6.0.jar /applicationinsights-agent.jar
8+
99
COPY --chown=spring:spring docker/applicationinsights.json ./applicationinsights.json
1010

1111
EXPOSE 8080

docker/applicationinsights.json

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
{
1010
"telemetryType": "exception",
1111
"percentage": 100
12+
},
13+
{
14+
"telemetryType": "request",
15+
"percentage": 100
1216
}
1317
]
1418
}

docker/run.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/sh
22

3-
version=$(cat META-INF/MANIFEST.MF | grep -oP 'Spring-Boot-Version: \K[\d.]+')
4-
version_major=${version:0:1}
3+
spring_boot_version=$(cat ./META-INF/MANIFEST.MF | grep 'Spring-Boot-Version:' | cut -d ' ' -f 2)
4+
major_version=$(echo "$spring_boot_version" | cut -d '.' -f 1)
55

6-
# Check if the version_major is 3
7-
if [[ "$version_major" == "3" ]]; then
8-
exec java -javaagent:/applicationinsights-agent.jar ${JAVA_OPTS} org.springframework.boot.loader.launch.JarLauncher "$@"
6+
# Check if the major_version is 3
7+
if [ "$major_version" -eq "3" ] ; then
8+
exec java -javaagent:/applicationinsights-agent.jar ${JAVA_OPTS} org.springframework.boot.loader.launch.JarLauncher "$@"
99
else
1010
exec java -javaagent:/applicationinsights-agent.jar ${JAVA_OPTS} org.springframework.boot.loader.JarLauncher "$@"
1111
fi

0 commit comments

Comments
 (0)