semantic-conventions
semantic-conventions copied to clipboard
Semconv schema: formalize registry definition
trafficstars
Today we require all attribute definitions to happen in the registry, i.e. :
- attribute definitions should be in
/model/registry - the group id must start with
registry.
We should consider having a more formal way to mark a group as one defining something. E.g.
groups:
- id: foo.bar
type: attribute_registry <-------- this is new
or
groups:
- id: new-guid
type: metric_registry <-------- this is new
This would simplify filtering/massaging semconv in code-generation, we'd avoid relying on specific group naming.
This would move post-factum policies enforcing attribute definitions into schema validation (id can only appear on *_registry groups and ref cannot appear there).
It's a good question if we can reuse existing types (attribute_group, metric, etc) and I believe the answer is no:
- we use
attribute_groupa lot to define a common group of ref attributes that are reused between multiple spans or metrics. This helps to avoid writing repetitive notes and similar for different http/messaging/etc metrics. E.g. https://github.com/open-telemetry/semantic-conventions/blob/21b8f4620d2029fe8abb98a4a06655da3232d11d/model/metrics/http.yaml#L2 - we have precedents when existing metrics are referenced with caveats (such as specific
error.typeand notes)