Add Stackdriver Profiler Java agent to adservice.

This commit is contained in:
Kalyana Chadalavada 2019-05-01 19:15:41 -07:00
parent 37f2d75bfb
commit 4461dd5d00
2 changed files with 11 additions and 4 deletions

View file

@ -11,9 +11,14 @@ COPY . .
RUN chmod +x gradlew RUN chmod +x gradlew
RUN ./gradlew installDist RUN ./gradlew installDist
FROM openjdk:8-alpine FROM openjdk:8-slim
RUN apk add --no-cache libc6-compat # Download Stackdriver Profiler Java agent
RUN apt-get update
RUN apt-get install -qq wget
RUN mkdir -p /opt/cprof && \
wget -q -O- https://storage.googleapis.com/cloud-profiler/java/latest/profiler_java_agent.tar.gz \
| tar xzv -C /opt/cprof
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.1 && \ RUN GRPC_HEALTH_PROBE_VERSION=v0.2.1 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \

View file

@ -118,7 +118,8 @@ task adService(type: CreateStartScripts) {
outputDir = new File(project.buildDir, 'tmp') outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime classpath = jar.outputs.files + project.configurations.runtime
defaultJvmOpts = defaultJvmOpts =
["-Dlog4j2.contextDataInjector=io.opencensus.contrib.logcorrelation.log4j2.OpenCensusTraceContextDataInjector"] ["-Dlog4j2.contextDataInjector=io.opencensus.contrib.logcorrelation.log4j2.OpenCensusTraceContextDataInjector",
"-agentpath:/opt/cprof/profiler_java_agent.so=-cprof_service=adservice,-cprof_service_version=1.0.0"]
} }
task adServiceClient(type: CreateStartScripts) { task adServiceClient(type: CreateStartScripts) {
@ -127,7 +128,8 @@ task adServiceClient(type: CreateStartScripts) {
outputDir = new File(project.buildDir, 'tmp') outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime classpath = jar.outputs.files + project.configurations.runtime
defaultJvmOpts = defaultJvmOpts =
["-Dlog4j2.contextDataInjector=io.opencensus.contrib.logcorrelation.log4j2.OpenCensusTraceContextDataInjector"] ["-Dlog4j2.contextDataInjector=io.opencensus.contrib.logcorrelation.log4j2.OpenCensusTraceContextDataInjector",
"-agentpath:/opt/cprof/profiler_java_agent.so=-cprof_service=adserviceclient,-cprof_service_version=1.0.0"]
} }
applicationDistribution.into('bin') { applicationDistribution.into('bin') {