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

do not restrict startup logs to emit only once #3441

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

ekump
Copy link
Contributor

@ekump ekump commented Feb 6, 2024

2.0 Upgrade Guide notes
In 1.x startup logs would emit only once during initial configuration of the library. In 2.0 these logs will now emit whenever the library reconfigures itself, which may occur multiple times during startup. The increased verbosity in logging better represents the configuration state of the library at the time the logs are generated.

The default setting has not changed for startup logs. It remains nil, which generates startup logs for non-dev environments. To turn off startup logs completely you can set:

Datadog.configure { |c| c.diagnostics.startup_logs.enabled = false }

What does this PR do?
Remove the log_once restriction on startup logs.

Motivation:

Additional Notes:

How to test the change?

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

@github-actions github-actions bot added the core Involves Datadog core libraries label Feb 6, 2024
@ekump ekump force-pushed the ekump/startup-logs-can-run-emit-more-than-once branch from f9a090e to 13a2c2f Compare February 6, 2024 20:42
@ekump ekump marked this pull request as ready for review February 6, 2024 20:54
@ekump ekump requested review from a team as code owners February 6, 2024 20:54
@ekump ekump force-pushed the ekump/startup-logs-can-run-emit-more-than-once branch from 13a2c2f to 055ed8f Compare February 6, 2024 20:59
@ekump ekump requested a review from a team as a code owner February 6, 2024 20:59
@github-actions github-actions bot added the profiling Involves Datadog profiling label Feb 6, 2024
@ekump ekump force-pushed the ekump/startup-logs-can-run-emit-more-than-once branch from 055ed8f to d56d820 Compare February 7, 2024 01:30
Copy link
Member

@ivoanjo ivoanjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

Comment on lines 40 to 47
context 'with multiple invocations' do
it 'executes only once' do
it 'executes multiple times' do
env_logger.collect_and_log!
env_logger.collect_and_log!

expect(logger).to have_received(:info).once
expect(logger).to have_received(:info).twice
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Since this behavior was inherited from the parent module, I think we could probably simplify the spec and remove this test case instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I debated just removing these tests myself, but left them in to see if anyone else thought they were superfluous.

@ekump ekump force-pushed the ekump/startup-logs-can-run-emit-more-than-once branch from 54c29e8 to ee9e83e Compare February 7, 2024 21:12
@ekump ekump merged commit ae8e043 into 2.0 Feb 7, 2024
153 checks passed
@ekump ekump deleted the ekump/startup-logs-can-run-emit-more-than-once branch February 7, 2024 22:15
@TonyCTHsu TonyCTHsu added the 2.0 label Feb 20, 2024
@TonyCTHsu TonyCTHsu added this to the 2.0 milestone Feb 20, 2024
@TonyCTHsu TonyCTHsu modified the milestones: 2.0, 2.0.0.beta1 Mar 22, 2024
@marcotc marcotc mentioned this pull request Apr 2, 2024
2 tasks
@TonyCTHsu TonyCTHsu mentioned this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 core Involves Datadog core libraries profiling Involves Datadog profiling tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants