Google Cloud Stackdriver Profiler GKE installation

12/2/2018

I have a java dropwizard microservice running on Google Kubernetes Engine. I'm trying to integrate stackdriver profiler to my project.

I added agent as described in offical documentation. When I try to run my docker container, I get following error:

Error occurred during initialization of VM
Could not find agent library /opt/cprof/profiler_java_agent.so in absolute path, with error: Error relocating /opt/cprof/profiler_java_agent.so: __printf_chk: symbol not found

This is my dockerfile:

FROM java:openjdk-8-jre-alpine

COPY build/libs/com.company.my-api-*.jar /opt/app/com.company.my-api.jar
COPY config.yml /opt/app/config.yml


RUN   apk update \
  &&   apk add ca-certificates wget libc6-compat \
  &&   update-ca-certificates

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


WORKDIR /opt/app/

EXPOSE 8028

ENTRYPOINT ["java", "-agentpath:/opt/cprof/profiler_java_agent.so=-cprof_service=myApi,-logtostderr", "-jar", "com.companyny-api.jar", "server", "config.yml"]

Any ideas?

-- fyelci
google-cloud-stackdriver
google-kubernetes-engine
stackdriver

1 Answer

12/13/2018

Please note that this is a Beta release of Stackdriver Profiler. This feature is not covered by any SLA or deprecation policy and might be subject to backward-incompatible changes.

The error you are getting seems to be a known issue with Alpine base image and found some other users reported the same. It is the operating system that is incompatible with the Stackdriver Profiler. These documentations (1 & 2)are a good read. I would recommend to try with non-Apline base image and it should work as it worked for others.

-- Rahi
Source: StackOverflow