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-2334 Set duration to 0 for DI line probes #4134

Merged
merged 2 commits into from
Nov 20, 2024
Merged

Conversation

p-datadog
Copy link
Contributor

@p-datadog p-datadog commented Nov 20, 2024

What does this PR do?
This PR changes the probe notification builder to set duration to 0 in the generated payload if it was not supplied by the caller.

Motivation:
Line probes do not have a meaningful duration, however schema validation in system tests demands a numeric value.

Follow the behavior of other tracers and send 0 instead of nil in this case.

Change log entry
None

Additional Notes:

This PR also includes additional assertions in the unit test for probe notification builder to make that test in general way more useful. Some of these assertions already exist in integration tests but here they are closer to the code.

How to test the change?
Tested by system tests (DataDog/system-tests#3516) and by the unit tests in this PR.

@p-datadog p-datadog requested a review from a team as a code owner November 20, 2024 20:59
Line probes do not have a meaningful duration, however
schema validation in system tests demands an integer value.

Follow the behavior of other tracers and send 0.
Copy link
Contributor

@TonyCTHsu TonyCTHsu left a comment

Choose a reason for hiding this comment

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

Default 0 make sense to me. Can remove other nil check from the caller.

I assumed to input duration can be nil or Float, otherwise, nil.to_i can convert to 0 as well.

@p-datadog
Copy link
Contributor Author

p-datadog commented Nov 20, 2024

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 96.61017% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.78%. Comparing base (722f487) to head (71c1ea4).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
spec/datadog/di/probe_notification_builder_spec.rb 96.49% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4134      +/-   ##
==========================================
- Coverage   97.79%   97.78%   -0.01%     
==========================================
  Files        1350     1350              
  Lines       81276    81322      +46     
  Branches     4107     4107              
==========================================
+ Hits        79481    79519      +38     
- Misses       1795     1803       +8     

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


🚨 Try these New Features:

@pr-commenter
Copy link

pr-commenter bot commented Nov 20, 2024

Benchmarks

Benchmark execution time: 2024-11-20 21:56:04

Comparing candidate commit 71c1ea4 in PR branch di-duration with baseline commit ec23c49 in branch master.

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

@p-datadog p-datadog merged commit b0b8015 into master Nov 20, 2024
283 checks passed
@p-datadog p-datadog deleted the di-duration branch November 20, 2024 23:13
@github-actions github-actions bot added this to the 2.8.0 milestone Nov 20, 2024
p-datadog pushed a commit that referenced this pull request Nov 21, 2024
* psych-fix:
  Attempt to fix psych test flakiness
  DEBUG-2334 respect maxFieldCount in probe specification (#4142)
  Revert "Run the cucumber test in unbundled environment" (#4143)
  Update guard rails and doc (Excluding 3.4 installation)
  Lower declared requirements
  Use CentOS 7 images for SSI
  DEBUG-2334 require ostruct for OpenStruct dependency (#4135)
  DEBUG-2334 Set duration to 0 for DI line probes (#4134)
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