Semconv signal-type queries and log attribute validation#158
Merged
Conversation
Metrics(), Spans(), Events(), and Entities() filter groups by type, completing the signal-type-aware registry API from issue 113.
validate now checks log attribute names against the semantic convention registry, warning on deprecated attributes and static values outside a known enum's members. Unknown attribute names remain allowed as custom attributes.
There was a problem hiding this comment.
Pull request overview
Adds signal-type query helpers to the semantic convention registry and extends motel validate to warn about semconv log-attribute issues (deprecated attributes and invalid enum values) without failing validation.
Changes:
- Added
Metrics(),Spans(),Events(), andEntities()query methods topkg/semconv.Registry. - Added
semconvLogWarningstomotel validate, emitting stderr warnings for deprecated log attributes and static enum-value mismatches. - Added tests covering mixed-type registry queries and log warning behavior (including embedded-registry smoke assertions).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/semconv/registry.go | Adds type-filtered group query helpers (Metrics/Spans/Events/Entities) via a shared groupsByType. |
| pkg/semconv/registry_test.go | Adds mixed-type fixture test plus embedded-data smoke test for the new query helpers. |
| cmd/motel/main.go | Invokes new log warnings during validate and implements enum membership checking for static log attribute values. |
| cmd/motel/main_test.go | Adds focused tests for deprecated log attributes and enum membership warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Completes the remaining work for issue 113 (work item 4 was split out to issue 157).
Signal-type query methods in
pkg/semconvThe registry previously exposed only
MetricByNamefor signal-aware lookups. This adds the type filters identified in the issue 113 audit:Metrics(),Spans(),Events(),Entities()— return all groups of the given typeThese are the building blocks for semconv suggestions (issue 157).
Log attribute validation in
motel validateIssue 112 added
logs:to the topology DSL with arbitrary attribute maps, but attribute names were never checked against the semantic conventions.motel validatenow warns when a log attribute:log.iostream: syslogwhen the convention allows onlystdout/stderr)Unknown attribute names produce no warning — custom attributes remain allowed, consistent with the existing metric warnings (
semconvMetricWarnings), which this mirrors.Notes
make testandmake lintpasshttps://claude.ai/code/session_0134t4ENXTnwsTJfv6LJfF5e