-
Notifications
You must be signed in to change notification settings - Fork 353
Map OpenTelemetry tag names via the registry (pass-through default) #12230
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: dougqh/generator-v2
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,20 +207,26 @@ public static void writeSpanId(StreamingBuffer buf, long spanId) { | |
|
|
||
| private static void writeSpanTag(StreamingBuffer buf, TagMap.EntryReader tagEntry) { | ||
| writeTag(buf, 9, LEN_WIRE_TYPE); | ||
| // OTLP is the OpenTelemetry wire format, so render each known tag under its OpenTelemetry rename | ||
| // when it declares one, falling back to the Datadog name otherwise (pass-through, the default). | ||
| // This is the straight rename projection only — suppressing a Datadog-only tag from OpenTelemetry, | ||
| // per-exporter opt-in, and additional namespaces are deferred to the OpenTelemetry follow-on. | ||
| String otelName = tagEntry.openTelemetryName(); | ||
| String key = otelName != null ? otelName : tagEntry.tag(); | ||
|
Comment on lines
+214
to
+215
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With the default Useful? React with 👍 / 👎.
Comment on lines
+214
to
+215
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With the registry activated by the static Useful? React with 👍 / 👎.
Comment on lines
+214
to
+215
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With the default Useful? React with 👍 / 👎. |
||
| switch (tagEntry.type()) { | ||
| case TagMap.EntryReader.BOOLEAN: | ||
| writeAttribute(buf, BOOLEAN_ATTRIBUTE, tagEntry.tag(), tagEntry.objectValue()); | ||
| writeAttribute(buf, BOOLEAN_ATTRIBUTE, key, tagEntry.objectValue()); | ||
| break; | ||
| case TagMap.EntryReader.INT: | ||
| case TagMap.EntryReader.LONG: | ||
| writeAttribute(buf, LONG_ATTRIBUTE, tagEntry.tag(), tagEntry.objectValue()); | ||
| writeAttribute(buf, LONG_ATTRIBUTE, key, tagEntry.objectValue()); | ||
| break; | ||
| case TagMap.EntryReader.FLOAT: | ||
| case TagMap.EntryReader.DOUBLE: | ||
| writeAttribute(buf, DOUBLE_ATTRIBUTE, tagEntry.tag(), tagEntry.objectValue()); | ||
| writeAttribute(buf, DOUBLE_ATTRIBUTE, key, tagEntry.objectValue()); | ||
| break; | ||
| default: | ||
| writeAttribute(buf, STRING_ATTRIBUTE, tagEntry.tag(), tagEntry.stringValue()); | ||
| writeAttribute(buf, STRING_ATTRIBUTE, key, tagEntry.stringValue()); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,6 +175,17 @@ public interface EntryReader { | |
| */ | ||
| long tagId(); | ||
|
|
||
| /** | ||
| * This entry's tag RENAME in the OpenTelemetry namespace, or {@code null} when the tag has no | ||
| * rename — in which case it passes through under its Datadog name ({@link #tag()}), which is | ||
| * the default. Also {@code null} for a custom tag or when the resolver is inactive. Pure lookup | ||
| * via {@link KnownTagCodec#openTelemetryNameOf(long)} on {@link #tagId()}; a serializer owns | ||
| * the fall-back-to-Datadog-name policy. | ||
| */ | ||
| default String openTelemetryName() { | ||
| return KnownTagCodec.openTelemetryNameOf(tagId()); | ||
|
Comment on lines
+185
to
+186
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
perf: When dense tags are enabled, AGENTS.md reference: AGENTS.md:L79-L81 Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| byte type(); | ||
|
|
||
| boolean is(byte 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.
For reserved entries, an
otel-name:with no value or a non-string value is silently cast tonull, while a blank string is accepted as a rename. This bypasses the validation now applied to stored tags: a typo can generate a pass-through mapping or even an empty alias/key instead of failing the registry build. Parse reservedotel-namevalues with the same nonblank-string-or-literal-nonevalidation used byTagConventions.parseOtelName.Useful? React with 👍 / 👎.