-
Notifications
You must be signed in to change notification settings - Fork 16
fix(profiling)!: set correct headers and mime type for exporter #1488
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
Conversation
📚 Documentation Check Results📦
|
🔒 Cargo Deny Results📦
|
11141f9 to
5d51f82
Compare
5d51f82 to
06429f1
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1488 +/- ##
=======================================
Coverage 71.06% 71.06%
=======================================
Files 422 422
Lines 68640 68692 +52
=======================================
+ Hits 48776 48814 +38
- Misses 19864 19878 +14
🚀 New features to boost your workflow:
|
BenchmarksComparisonBenchmark execution time: 2026-01-29 15:46:47 Comparing candidate commit ca15195 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 57 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
Group 14
Group 15
Group 16
Group 17
Group 18
Group 19
BaselineOmitted due to size. |
morrisonlevi
left a comment
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.
I didn't finish my review because I have to go pick my son from D&D club, but I thought I'd leave what I have so far.
|
|
||
| fn try_from(mime: MimeType) -> std::result::Result<Self, Self::Error> { | ||
| match mime { | ||
| MimeType::Invalid => anyhow::bail!("Invalid MIME type"), |
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.
I don't mind too much, but something that stood out to me:
- For all prior releases, we didn't send mime types.
- Now suddenly, it's an error to not send one?
- Should we really fail, or do whatever we did before? Should
exporter::MimeTypebe optional, and if it's None, we don't set it or whatever we did before? Then aMimeType.Invalidcan map toNone? - This match isn't exhaustive, because it's
repr(C), I'd be fine with unrecognized, non-zero values being a failure (what is happening?!)
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-apple-darwin
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-apple-darwin
x86_64-unknown-linux-gnu
|
This needs DataDog/libdatadog#1488 which is still WIP
06429f1 to
b92b05a
Compare
| // Optional headers (API key, test token) | ||
| if let Some(api_key) = &endpoint.api_key { | ||
| headers.insert( | ||
| "DD-API-KEY", | ||
| reqwest::header::HeaderValue::from_str(api_key)?, | ||
| ); | ||
| } | ||
| if let Some(test_token) = &endpoint.test_token { | ||
| headers.insert( | ||
| "X-Datadog-Test-Session-Token", | ||
| reqwest::header::HeaderValue::from_str(test_token)?, | ||
| ); | ||
| } | ||
|
|
||
| // Add container ID header if available | ||
| if let Some(container_id) = entity_id::get_container_id() { | ||
| headers.insert( | ||
| header::DATADOG_CONTAINER_ID, | ||
| reqwest::header::HeaderValue::from_static(container_id), | ||
| ); | ||
| } | ||
|
|
||
| // Add entity ID header if available | ||
| if let Some(entity_id_value) = entity_id::get_entity_id() { | ||
| headers.insert( | ||
| header::DATADOG_ENTITY_ID, | ||
| reqwest::header::HeaderValue::from_static(entity_id_value), | ||
| ); | ||
| } | ||
|
|
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.
So this code seems very close to
libdatadog/libdd-common/src/lib.rs
Line 250 in 7f30d50
| pub fn to_request_builder(&self, user_agent: &str) -> anyhow::Result<HttpRequestBuilder> { |
DD_EXTERNAL_ENV -- are we missing that one?
More as a deeper question, should we perhaps try to share more code with ddcommon here? E.g. it looks very easy to me for them to diverge (as it just happened to us)
|
#1492 covers the mime changes in a simpler and cleaner way |
|
#1493 fixes the header issue |
What does this PR do?
invalidenum value to catch when the enum was defaulted to 0.Motivation
Additional Notes
Anything else we should know when reviewing?
How to test the change?
New tests.