fix: Add safeguards for addToTrace#1490
Conversation
Asset Size Report
Merging this pull request will result in the following asset size changes:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1490 +/- ##
=======================================
Coverage 87.70% 87.71%
=======================================
Files 197 197
Lines 7746 7749 +3
Branches 1554 1555 +1
=======================================
+ Hits 6794 6797 +3
Misses 820 820
Partials 132 132
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
72dc5ae to
8d686a0
Compare
cwli24
left a comment
There was a problem hiding this comment.
Do you want to make msg 61 specific to the Trace API? Or keep it generic so that maybe we can reuse this warning message for other checks in the agent.
Supportability Metric Usage Changes:No matching changes found Supportability Metrics .md File Changes:supportability_metrics.md was changed? New supportability metrics require changes to supportability_metrics.md, as well as a new PR to Angler. Please ensure an Angler PR is created and linked to this PR. |
Events created with addToTrace API, which have an invalid UNIX timestamp, emit a warning and return without creating the event.
Overview
Added safeguards for
addToTrace()API call. It was possible to have negative timestamps before with misuse. This PR does not create the event if the timestamps are negative. A warning is emitted of error code 61 if the timestamps are invalid.At first I thought that the requirements were to only check that the arguments of the method are valid timestamps, but it makes more sense to me to check that the timestamps in the event creation are valid.
Related Issue(s)
JIRA: https://new-relic.atlassian.net/browse/NR-366078
Testing
Make sure tests pass