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

[SDTEST-409] Telemetry metrics support #3768

Merged
merged 9 commits into from
Jul 10, 2024

Conversation

anmarchenko
Copy link
Member

@anmarchenko anmarchenko commented Jul 9, 2024

What does this PR do?
This is the final PR to provide metrics support to internal library telemetry.

Notable changes include:

  • Telemetry::Component now has a public API to track metrics (#inc, #dec, #gauge, #rate, #distribution)
  • Telemetry::Worker and Telemetry::Component now have shared access to MetricsManager
  • new settings are added: DD_TELEMETRY_METRICS_ENABLED to be able to disable sending metrics separately from telemetry, DD_TELEMETRY_METRICS_AGGREGATION_INTERVAL is internal-only setting to change interval to aggregate and send out metrics (10 seconds by default as defined by spec)
  • Telemetry::Worker now maintains heartbeat ticker: we aggregate metrics every 10 seconds but we send heartbeat events every 60 seconds, so it takes (heartbeat_interval / metrics_aggregation_interval) ticks for every heartbeat
  • Flushing metrics logic is changed: we actually need to flush metric events to an array to be able to send them out in the same pass of Worker#perform - this is needed to be able to flush everything on shutdown

Additional Notes:
Usage in your products:

telemetry = Datadog.send(:components)
telemetry.inc('tracers', 'spans_created', 10, tags: { 'integration_name' => 'pg' })

How to test the change?
Unit tests are provided. Please tell me if we have any product that would like to use it to submit metrics.

@github-actions github-actions bot added the core Involves Datadog core libraries label Jul 9, 2024
@anmarchenko anmarchenko force-pushed the anmarchenko/telemetry_metrics_support branch from 058a14f to fd7ae93 Compare July 9, 2024 12:09
@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.91%. Comparing base (ca006e9) to head (1f01634).
Report is 10 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #3768    +/-   ##
========================================
  Coverage   97.91%   97.91%            
========================================
  Files        1243     1243            
  Lines       74763    74894   +131     
  Branches     3608     3611     +3     
========================================
+ Hits        73205    73336   +131     
  Misses       1558     1558            

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

Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com>
@anmarchenko anmarchenko marked this pull request as ready for review July 9, 2024 14:01
@anmarchenko anmarchenko requested a review from a team as a code owner July 9, 2024 14:01
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.

Awesome work, @anmarchenko!

@anmarchenko anmarchenko merged commit ba23d76 into master Jul 10, 2024
170 checks passed
@anmarchenko anmarchenko deleted the anmarchenko/telemetry_metrics_support branch July 10, 2024 08:52
@github-actions github-actions bot added this to the 2.2.0 milestone Jul 10, 2024
@TonyCTHsu TonyCTHsu mentioned this pull request Jul 11, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants