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

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

Closed

Conversation

lmolkova
Copy link
Contributor

@lmolkova lmolkova commented May 22, 2024

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 open-telemetry/semantic-conventions#1031 and open-telemetry/semantic-conventions#1118 for the discussion.

Based on open-telemetry/semantic-conventions#1118, the semconv recommendation would be to:

  • Remove _ when generating any constants in the code (fields, methods, class names, etc)
  • Semconv will prohibit attribute renames that are limited to adding/removing _

This PR demonstrates the result of such naming policy change.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

scripts/semconv/generate.sh Outdated Show resolved Hide resolved
@lmolkova lmolkova force-pushed the semconv-disambiguate-const-name branch from 5f3e32c to 669bdf8 Compare June 6, 2024 18:06
@lmolkova lmolkova changed the title Semconv codegen should produce different constant names if attribute is renamed _ -> . Semconv codegen should produce different constant names if attribute is renamed _ -> `` Jun 6, 2024
@lmolkova
Copy link
Contributor Author

lmolkova commented Jun 12, 2024

Closing this one as not viable (constants without _ as AWSELASTICBEANSTALK are not just ugly, but also unreadable) - open-telemetry/semantic-conventions#1118 (comment)

xrmx#1 is an alternative.

@lmolkova lmolkova closed this Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants