Skip to content

Fix: Suppress deprecated warnings in generated semconv metric headers#4088

Open
RaviTriv wants to merge 2 commits into
open-telemetry:mainfrom
RaviTriv:ravtrive/fix-semconv-deprecation-warnings
Open

Fix: Suppress deprecated warnings in generated semconv metric headers#4088
RaviTriv wants to merge 2 commits into
open-telemetry:mainfrom
RaviTriv:ravtrive/fix-semconv-deprecation-warnings

Conversation

@RaviTriv
Copy link
Copy Markdown

@RaviTriv RaviTriv commented May 18, 2026

Fixes #3986

Changes

Attempting fix for issue 3986, deprecation warnings reported from metrics_foo_library example.

When some of the semconv generated headers are included, deprecated warnings for functions are produced even if the function is not used. This occurs because the function uses deprecated variables in its body. That's triggers -Wdeprecated-declarations and since these helpers are static inline in a header, every file that includes the header gets the warning. This PR proposes adding new macros, OPENTELEMETRY_SUPPRESS_DEPRECATED_BEGIN and OPENTELEMETRY_SUPPRESS_DEPRECATED_END to manually wrap these deprecated variables in the generator.

Appreciate time and effort for review. Happy to discuss / update to a more approriate solution.

Thank you :)

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 18, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: RaviTriv / name: Ravi (1b6be97)

@RaviTriv RaviTriv changed the title Suppress deprecated warnings in generated semconv metric headers Fix: Suppress deprecated warnings in generated semconv metric headers May 18, 2026
@RaviTriv RaviTriv marked this pull request as ready for review May 20, 2026 21:38
@RaviTriv RaviTriv requested a review from a team as a code owner May 20, 2026 21:38
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.

Deprecation warnings reported from metrics_foo_library example

2 participants