Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using prefix to define attributes #1292

Closed
lmolkova opened this issue Jul 26, 2024 · 4 comments
Closed

Stop using prefix to define attributes #1292

lmolkova opened this issue Jul 26, 2024 · 4 comments
Labels
enhancement New feature or request schema Semantic Conventions schema definition tooling Regarding build, workflows, build-tools, ...

Comments

@lmolkova
Copy link
Contributor

lmolkova commented Jul 26, 2024

Attributes can be defined in two equivalent ways.

E.g. foo.bar can be defined with prefix foo and id bar

group:
- id: foo
  prefix: foo
  attributes: 
  - id: bar

or

without prefix and id foo.bar

group:
- id: foo
  attributes: 
  - id: foo.bar

Using prefix is inconvenient:

  • when searching for attribute definition in yaml files
  • when reading yaml definitons, it's not obvious what the full attribute name would be generated
  • tooling needs to resolve full attribute name and we need to be aware of it in some cases when writing policy checks, writing jq filters, generating code

Removing prefix would keep all MD files intact, but would resolve these inconveniences without any obvious downsides.

@lmolkova lmolkova added enhancement New feature or request tooling Regarding build, workflows, build-tools, ... schema Semantic Conventions schema definition labels Jul 26, 2024
@lmolkova lmolkova changed the title Remove prefix from schema Stop using prefix to define attributes Jul 26, 2024
@lmolkova
Copy link
Contributor Author

Another option: prefix is only used to validate that attributes start with it

group:
- id: foo
  prefix: foo
  attributes: 
  - id: foo.bar

This allows to embedding #1264 to work and keeps attributes in the same group consistent, but also solves all the problems with partial name in the id.

@MadVikingGod
Copy link
Contributor

I have thought a bit about this problem and want to get a few concepts down, and propose an alternative solution.

First is that Prefix can not be just replaced with the group id, this wasn't suggested but I want to make sure it's clear. Prefix is just a useful tool to reduce repetition in the yaml.

There is a canonical name, made from the <group prefix>.<attribute id>, and right now this has to be globally unique. This is a problem, that we should test for, because neither prefixes nor attribute ids are globally unique so it's possible to create a duplicate attribute. Note we should still test for this if we take the current suggested approach to prevent any duplicate attributes.

What can be done instead of stopping the use of prefix is to make all references globally unique, and my suggestion is to change ref to be a group id and attribute id. While this would still not prevent the introduction of duplicate canonical attributes, we would always be able to refer to the particular attribute we want regardless of the addition of new attributes.

@lmolkova
Copy link
Contributor Author

The canonical name is globally unique today (within otel semconv) and our tooling tests for it. Do I miss something?

@lmolkova
Copy link
Contributor Author

lmolkova commented Aug 7, 2024

I believe it's fixed with #1293.

open-telemetry/weaver#263 stays open to track schema changes

@lmolkova lmolkova closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request schema Semantic Conventions schema definition tooling Regarding build, workflows, build-tools, ...
Projects
Archived in project
Development

No branches or pull requests

3 participants