grafana / grafana/pyroscope-dotnet
Disable logging to file by default
- Dominant language
- C++
- Stars
- 38
- Forks
- 13
- Avg merge
- 20h 15m
- Merged PRs (30d)
- 10
Description
By default we are logging to a file like `/var/log/pyroscope/dotnet/Pyroscope-DotNet-Profiler-Native-dotnet-7.log`.
I haven't found a way to disable this using the environment variable `PYROSCOPE_PROFILING_LOG_DIR` (and I don't think there is one). I would argue by default we should not log to files and only if a value is given to `PYROSCOPE_PROFILING_LOG_DIR`, we should write into a file.
Esp. when the directory cannot be created this blocks the whole profiling session:
```
Logger::GetLogPath failed to create a parent directory: "/var/log/pyroscope/dotnet"
LoggerImpl Handler: Error creating native log file.
```
Can be recreated by testing the example as non-root:
```
--- a/examples/language-sdk-instrumentation/dotnet/rideshare/Dockerfile
+++ b/examples/language-sdk-instrumentation/dotnet/rideshare/Dockerfile
@@ -24,5 +24,7 @@ ENV PYROSCOPE_PROFILING_CONTENTION_ENABLED=true
ENV PYROSCOPE_PROFILING_EXCEPTION_ENABLED=true
ENV RIDESHARE_LISTEN_PORT=5000
+USER nobody
+
CMD sh -c "ASPNETCORE_URLS=http://*:${RIDESHARE_LISTEN_PORT} exec dotnet /dotnet/example.dll"
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the native logger entry points named in the report, Logger::GetLogPath and LoggerImpl Handler, and use examples/language-sdk-instrumentation/dotnet/rideshare/Dockerfile to reproduce the non-root case. Done means the default profiling session no longer requires creating a log file, while setting PYROSCOPE_PROFILING_LOG_DIR still enables file logging.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100