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

Add user agent for OTLP http/grpc client #1657

Merged
merged 6 commits into from
Oct 5, 2022

Conversation

owent
Copy link
Member

@owent owent commented Oct 4, 2022

Signed-off-by: owent admin@owent.net

Fixes #1656

Changes

Add user agent for OTLP http/grpc client

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

Signed-off-by: owent <admin@owent.net>
@owent owent requested a review from a team October 4, 2022 16:28
Copy link
Member

@esigo esigo 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 :)

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Thanks for the quick turn around on the fix! Will there be a separate PR to add the user agent to the grpc exporter or does this address both http and grpc OTLP exporters?

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

@lalitb
Copy link
Member

lalitb commented Oct 4, 2022

Thanks for the quick turn around on the fix! Will there be a separate PR to add the user agent to the grpc exporter or does this address both http and grpc OTLP exporters?

This is for http OTLP exporter. Separate PR would be done for gRPC.

Copy link
Member

@lalitb lalitb 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 adding this.

@codecov
Copy link

codecov bot commented Oct 4, 2022

Codecov Report

Merging #1657 (961f204) into main (1dc810d) will increase coverage by 0.02%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1657      +/-   ##
==========================================
+ Coverage   84.39%   84.41%   +0.02%     
==========================================
  Files         170      170              
  Lines        5130     5130              
==========================================
+ Hits         4329     4330       +1     
+ Misses        801      800       -1     
Impacted Files Coverage Δ
sdk/src/trace/batch_span_processor.cc 91.41% <0.00%> (+0.79%) ⬆️

@lalitb
Copy link
Member

lalitb commented Oct 4, 2022

Thanks for the quick turn around on the fix! Will there be a separate PR to add the user agent to the grpc exporter or does this address both http and grpc OTLP exporters?

This is for http OTLP exporter. Separate PR would be done for gRPC.

BTW, I hope gRPC-cpp allows overriding default user-agent using ClientContext::AddMetaData(). If not, it would be difficult to add support, as the other approach using Interceptors at client side is still experimental ( https://grpc.github.io/grpc/cpp/classgrpc_1_1experimental_1_1_interceptor.html).

Signed-off-by: owent <admin@owent.net>
@owent owent changed the title Add user agent for OTLP http client Add user agent for OTLP http/grpc client Oct 4, 2022
@owent
Copy link
Member Author

owent commented Oct 4, 2022

Thanks for the quick turn around on the fix! Will there be a separate PR to add the user agent to the grpc exporter or does this address both http and grpc OTLP exporters?

This is for http OTLP exporter. Separate PR would be done for gRPC.

BTW, I hope gRPC-cpp allows overriding default user-agent using ClientContext::AddMetaData(). If not, it would be difficult to add support, as the other approach using Interceptors at client side is still experimental ( https://grpc.github.io/grpc/cpp/classgrpc_1_1experimental_1_1_interceptor.html).

gRPC user agent is added now. We could use grpc::ChannelArguments::SetUserAgentPrefix to prepend otel user agent before the default value(which is "grpc-c++/GRPC VERSION").

@owent
Copy link
Member Author

owent commented Oct 4, 2022

Thanks for the quick turn around on the fix! Will there be a separate PR to add the user agent to the grpc exporter or does this address both http and grpc OTLP exporters?

Should we use OTel-OTLP-Exporter-Cpp/1.2.3 instead of OTel OTLP Exporter Cpp/1.2.3 ?
According to https://datatracker.ietf.org/doc/html/rfc7231#section-5.5.3 user agent use token, which is defined at https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6 and do not contains spaces.

@lalitb
Copy link
Member

lalitb commented Oct 4, 2022

Should we use OTel-OTLP-Exporter-Cpp/1.2.3 instead of OTel OTLP Exporter Cpp/1.2.3 ?

Good point. I think we should rename, as produce-token can't contain spaces.

@lalitb
Copy link
Member

lalitb commented Oct 5, 2022

Should we use OTel-OTLP-Exporter-Cpp/1.2.3 instead of OTel OTLP Exporter Cpp/1.2.3 ?

Good point. I think we should rename, as produce-token can't contain spaces.

@codeboten - What do you think of the format without spaces, to be in-compliant with the rfc?

@lalitb
Copy link
Member

lalitb commented Oct 5, 2022

As discussed in the SIG meeting, we will stick to the user-agent format as given in the specs , and change it later if required. Merging the PR based on this.

@lalitb lalitb merged commit 787d9c1 into open-telemetry:main Oct 5, 2022
@owent owent deleted the add_user_agent_for_http_client branch October 21, 2022 06:46
yxue pushed a commit to yxue/opentelemetry-cpp that referenced this pull request Dec 5, 2022
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 exporters should emit standard user agent string
6 participants