Description
Context
Currently, in the model/**
directory we mix up two things:
- Defining an attribute (with the name, type, description of its semantics, examples)
- Usage of an attribute in a concrete context (e.g. HTTP semantic conventions, DB semantic conventions, etc.) with the corresponding requirement level in that context
For example http.request.method_original
is originally defined in model/trace/http.yml
but it's something that would be relevant for logs and potentially other domains (than pure HTTP).
Proposal
I'm proposing to split the above two concerns by introducing an attribute-registry
sub-dir under model. All attribute definitions will live in the attribute-registry
:
- All attributes would be defined in the same way as today (with name, type, description, etc)
- In the registry, all attributes will have the default requirement level
opt-in
- I'd propose to structure the attribute definitions by the namespace (e.g. one file for all
http.*
attribute, one fornetwork.*
, etc.)
All other sub-directories under /model
represent usages of attributes. Thus, they would always only reference attributes that are defined in the registry. When attributes are being used in a certain domain (e.g. HTTP) the requirement level should be overwritten corresponding to the domain and signal. Same as it's already being done with references, other properties of the attribute (such as description, examples, etc.) can be overwritten for a specific domain / context as well.
That's how it would look like in the directory structure:
- ...
- model
- attributes-registry <-- ALL attributes MUST be defined here
- http.yml
- network.yml
- faas.yml
- ...
- trace
- http.yml
- messaging.yaml
- ...
- metrics
- http.yml
- ...
- resource
- host.yml
- cloud.yml
- ...
Benefits
- Easier reuse of attributes in different domains and signals
- This would allow to render an attributes registry / dictionary as an overview over all defined attributes (similar to the ECS Fields Reference)
- Currently, there are some orphan attributes. For example
http.request.method
. It's being used in multiple places, but there's no place in the markdown files where that attribute is originally defined. (See the Elasticsearch semconv as an example, there's no link to thehttp.request.method
definition) - This would allow to define attributes without binding them to a specific domain or signal, which would make the merger with ECS easier for many non-conflicting field / attribute sets.
- It's easier to understand where attributes are defined, currently it's not intuitive.
If there's interest in realizing this or an adapted proposal, I'm happy to drive the realization.