-
Notifications
You must be signed in to change notification settings - Fork 484
draft: implement v1 trace protocol serialization #3947
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
base: hannahkm/msgp-payload-interface
Are you sure you want to change the base?
draft: implement v1 trace protocol serialization #3947
Conversation
- Added msgp struct tags to fields in payloadV1 and traceChunk for serialization. - Introduced EncodeMsg methods for payloadV1 and spanListV1 to support msgp encoding. - Updated field types in traceChunk to enhance compatibility with msgp serialization.
BenchmarksBenchmark execution time: 2025-10-23 19:26:32 Comparing candidate commit e759d0e in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics. |
…t-v1-serialization
can this be done more efficiently?
| func getSpanKindValue(sk string) uint32 { | ||
| switch sk { | ||
| case ext.SpanKindInternal: | ||
| return 1 | ||
| case ext.SpanKindServer: | ||
| return 2 | ||
| case ext.SpanKindClient: | ||
| return 3 | ||
| case ext.SpanKindProducer: | ||
| return 4 | ||
| case ext.SpanKindConsumer: | ||
| return 5 | ||
| default: | ||
| return 1 // default to internal | ||
| } | ||
| } | ||
|
|
||
| // translate a span kind uint32 value to its string value | ||
| func getSpanKindString(sk uint32) string { | ||
| switch sk { | ||
| case 1: | ||
| return ext.SpanKindInternal | ||
| case 2: | ||
| return ext.SpanKindServer | ||
| case 3: | ||
| return ext.SpanKindClient | ||
| case 4: | ||
| return ext.SpanKindProducer | ||
| case 5: | ||
| return ext.SpanKindConsumer | ||
| default: | ||
| return ext.SpanKindInternal | ||
| } | ||
| } |
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 these functions covered somewhere in the OpenTelemetry code (either ours or elsewhere)? I could not find anything internal that supports this. We should also check with the OTel team to see if there are better places to put this.
| assert.NoError(err) | ||
| assert.Empty(o) | ||
| assert.NotEmpty(got.attributes) | ||
| assert.Equal(p.attributes, got.attributes) |
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 to see the v1 payload coming alone!
Just checking to verify if process tags are added automatically in attributes
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 suppose if they weren't this test would catch it: https://github.com/DataDog/system-tests/blob/main/tests/apm_tracing_e2e/test_process_tags.py#L23-L25?
|
|
||
| // encodeAttributes encodes an array associated with fieldID into the buffer in msgp format. | ||
| // Each attribute is encoded as three values: the key, value type, and value. | ||
| func (p *payloadV1) encodeAttributes(bm bitmap, fieldID int, kv map[string]anyValue, st *stringTable) (bool, error) { |
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 do not see any reference to process tags being encoded in attributes though, did I miss a place where it's called or are our system-tests not catching the missing tags?
What does this PR do?
Implements the v1 trace protocol. Includes commits cherry-picked from #3932 since I closed my previous PR.
Motivation
https://datadoghq.atlassian.net/browse/LANGPLAT-750
Reviewer's Checklist
./scripts/lint.shlocally.Unsure? Have a question? Request a review!