Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Dont print DATADOG CONFIGURATION #3940

Open
jshah opened this issue Sep 23, 2024 · 3 comments
Open

Dont print DATADOG CONFIGURATION #3940

jshah opened this issue Sep 23, 2024 · 3 comments
Assignees

Comments

@jshah
Copy link

jshah commented Sep 23, 2024

Hi, is there a way to not print the DATADOG CONFIGURATION on agent startup?

Here is an example of the log that gets printed:

I, [2024-09-23T18:03:39.258492 #40673]  INFO -- ddtrace: [ddtrace] DATADOG CONFIGURATION - CORE - {"date":"2024-09-23T18:03:39Z","os_name":"x86_64-pc-linux-gnu","version":"1.23.3","lang":"ruby","lang_version":"3.1.6","env":null,"service":"rails","dd_version":null,"debug":false,"tags":null,"runtime_metrics_enabled":false,"vm":"ruby-3.1.6","health_metrics_enabled":false,"profiling_enabled":false}
@vickenty vickenty transferred this issue from DataDog/datadog-agent Sep 24, 2024
@ivoanjo ivoanjo self-assigned this Sep 24, 2024
@ivoanjo
Copy link
Member

ivoanjo commented Sep 24, 2024

Hey @jshah yes, there's a way! You can do it via environment variables:

$ DD_TRACE_STARTUP_LOGS=true bundle exec ruby -e "require 'datadog'; Datadog.configure {}"
I, [2024-09-24T10:42:29.681675 #76173]  INFO -- datadog: [datadog] DATADOG CONFIGURATION - CORE - {"date":"2024-09-24T09:42:29Z","os_name":"x86_64-pc-linux-gnu","version":"2.3.0","lang":"ruby","lang_version":"3.1.4","env":null,"service":"-e","dd_version":null,"debug":false,"tags":null,"runtime_metrics_enabled":false,"vm":"ruby-3.1.4","health_metrics_enabled":false,"profiling_enabled":false}

$ DD_TRACE_STARTUP_LOGS=false bundle exec ruby -e "require 'datadog'; Datadog.configure {}"
# (no output)

or via code:

$ bundle exec ruby -e "require 'datadog'; Datadog.configure { |c| c.diagnostics.startup_logs.enabled = false }"
# (no output)

Let me know if this works for you! 😃

@swrobel
Copy link

swrobel commented Nov 23, 2024

Inexplicably, on ddtrace 1.23.3, running DD_TRACE_STARTUP_LOGS=false rails console doesn't print the configuration, but using c.diagnostics.startup_logs.enabled = false, they are still printed 😕. My only guess is it's somehow because I'm using auto_instrument, and the config is being printed before my initializer's config is even considered?

@ivoanjo
Copy link
Member

ivoanjo commented Nov 25, 2024

My only guess is it's somehow because I'm using auto_instrument, and the config is being printed before my initializer's config is even considered?

Yes, that's the reason why! Unfortunately it's a bit of a sharp edge right now -- configuration can be applied after the library loads and starts, and "auto_instrument" triggers this exactly. The environment variable is the way to set this setting inconditionally.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants