semantic-conventions
semantic-conventions copied to clipboard
Code generation: how to avoid naming collisions
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.