Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[CMAKE] add generated protobuf headers to the opentelemetry_proto target #3400

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

Merged

Conversation

dbarker
Copy link
Contributor

@dbarker dbarker commented May 11, 2025

opentelemetry-proto.cmake generates the protobuf headers for opentelemetry-proto and includes them with include_directories. To propagate the headers to targets linking to opentelemetry_proto (through opentelemetry-cpp::otlp_recordable) these headers need to be included on the target.

As is, using FetchContent_MakeAvailable(opentelemetry-cpp) with opentelemetry-cpp-contrib fails here:

exporters/user_events/CMakeFiles/opentelemetry_exporter_user_events_metrics.dir/src/metrics_exporter.cc.o
In file included from /workspaces/opentelemetry-cpp-contrib/exporters/user_events/include/opentelemetry/exporters/user_events/metrics/exporter.h:6,
                 from /workspaces/opentelemetry-cpp-contrib/exporters/user_events/src/metrics_exporter.cc:4:
/workspaces/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_metric_utils.h:14:10: fatal error: opentelemetry/proto/metrics/v1/metrics.pb.h: No such file or directory
   14 | #include "opentelemetry/proto/metrics/v1/metrics.pb.h"

Changes

  • replaces include_directories with target_include_directories for GENERATED_PROTOBUF_PATH

Please provide a brief description of the changes here.

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

Copy link

netlify bot commented May 11, 2025

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit cd31b5b
🔍 Latest deploy log https://app.netlify.com/projects/opentelemetry-cpp-api-docs/deploys/6825525836365e0008bc38c9

Copy link

codecov bot commented May 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.04%. Comparing base (364b860) to head (cd31b5b).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3400      +/-   ##
==========================================
- Coverage   90.05%   90.04%   -0.01%     
==========================================
  Files         212      212              
  Lines        6932     6932              
==========================================
- Hits         6242     6241       -1     
- Misses        690      691       +1     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbarker dbarker marked this pull request as ready for review May 12, 2025 00:24
@dbarker dbarker requested a review from a team as a code owner May 12, 2025 00:24
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix.

@lalitb lalitb enabled auto-merge (squash) May 15, 2025 02:33
@lalitb lalitb merged commit bcdea0e into open-telemetry:main May 15, 2025
67 checks passed
@dbarker dbarker deleted the fix_opentelemetry_proto_target_includes branch May 15, 2025 03:35
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.

3 participants