Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Unable to suppress all logs from the buildpack #340

Open
karlhe opened this issue Jun 16, 2023 · 0 comments
Open

Unable to suppress all logs from the buildpack #340

karlhe opened this issue Jun 16, 2023 · 0 comments

Comments

@karlhe
Copy link

karlhe commented Jun 16, 2023

This may apply to other logs as well, but specifically I'm having issues with these 2 log lines:

echo "DD_API_KEY environment variable not set. Run: heroku config:add DD_API_KEY=<your API key>"

echo "The Datadog Agent has been disabled. Unset the DISABLE_DATADOG_AGENT or set missing environment variables."

The problem being that these messages cannot be suppressed in any way, via DD_LOG_LEVEL or otherwise, and these messages specifically display when there is no intent to have the datadog agent run, i.e. when DD_API_KEY is unset or when DISABLE_DATADOG_AGENT is set.

This is especially an issue with one-off dynos, where it is (1) often desirable to disable the agent, and (2) the output may need to be programmatically parsed, and the above log lines are noise in the output.

e.g. if I were to do heroku run output_csv or something along those lines, the datadog logs would be included with that.

Suggested changes:

  1. Offer some way to suppress these log messages, either via DD_LOG_LEVEL or otherwise.
  2. Preferably, offer some way to suppress these via prerun.sh, in case one were to disable the agent via that means (e.g. https://docs.datadoghq.com/agent/basic_agent_usage/heroku/#disabling-the-datadog-agent-for-short-lived-dynos). Currently the layout of datadog.sh makes it so that you cannot affect DD_LOG_LEVEL via prerun.sh, also because of where it is loaded, even if you were able to affect it, one of the aforementioned lines would have already printed by then.

I would be happy to open a PR for this if desired, but the changes in question would be fairly simple anyway, and I don't know if you have a preferred way to handle this.

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

No branches or pull requests

1 participant