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

Implement telemetry log #3850

Merged
merged 5 commits into from
Aug 21, 2024
Merged

Implement telemetry log #3850

merged 5 commits into from
Aug 21, 2024

Conversation

TonyCTHsu
Copy link
Contributor

What does this PR do?

This PR enables developer to send telemetry logs for internal observability.

@github-actions github-actions bot added the core Involves Datadog core libraries label Aug 19, 2024
@TonyCTHsu TonyCTHsu marked this pull request as ready for review August 19, 2024 15:01
@TonyCTHsu TonyCTHsu requested a review from a team as a code owner August 19, 2024 15:01
@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 94.39252% with 6 lines in your changes missing coverage. Please review.

Project coverage is 97.86%. Comparing base (d2498fb) to head (5f65370).
Report is 24 commits behind head on master.

Files Patch % Lines
spec/datadog/core/telemetry/component_spec.rb 77.77% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3850      +/-   ##
==========================================
+ Coverage   97.83%   97.86%   +0.03%     
==========================================
  Files        1264     1271       +7     
  Lines       75725    75975     +250     
  Branches     3729     3739      +10     
==========================================
+ Hits        74084    74353     +269     
+ Misses       1641     1622      -19     

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

@pr-commenter
Copy link

pr-commenter bot commented Aug 19, 2024

Benchmarks

Benchmark execution time: 2024-08-21 10:52:26

Comparing candidate commit 5f65370 in PR branch tonycthsu/telemetry_log with baseline commit b7b99b2 in branch master.

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

scenario:profiler - Allocations (baseline)

  • 🟩 throughput [+124772.281op/s; +139418.282op/s] or [+2.394%; +2.675%]

scenario:profiler - Allocations (profiling disabled)

  • 🟩 throughput [+196926.064op/s; +204312.166op/s] or [+3.974%; +4.123%]

scenario:profiler - Allocations (profiling enabled)

  • 🟩 throughput [+198401.928op/s; +209347.150op/s] or [+4.046%; +4.270%]

telemetry.log!(event)
else
Datadog.logger.debug do
"Sending telemetry log about #{message} before telemetry component is ready"
Copy link
Contributor

Choose a reason for hiding this comment

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

I find "sending" to be misleading because nothing is actually sent. Suggest either "attempting to send" or "requested to send" or similar. Also, I would put the message at the end so that it's clear where the diagnostics of this component ends and where the forwarded message is. E.g. "Requested to send telemetry log when telemetry component is not ready: #{message}". Is it possible for telemetry to be never turned on, i.e. it would actually not ever become ready?

Copy link
Member

Choose a reason for hiding this comment

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

The telemetry object is always created, even if telemetry is disabled

Telemetry::Component.new(
http_transport: transport,
enabled: enabled,

so it will eventually become no-nil.

I also like that this message is at debug level, so people have to manually enable debug-level logs to see it.

I do agree that the messaging can be more precise.

Copy link
Member

Choose a reason for hiding this comment

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

Minor: Should we perhaps print the whole event and not just the message when logging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think printing the whole event is necessary, since the issue is not caused by event itself.

Copy link
Member

Choose a reason for hiding this comment

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

My thinking for this suggestion is, if later we add more information to the event (e.g. stack), we'll need to remember to tweak the debug message, whereas if we print the whole event, then we won't need to touch it again.

Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

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

Looks good!
I believe @y9v's and @p-datadog's comments are relevant and should be responded to or addressed.

@TonyCTHsu TonyCTHsu merged commit e7a6609 into master Aug 21, 2024
186 checks passed
@TonyCTHsu TonyCTHsu deleted the tonycthsu/telemetry_log branch August 21, 2024 11:39
@github-actions github-actions bot added this to the 2.3.0 milestone Aug 21, 2024
@TonyCTHsu TonyCTHsu added the dev/internal Other internal work that does not need to be included in the changelog label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries dev/internal Other internal work that does not need to be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants