dd-trace-java icon indicating copy to clipboard operation
dd-trace-java copied to clipboard

Startup debug information misleading with properties file

Open unlucku opened this issue 3 years ago • 1 comments

I might be misreading the documentation but when I was using DD_TRACE_CONFIG I originally incorrectly assumed that I could also put properties related to the profiler in the .properties file as well. I spent a lot of time on this without realizing I could not do that because the startup debug information would tell me the profiler was enabled. However no profiles would ever be generated, while the rest of the properties in the .properties file were working perfectly.

Setting the env variable or using it as a startup flag with the java command works perfectly so I dont think its an issue with the profiler. I assume .properties just does not accept profiler flags and that is probably the correct implementation but the issue is that Tracer Configuration startup debug message's "profiling_enabled" property still says true (Even though the profiler is not enabled).

Let me know if more info is needed!

unlucku avatar Mar 24 '22 22:03 unlucku

Hi @unlucku - there are only a handful of properties that have no effect in the external DD_TRACE_CONFIG file. Those properties are the top-level switches to enable the profiler, tracer, etc such as dd.profiling.enabled. This is because the Java agent needs to determine the on/off state of these features early on in startup before as few classes as possible are loaded. All other profiling flags can be put in DD_TRACE_CONFIG, just not the main switch dd.profiling.enabled.

One option would be for the tracer to warn when top-level feature switches like dd.profiling.enabled are found in DD_TRACE_CONFIG, to make clear that those need to be set outside of DD_TRACE_CONFIG.

The alternative would be to do some very simple scraping of DD_TRACE_CONFIG (if set) for these top-level switches - rather than build the entire config at that point which would add too much overhead to startup.

mcculls avatar Mar 24 '22 23:03 mcculls