feat(otlp): record schema_url for traces and logs#344
Open
MikeGoldsmith wants to merge 6 commits intomainfrom
Open
feat(otlp): record schema_url for traces and logs#344MikeGoldsmith wants to merge 6 commits intomainfrom
MikeGoldsmith wants to merge 6 commits intomainfrom
Conversation
…logs Records OTel schema URLs as event attributes across all OTLP translation paths: - Proto path (traces.go, logs.go) - Binary msgp path (traces_direct.go) - JSON msgp path (traces_direct_json.go) resource.schema_url comes from ResourceSpans/ResourceLogs.schema_url. scope.schema_url comes from ScopeSpans/ScopeLogs.schema_url, which takes precedence per the OTel spec when both are present. Assisted-by: Claude Sonnet 4.6
VinozzZ
reviewed
Feb 24, 2026
codeboten
reviewed
Feb 24, 2026
…-scan Addresses review feedback: - Restore break loop on field 1 (resource/scope) in the first pass, recovering the early-exit optimization that was lost when schema_url was added - Add a dedicated pre-scan pass for schema_url (field 3) before the spans pass, since field 3 appears after field 2 (scope_spans/spans) in canonical proto encoding and must be in attrs before span processing begins - Extract "resource.schema_url" and "scope.schema_url" as package-level consts Assisted-by: Claude Sonnet 4.6
Assisted-by: Claude Sonnet 4.6
…ore span processing Assisted-by: Claude Sonnet 4.6
Contributor
Author
|
Updated to add consts for
Let me know what you think 😄 |
codeboten
approved these changes
Feb 25, 2026
VinozzZ
reviewed
Feb 25, 2026
| if len(slice) > 0 { | ||
| resourceAttrs.addString([]byte(attrResourceSchemaURL), slice) | ||
| } | ||
| default: |
Contributor
There was a problem hiding this comment.
Once we find the schema_url field, we can break out of this loop early
Contributor
Author
There was a problem hiding this comment.
Like this?
Suggested change
| default: | |
| break loop | |
| default: |
Contributor
There was a problem hiding this comment.
The second loop iterates over the same data as the first for loop (which is somewhat confusingly named loop). I suggest introducing a distinct variable name for the second for loop on line 574, such as schemaURLLoop, to make the intent clearer.
We should also break out of that loop once a schemaURL field is found on line 591, since there’s no need to continue iterating after that point.
…tting Assisted-by: Claude Sonnet 4.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
OTel schema URLs identify which version of OTel semantic conventions a service's instrumentation follows (e.g.
https://opentelemetry.io/schemas/1.21.0). Husky was discarding these entirely. Without them, Canvas can't distinguishhttp.urlfromurl.fullor understand why column names differ across datasets.Closes OTEL-121 (partial — traces/logs only; metrics handled in hound).
Short description of the changes
Records OTel schema URLs as event attributes across all OTLP translation paths:
resource.schema_url— fromResourceSpans.schema_url/ResourceLogs.schema_urlscope.schema_url— fromScopeSpans.schema_url/ScopeLogs.schema_urlCovers all 4 paths:
traces.go,logs.go)traces_direct.go)traces_direct_json.go)Per the OTel spec, scope-level schema_url takes precedence over resource-level when both are present (enforced at query time by Canvas, not at ingestion).
Assisted-by: Claude Sonnet 4.6