Skip to content

Commit

Permalink
Don't override profiling settings injected by environment variables (#…
Browse files Browse the repository at this point in the history
…173)

* Don't override profiling settings injected by environment variables

* Make it a bit fancier, can't enable __ENABLE_ALLOCATION_PROFILING__ if __ENABLE_PROFILING__ isn't set

* Update settingKey tooltips
  • Loading branch information
er1c authored Nov 17, 2024
1 parent f5c26fb commit ab1a5d3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions sbt-datadog/src/main/scala/com/guizmaii/sbt/DatadogAPM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ object DatadogAPM extends AutoPlugin {
)

lazy val datadogProfilingEnabled = settingKey[Boolean](
"Datadog Profiling. See https://docs.datadoghq.com/profiler/enabling/java/?tab=commandarguments. Default: 'true'. Deactivated if `datadogApmEnabled` is `false`"
"Datadog Profiling. See https://docs.datadoghq.com/profiler/enabling/java/?tab=commandarguments. Default: `DD_PROFILING_ENABLED` envvar value if present, 'true' otherwise. Deactivated if `datadogApmEnabled` is `false`"
)

lazy val datadogAllocationProfilingEnabled = settingKey[Boolean](
"Datadog Allocations Profiling. See https://docs.datadoghq.com/profiler/enabling/java/?tab=commandarguments. Default: 'true'. Deactivated if `datadogApmEnabled` is `false`"
"Datadog Allocations Profiling. See https://docs.datadoghq.com/profiler/enabling/java/?tab=commandarguments. Default: `DD_PROFILING_DIRECTALLOCATION_ENABLED` envvar value if present, 'true' otherwise. Deactivated if `datadogApmEnabled` is `false` or `datadogProfilingEnabled` is `false`"
)

lazy val datadogServiceName = settingKey[String](
Expand Down Expand Up @@ -112,12 +112,20 @@ object DatadogAPM extends AutoPlugin {
| export __ENABLE_TRACES__=${datadogApmEnabled.value}
|fi
|if [ "$${__ENABLE_TRACES__}" == "true" ]; then
| export __ENABLE_PROFILING__=${datadogProfilingEnabled.value}
| if [ ! -z "$${DD_PROFILING_ENABLED}" ]; then
| export __ENABLE_PROFILING__=$${DD_PROFILING_ENABLED}
| else
| export __ENABLE_PROFILING__=${datadogProfilingEnabled.value}
| fi
|else
| export __ENABLE_PROFILING__=false
|fi
|if [ "$${__ENABLE_TRACES__}" == "true" ]; then
| export __ENABLE_ALLOCATION_PROFILING__=${datadogAllocationProfilingEnabled.value}
|if [ "$${__ENABLE_PROFILING__}" == "true" ]; then
| if [ ! -z "$${DD_PROFILING_DIRECTALLOCATION_ENABLED}" ]; then
| export __ENABLE_ALLOCATION_PROFILING__=$${DD_PROFILING_DIRECTALLOCATION_ENABLED}
| else
| export __ENABLE_ALLOCATION_PROFILING__=${datadogAllocationProfilingEnabled.value}
| fi
|else
| export __ENABLE_ALLOCATION_PROFILING__=false
|fi
Expand Down

0 comments on commit ab1a5d3

Please sign in to comment.