Skip to content

Code generation: how to avoid naming collisions #1118

@lmolkova

Description

@lmolkova

As we discovered in #1031, certain semantic conventions changes (together with default code generator behavior) result in ambiguous constant names generated in the code.

For example, when foo.bar_baz is renamed to foo.bar.baz, the code generator produces the same constant name for both -FOO_BAR_BAR , FooBarBaz, etc depending on the preferred casing.

We don't remove attributes/enum members/metrics from the semantic conventions anymore (old property is deprecated), so both constants would exist in the same version.

So, the semantic conventions together with the codegen should prevent such collisions from happening:

  • The default tooling behavior should result in collision-free code.
  • There could be additional policies added to semconv to prevent certain renames.

Please comment/vote on specific options listed in the comments.

Note: there could be edge cases when ambiguity is fine and tolerable or another collision resolution approach could be used. Here we want to pick a default behavior - it does not prevent someone from implementing a different approach.

The current status is documented in this comment #1118 (comment)

Metadata

Metadata

Assignees

Labels

toolingRegarding build, workflows, build-tools, ...

Type

No type

Projects

Status

Improve YAML Schema

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions