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 generation improvements #3966

Merged
merged 18 commits into from
Jun 14, 2024
Merged

Conversation

lmolkova
Copy link
Contributor

@lmolkova lmolkova commented Jun 13, 2024

Description

Prepares tooling to allow #3964:

  • fixes namespace exclusion issue (that prevented os and net namespaces from being generated
  • adds support for attribute exclusion
  • enables mypy on semconv and fixes violations
  • adds check for duplicate const definition (apparently there is no linter check for it)

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

How Has This Been Tested?

  • manually add duplicate attribute or metric, check if generation printed errors and script failed
  • try excluding attribute check that it's not generated

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:

  • The OTel specification has changed which prompted this PR to update the method interfaces of opentelemetry-api/ or opentelemetry-sdk/

  • The method interfaces of test/util have changed

  • Scripts in scripts/ that were copied over to the Contrib repo have changed

  • Configuration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in

    • pyproject.toml
    • isort.cfg
    • .flake8
  • When a new .github/CODEOWNER is added

  • Major changes to project information, such as in:

    • README.md
    • CONTRIBUTING.md
  • Yes. - Link to PR:

  • No.

Checklist:

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

@lmolkova lmolkova requested a review from a team June 13, 2024 00:56
@xrmx
Copy link
Contributor

xrmx commented Jun 13, 2024

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

@lzchen lzchen added the Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary label Jun 13, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this!

@lzchen
Copy link
Contributor

lzchen commented Jun 13, 2024

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
Copy link
Contributor Author

lmolkova commented Jun 13, 2024

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 - open-telemetry/semantic-conventions#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
Copy link
Contributor

lzchen commented Jun 14, 2024

@lmolkova

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approve Public API check This label shows that the public symbols added or changed in a PR are strictly necessary
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants