Skip to content

Conversation

@hannahkm
Copy link
Contributor

@hannahkm hannahkm commented Sep 5, 2025

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

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

- 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.
@pr-commenter
Copy link

pr-commenter bot commented Sep 5, 2025

Benchmarks

Benchmark execution time: 2025-10-23 19:26:32

Comparing candidate commit e759d0e in PR branch hannahkm/implement-v1-serialization with baseline commit bbb62d2 in branch hannahkm/msgp-payload-interface.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics.

@datadog-official
Copy link
Contributor

datadog-official bot commented Sep 5, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e759d0e | Docs | Was this helpful? Give us feedback!

Comment on lines +450 to +483
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
}
}
Copy link
Contributor Author

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)
Copy link
Member

@raphaelgavache raphaelgavache Oct 23, 2025

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// 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) {
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants