-
Notifications
You must be signed in to change notification settings - Fork 902
Fix TraceState key validation limits to match W3C spec #7575
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: main
Are you sure you want to change the base?
Fix TraceState key validation limits to match W3C spec #7575
Conversation
The committers listed above are authorized under a signed CLA. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7575 +/- ##
============================================
- Coverage 90.01% 90.00% -0.01%
Complexity 7080 7080
============================================
Files 803 803
Lines 21417 21417
Branches 2086 2086
============================================
- Hits 19278 19276 -2
- Misses 1477 1478 +1
- Partials 662 663 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
void testVendorIdLongerThan13Characters() { | ||
assertThat(TraceState.builder().put("1@nrabcdefghijkl", FIRST_VALUE).build()) | ||
void testVendorIdWith14Characters() { | ||
String key = "1@nrabcdefghijkl"; |
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 is 16 chars
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.
Multi-tenant keys are formed with: a tenant-id
, the "@" symbol, and a system-id
(called vendor-id in the otel-java codebase).
This test verifies behavior for a system-id
of 14 chars, so what follows the @ should be that long
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.
Thanks!
Summary
This PR fixes the multi-tenant vendor key validation limits in
ArrayBasedTraceStateBuilder
to properly comply with the W3C Trace Context specification.Changes:
MAX_VENDOR_ID_SIZE
from 13 to 14 charactersMAX_TENANT_ID_SIZE
from 240 to 241 charactersBackground
The current implementation incorrectly rejects valid keys according to the W3C Trace Context specification. The rules define:
This means:
tenant-id
: 1 + 240 = 241 characters maximumsystem-id
: 1 + 13 = 14 characters maximum