grafana / pyroscope

Continuous Profiling Platform. Debug performance issues down to a single line of code
https://grafana.com/oss/pyroscope/
GNU Affero General Public License v3.0
10.02k stars 604 forks source link

dotnet Dockerfile example is outdated and wrong #1940

Closed StianOvrevage closed 8 months ago

StianOvrevage commented 1 year ago

I used https://github.com/grafana/pyroscope/blob/main/examples/dotnet/web-new/Dockerfile as a starting point, but it's no longer correct and at least caused me to spend quite some time questioning my sanity.

First of this is a simple problem to fix:

RUN wget https://github.com/pyroscope-io/pyroscope-dotnet/releases/download/v0.7.0/Pyroscope.Linux.ApiWrapper.x64.so
RUN wget https://github.com/pyroscope-io/pyroscope-dotnet/releases/download/v0.7.0/Pyroscope.Profiler.Native.so

The other problem was a bit more insidious:

ENV PROFILING_ENABLED=1
ENV PROFILING_ALLOCATION_ENABLED=true
ENV PROFILING_CONTENTION_ENABLED=true
ENV PROFILING_EXCEPTION_ENABLED=true

These must be prefixed with PYROSCOPE_ to work. Ref https://pyroscope.io/docs/dotnet/ .

I'm not sure if this behaviour changed or if the example always have been wrong.

korniltsev commented 1 year ago

I've updated examples to use the tarballs. As for PROFILING_{*} env variables - they should work with PYROSCOPE_ or DD_ prefixes and without any prefixes at all. I've updated examples to use PYROSCOPE_ prefix for consistency

StianOvrevage commented 1 year ago

Thank you. I also discovered another thing that prevented it from working for us:

The CORECLR_ENABLE_PROFILING env var only works with 1 whereas the others accept 1 or true.

This was unexpected and took quite some time to figure out as well.

korniltsev commented 1 year ago

yeah it is from the runtime itself, not the profiler https://learn.microsoft.com/en-us/dotnet/core/runtime-config/debugging-profiling

StianOvrevage commented 1 year ago

Yes, that makes sense, and I know that now ;)

But it's not something I should be expected to know when just getting started and messing around with tutorials. I may be the only idiot that makes this mistake, but it might be an idea to make it less likely?