-
Notifications
You must be signed in to change notification settings - Fork 10
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
Use send_with_retry in the trace exporter #871
Use send_with_retry in the trace exporter #871
Conversation
f71e4f1
to
d085821
Compare
d085821
to
e8d1c90
Compare
BenchmarksComparisonBenchmark execution time: 2025-02-18 18:05:20 Comparing candidate commit 3b66ffe in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 52 metrics, 2 unstable metrics. CandidateCandidate benchmark detailsGroup 1
Group 2
Group 3
Group 4
Group 5
Group 6
Group 7
Group 8
Group 9
Group 10
Group 11
Group 12
Group 13
BaselineOmitted due to size. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #871 +/- ##
==========================================
+ Coverage 71.62% 71.65% +0.02%
==========================================
Files 328 328
Lines 48262 48339 +77
==========================================
+ Hits 34567 34635 +68
- Misses 13695 13704 +9
|
let endpoint = Endpoint { | ||
url: self.output_format.add_path(&self.endpoint.url), | ||
..self.endpoint.clone() | ||
}; | ||
let send_data = SendData::new(size, tracer_payload, header_tags, &endpoint); | ||
let mut headers: HashMap<&str, String> = header_tags.into(); | ||
headers.insert(DATADOG_SEND_REAL_HTTP_STATUS_STR, "1".to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ what does 1 mean here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this header any non false value enables it. It can be changed to true but "1" is the value used in send data.
let send_data_result = send_data.send().await; | ||
// Send traces to the agent | ||
let result = | ||
send_with_retry(&endpoint, payload, &headers, &strategy, None).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ are we capturing telemetry like
- max retry count
- retry attempt
- last failure reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes they are captured in the SendPayloadTelemetry
which is sent on line 658
payload_len.try_into().unwrap_or(0), | ||
chunks.try_into().unwrap_or(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: here you can use as u64
, in this situation is safe to perform an unchecked casting since usize is always 32 or 64 bit depending on the architecture. Besides it'll probably be slightly faster due try_into
+ unwrap
could result in extra branching but I haven't disassemble the code to check it.
} | ||
|
||
impl From<&SendDataResult> for SendPayloadTelemetry { | ||
fn from(value: &SendDataResult) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think there is no test for this function. Right now it's just assigning and cloning values but if something changes in SendDataResult
the test might come in useful.
What does this PR do?
Use
send_with_retry
in trace exporter to remove ownership constraint.Motivation
Removing ownership constraint is required to remove incorrect lifetime assumption in the trace exporter.
Additional Notes
Some minor refactors were needed:
Commits although not atomic separate the changes into areas affected, so reviewing by commit can help by breaking down the changes.
How to test the change?
Describe here in detail how the change can be validated.