-
Notifications
You must be signed in to change notification settings - Fork 9
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
Support v0.5 trace endpoint #505
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #505 +/- ##
==========================================
+ Coverage 70.22% 70.35% +0.12%
==========================================
Files 204 204
Lines 27581 27808 +227
==========================================
+ Hits 19370 19565 +195
- Misses 8211 8243 +32
|
if span_size != 12 { | ||
anyhow::bail!("Expected an array of exactly 12 elements in a span, got {span_size}"); | ||
} | ||
//0 - service |
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 values come in order and I imagine that's why we are doing 12 reads 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.
Yup, msgpack is self describing but as far as I know all fields are required here. Maybe Bjorn can confirm?
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.
According to the docs, all are required: https://github.com/DataDog/datadog-agent/blob/579d60cbfc8635559338b19fa855bf59b6d10f00/pkg/trace/api/version.go#L110
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, the v0.5
is extremely rigid, and all fields are required.
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.
LGTM – saw the e2e test, should we add individual tests?
Vec<( | ||
u8, | ||
u8, | ||
u8, | ||
u64, | ||
u64, | ||
u64, | ||
i64, | ||
i64, | ||
i32, | ||
HashMap<u8, u8>, | ||
HashMap<u8, f64>, | ||
u8, | ||
)>, |
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'm not familiar with the domain here--is there a struct/proto or something I can look at to see what each slot of the tuple means? At a first glance, I am inclined to agree with clippy::type_complexity
, although I realize this is just in a test.
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.
great question, I wish I had one!
What I did find was this documentation and finally this test.
I used the same fields to create the test to confirm this all worked (as well as implementing it using the python tracer).
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.
That doc comment is unfortunately the reference documentation.
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.
Looks good. Only minor comments (and some nitpicks 😉)
if span_size != 12 { | ||
anyhow::bail!("Expected an array of exactly 12 elements in a span, got {span_size}"); | ||
} | ||
//0 - service |
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, the v0.5
is extremely rigid, and all fields are required.
trace-utils/src/trace_utils.rs
Outdated
@@ -40,6 +45,210 @@ pub async fn get_traces_from_request_body(body: Body) -> anyhow::Result<(usize, | |||
Ok((size, traces)) | |||
} | |||
|
|||
#[inline] | |||
fn get_v5_strings_dict(reader: &mut Reader<impl Buf>) -> anyhow::Result<Vec<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.
Could we name all the methods with _v05_
instead of _v5_
to use the same naming as _v04_
?
trace-utils/src/trace_utils.rs
Outdated
span.service = str_from_dict(dict, s)?; | ||
}, | ||
val => anyhow::bail!("Error reading span service, value is not an integer and can't be looked up in dict: {val}") | ||
}; |
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.
This repeated code could be moved out to
fn get_v05_string(reader: &mut Reader<impl Buf>, dict: &[String], field_name: &str) -> anyhow::Result<String> {
match read_value(reader)? {
Value::Integer(s) => {
str_from_dict(dict, s)
},
val => anyhow::bail!("Error reading {field_name}, value is not an integer and can't be looked up in dict: {val}")
}
}
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.
Done
Vec<( | ||
u8, | ||
u8, | ||
u8, | ||
u64, | ||
u64, | ||
u64, | ||
i64, | ||
i64, | ||
i32, | ||
HashMap<u8, u8>, | ||
HashMap<u8, f64>, | ||
u8, | ||
)>, |
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.
That doc comment is unfortunately the reference documentation.
…g log to figure out json string encoding stuff
trace-utils/src/trace_utils.rs
Outdated
} | ||
} | ||
|
||
pub async fn v5_get_traces_from_request_body( |
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.
Almost all v5
to v05
😉
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.
oops, fixed!
BenchmarksComparisonParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics. CandidateCandidate benchmark detailsGroup 1
Warnings
BaselineBaseline benchmark detailsGroup 1
Warnings
|
* feat: add Lambda * feat: env verifier * feat: set origin tag correctly * debug: what is v5 sending us * revert * feat: v0.5 trace decompression support * fix: remove comment and unwraps * feat: remove erroneous GCP comment from my copypasta * fix: complex type, license for rmpv * feat: Rename methods to use v05. Add v05 string method. Temp debugging log to figure out json string encoding stuff * wip: more debugging * fix: use into_str instead of to_string to avoid string escaping * feat: clean up match * feat: Rename last method to get_v05 nomenclature
What does this PR do?
/v0.5/traces
which are string-compressed trace chunks.Motivation
Additional Notes
How to test the change?