-
Notifications
You must be signed in to change notification settings - Fork 58
Description
This issue describes a concrete proposal on how to realise attributes reuse through yaml syntax and tooling.
Related issues / PRs:
- Add geo fields from ECS into client and server attributes semantic-conventions#351
- Adding a few browser related attribute conventions semantic-conventions#559
Proposal
I'm proposing to introduce a new, additional type of attribute reference called embed (alternatively: nest) in the syntax that would behave similarly to ref property BUT with the following difference: When embed is used the referenced attribute will be nested under the namespace of the attribute group in which the attribute is being referenced.
Example
See the following example that illustrates the idea and the difference to ref:
We would define geo attributes in a geo.yaml file:
groups:
- id: geo
prefix: geo
type: attribute_group
brief: Describes the geo location
attributes:
- id: location.lon
type: double
brief: Longitude of the geo location in [WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84).
examples: [ -73.614830 ]
- id: location.lat
type: double
brief: Latitude of the geo location in [WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84).
examples: [ 45.505918 ]
In client and server files we would embed the attributes.
! Note: Here I consciously embed the geo.location.lon attribute BUT ref the geo.location.lat attribute to demonstrate the difference:
groups:
- id: client
prefix: client
type: attribute_group
brief: ...
attributes:
- id: address
...
- embed: geo.location.lon <<-- THAT IS NEW
- ref: geo.location.lat
When rendering (or code generating) the above it will result in the following attributes:
client.geo.location.longeo.location.lat
Note the difference that geo.location.lon is now nested under the client namespace because it was embedded (embed) while geo.location.lat keeps it's original full name because it was referenced (ref).
Extended proposal
We could even think about an embed_namespaces property on the attribute_group level to simplify embeddings of entire namespaces into other namespace. For example for geo we could do something like the following to embed ALL of the geo.* fields into the client:
groups:
- id: client
prefix: client
type: attribute_group
brief: ...
embed_namespaces:
- id: geo <<-- EMBED the entire geo namespace under client
attributes:
- id: address
...
Metadata
Metadata
Assignees
Labels
Type
Projects
Status