open-telemetry / opentelemetry-python

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

Semconv generation improvements #3966

Closed lmolkova closed 2 weeks ago

lmolkova commented 2 weeks ago

Description

Prepares tooling to allow https://github.com/open-telemetry/opentelemetry-python/pull/3964:

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Does This PR Require a Contrib Repo Change?

Answer the following question based on these examples of changes that would require a Contrib Repo Change:

Checklist:

xrmx commented 2 weeks ago

@lmolkova please add a changelog entry, this is a good change to record

lzchen commented 2 weeks ago

I think mypy build is complaining on the deprecated decorators. Try passing the version="1.25.0" directly.

@deprecated(
    reason="Use :py:const:`opentelemetry.semconv._incubating.attributes.OsTypeValues` instead.",
    version="1.25.0",
)
lmolkova commented 2 weeks ago

version="1.25.0",

the problem is that we don't know when the attribute was deprecated. I can only provide the current version (1.25.0), but it'll be updated every time code is regenerated with new version and it won't be accurate.

We might add a property to track the version in the schema - https://github.com/open-telemetry/semantic-conventions/issues/1117 and then we'd be able to generate accurate docstring.

For the time being, I'd prefer to keep it empty and suppress the lint check.

Update: @deprecated(reason="...", version="...") still raises a warning 🤷‍♀️

lzchen commented 2 weeks ago

@lmolkova

I'm okay with ignoring the mypy warnings for deprecated.