open-telemetry / opentelemetry-python

OpenTelemetry Python API and SDK
https://opentelemetry.io
Apache License 2.0
1.67k stars 569 forks source link

Semconv codegen should produce different constant names if attribute is renamed `_` -> `` #3927

Closed lmolkova closed 2 weeks ago

lmolkova commented 1 month ago

Description

Code generator generates the same attribute name constant for attribute.name and attribute_name. As a result, if attribute is renamed (_ is changed to . or vice versa), the value of attribute changes, but the name stays the same.

It's ambiguous - see https://github.com/open-telemetry/semantic-conventions/issues/1031 and https://github.com/open-telemetry/semantic-conventions/issues/1118 for the discussion.

Based on https://github.com/open-telemetry/semantic-conventions/issues/1118, the semconv recommendation would be to:

This PR demonstrates the result of such naming policy change.

Type of change

Please delete options that are not relevant.

Checklist:

lmolkova commented 2 weeks ago

Closing this one as not viable (constants without _ as AWSELASTICBEANSTALK are not just ugly, but also unreadable) - https://github.com/open-telemetry/semantic-conventions/issues/1118#issuecomment-2153771721

https://github.com/xrmx/opentelemetry-python/pull/1 is an alternative.