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

DEBUG-3210 DI: change logging to be appropriate for customer inspection #4266

Merged
merged 9 commits into from
Jan 8, 2025

Conversation

p-datadog
Copy link
Member

Replaces #4230

What does this PR do?

Changes logging levels used in DI:

  • Failure to enable DI is now a warning (since enabling it must have been requested by the customer).
  • Remaining logging calls are now emitted at debug level, making those entries not visible in customer logs.

All log messages have datadog: di: prefix to make it easy for customers to understand what is generating them.

Motivation:

DI currently uses the logger for reporting its internal issues. However, the logger normally logs to customer logs, and as such the default logging should be customer-centric, meaning log entries should only be created for matters that the customers understand and can fix.

Change log entry

Dynamic instrumentation: logging of internal conditions is now done on debug level, and these log entries will not be visible by default in customer applications.

Additional Notes:

I attempted to use block form of logger calls to delay string interpolation until the logging actually happens, but this made my logging assertions fail in the test suite. Since the logging should be very infrequent I kept the calls as they were (pre-interpolated).

How to test the change?

Due to the introduction of an additional layer of abstraction for DI logging, end-to-end tests will need to have additional assertions added for log entries being visible (or not). This will be done as part of DEBUG-3210 but is not part of this PR.

@p-datadog p-datadog requested a review from a team as a code owner January 8, 2025 15:42
@p-datadog p-datadog added this to the 2.9.0 milestone Jan 8, 2025
Copy link

github-actions bot commented Jan 8, 2025

👋 Hey @p-datadog, please fill "Change log entry" section in the pull request description.

If changes need to be present in CHANGELOG.md you can state it this way

**Change log entry**

Yes. A brief summary to be placed into the CHANGELOG.md

(possible answers Yes/Yep/Yeah)

Or you can opt out like that

**Change log entry**

None.

(possible answers No/Nope/None)

Visited at: 2025-01-08 15:43:23 UTC

@datadog-datadog-prod-us1
Copy link
Contributor

datadog-datadog-prod-us1 bot commented Jan 8, 2025

Datadog Report

Branch report: di-logger-2
Commit report: af7282b
Test service: dd-trace-rb

✅ 0 Failed, 22132 Passed, 1476 Skipped, 5m 9.15s Total Time

@pr-commenter
Copy link

pr-commenter bot commented Jan 8, 2025

Benchmarks

Benchmark execution time: 2025-01-08 19:22:10

Comparing candidate commit af7282b in PR branch di-logger-2 with baseline commit e3ea38f in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 31 metrics, 2 unstable metrics.

@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 68.08511% with 15 lines in your changes missing coverage. Please review.

Project coverage is 97.73%. Comparing base (9440c03) to head (af7282b).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
lib/datadog/di/component.rb 42.85% 4 Missing ⚠️
lib/datadog/di/probe_notifier_worker.rb 0.00% 4 Missing ⚠️
lib/datadog/di/instrumenter.rb 25.00% 3 Missing ⚠️
lib/datadog/di/probe_manager.rb 50.00% 2 Missing ⚠️
lib/datadog/di/code_tracker.rb 0.00% 1 Missing ⚠️
spec/datadog/di/spec_helper.rb 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4266      +/-   ##
==========================================
- Coverage   97.73%   97.73%   -0.01%     
==========================================
  Files        1352     1352              
  Lines       82409    82424      +15     
  Branches     4224     4232       +8     
==========================================
+ Hits        80545    80557      +12     
- Misses       1864     1867       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Left a few notes + I had left a few extra text suggestion improvements on the earlier #4230 .

lib/datadog/di/code_tracker.rb Outdated Show resolved Hide resolved
lib/datadog/di/code_tracker.rb Outdated Show resolved Hide resolved
lib/datadog/di/component.rb Outdated Show resolved Hide resolved
p and others added 2 commits January 8, 2025 13:57
Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com>
@p-datadog
Copy link
Member Author

I did also apply the wording suggestions, they got reverted but now are reinstated.

@p-datadog p-datadog merged commit 2e98fc4 into master Jan 8, 2025
337 checks passed
@p-datadog p-datadog deleted the di-logger-2 branch January 8, 2025 19:34
p-datadog pushed a commit to p-datadog/dd-trace-rb that referenced this pull request Jan 9, 2025
* master:
  DEBUG-3210 DI: change logging to be appropriate for customer inspection (DataDog#4266)
  Report timing information if try_wait_until times out (DataDog#4265)
  Move simplecov patch to an overlay in our tree instead of using a forked simplecov repo (DataDog#4263)
  DEBUG-3251 dependency inject logger into DI component (DataDog#4262)
  DEBUG-3182 move Rails utils to core (DataDog#4261)
  add supported versions workflow (DataDog#4210)
  DEBUG-3305 remove dependency on benchmark (DataDog#4259)
  Fix case & grammar in issue template (DataDog#4244)
  [🤖] Update Latest Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/12614773826
@p-datadog p-datadog mentioned this pull request Jan 15, 2025
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

Successfully merging this pull request may close these issues.

4 participants