diff --git a/README.md b/README.md index ff046a7..20b2eed 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ In order to profile a Java application in pod `mypod` for 1 minute and save the ```shell kubectl flame mypod -t 1m --lang java -f /tmp/flamegraph.svg ``` +Note that Java is using async-profiler 2 that also supports HTML flamegraph by switching the file extension to `.html`. + ### Profiling Alpine based container Profiling Java application in alpine based containers require using `--alpine` flag: ```shell diff --git a/agent/docker/jvm/Dockerfile b/agent/docker/jvm/Dockerfile index 44c2978..44e33da 100644 --- a/agent/docker/jvm/Dockerfile +++ b/agent/docker/jvm/Dockerfile @@ -5,11 +5,9 @@ RUN go get -d -v ./... RUN cd agent && go build -o /go/bin/agent FROM openjdk:8 as asyncprofiler -RUN echo deb http://deb.debian.org/debian stretch-backports main > /etc/apt/sources.list.d/stretch-backports.list && \ - apt-get update && \ - apt-get -y install build-essential -RUN git clone https://github.com/edeNFed/async-profiler.git -RUN cd async-profiler && make +RUN curl -o async-profiler-2.5-linux-x64.tar.gz -L \ + https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.5/async-profiler-2.5-linux-x64.tar.gz +RUN tar -xvf async-profiler-2.5-linux-x64.tar.gz && mv async-profiler-2.5-linux-x64 async-profiler FROM bitnami/minideb:stretch RUN mkdir -p /app/async-profiler/build diff --git a/agent/docker/jvm/Dockerfile.alpine b/agent/docker/jvm/Dockerfile.alpine index e0eb75b..a74e7c1 100644 --- a/agent/docker/jvm/Dockerfile.alpine +++ b/agent/docker/jvm/Dockerfile.alpine @@ -5,9 +5,10 @@ RUN go get -d -v ./... RUN cd agent && go build -o /go/bin/agent FROM openjdk:8-alpine as asyncprofiler -RUN apk add build-base git linux-headers -RUN git clone https://github.com/edeNFed/async-profiler.git -RUN cd async-profiler && make +RUN apk add build-base linux-headers curl +RUN curl -o async-profiler-2.5-linux-musl-x64.tar.gz -L \ + https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.5/async-profiler-2.5-linux-musl-x64.tar.gz +RUN tar -xvf async-profiler-2.5-linux-musl-x64.tar.gz && mv async-profiler-2.5-linux-musl-x64 async-profiler FROM alpine RUN mkdir -p /app/async-profiler/build diff --git a/agent/profiler/jvm.go b/agent/profiler/jvm.go index 299138a..3fe5826 100644 --- a/agent/profiler/jvm.go +++ b/agent/profiler/jvm.go @@ -12,7 +12,7 @@ import ( const ( profilerDir = "/tmp/async-profiler" - fileName = "/tmp/flamegraph.svg" + fileName = "/tmp/flamegraph.html" profilerSh = profilerDir + "/profiler.sh" )