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

Skip to content

[BUILD] Remove gRPC header including in OtlpGrpcClientFactory. #3321

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

Conversation

owent
Copy link
Member

@owent owent commented Mar 25, 2025

Fixes #3320

Changes

  • Remove the gRPC header dependency of OtlpGrpcClientFactory

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

@owent owent requested a review from a team as a code owner March 25, 2025 04:07
Copy link

netlify bot commented Mar 25, 2025

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

Name Link
🔨 Latest commit 6b3b613
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/67e290d83e1599000884c2d1

Copy link

codecov bot commented Mar 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.52%. Comparing base (63220ad) to head (6b3b613).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3321      +/-   ##
==========================================
+ Coverage   89.51%   89.52%   +0.02%     
==========================================
  Files         210      210              
  Lines        6526     6526              
==========================================
+ Hits         5841     5842       +1     
+ Misses        685      684       -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
Copy link
Contributor

dbarker commented Mar 25, 2025

Looks good to me. Can the methods of the grpc client be protected?

@owent
Copy link
Member Author

owent commented Mar 25, 2025

Looks good to me. Can the methods of the grpc client be protected?

To prevent the inclusion of gRPC headers in the future, I added macro checks to the factory unit test code. Since gRPC client methods must be used in OTLP gRPC exporters, making them protected would require numerous friend classes for exporters and unit tests, which would hinder maintainability.

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.

The factory returns std::shared_ptr<OtlpGrpcClient>, so I think the user code will still need to see the destructor of OtlpGrpcClient at some point.

The header file for OtlpGrpcClient might need additional cleanup.

In any case, this change in the client factory is needed, so approving this PR.

@marcalff marcalff changed the title Remove gRPC header including in OtlpGrpcClientFactory. [BUILD] Remove gRPC header including in OtlpGrpcClientFactory. Mar 25, 2025
@marcalff marcalff merged commit a7f5297 into open-telemetry:main Mar 25, 2025
58 checks passed
@dbarker
Copy link
Contributor

dbarker commented Mar 25, 2025

A note in otlp_grpc_client.h and related markdown documents will also help users avoid going down the path of including the file in their projects and trying to link grpc directly.

@owent owent deleted the grpc_client_factory_should_not_include_grpcs_headers branch April 27, 2025 09:47
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.

[OTLP] OtlpGrpcClientFactory should not depends gRPC's header.
4 participants