open-telemetry / build-tools

Building tools provided by OpenTelemetry
https://opentelemetry.io
Apache License 2.0
37 stars 54 forks source link

[feature] Build tools/schema should define code-friendly attribute/metric/event/etc names #323

Open jsuereth opened 4 months ago

jsuereth commented 4 months ago

See https://github.com/open-telemetry/semantic-conventions/issues/1118 for context

jsuereth commented 3 months ago

We are no longer changing how constants are named. We will either be dropping deprecated names or keeping both with different names in some way.

lmolkova commented 2 months ago

Based on the conclusion in https://github.com/open-telemetry/semantic-conventions/issues/1118#issuecomment-2173803006, we need to be able to resolve codegen conflicts at semconv definition time.

E.g.:

Some ideas

  1. dropping old

    attributes:
      - id: foo.bar_baz
        deprecated: "Use `foo.bar.baz` instead"
        code_friendly_name: none # new, optional property, defaults to snake_case(id) 
  2. preserving old and giving new attribute new code const name

    attributes:
      - id: foo.bar_baz
        deprecated: "Use `foo.bar.baz` instead"
    
      - id: foo.bar.baz
        code_friendly_name: foo_bar_baz2
  3. Defining code-friendly name for not supported characters

      - id: pprof::foo.bar
        code_friendly_name: pprof_foo_bar