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

[exporterhelper] User-Agent header in the Otlp http exporter #8560

Open
antonjim-te opened this issue Oct 2, 2023 · 3 comments
Open

[exporterhelper] User-Agent header in the Otlp http exporter #8560

antonjim-te opened this issue Oct 2, 2023 · 3 comments
Assignees

Comments

@antonjim-te
Copy link
Contributor

Important

Provide the user the capability to set User-Agent header in the OTLP HTTP exporter. It will help identify which exporter sends the signal.

Is your feature request related to a problem? Please describe.
As you can it has see in the following issue open-telemetry/opentelemetry-collector-contrib#27207 . This new feature will identify the problem's source when receiving signals from different collectors.

Describe the solution you'd like
It will be configurable as part of the HTTPClientSettings and the default will be otel-collector-vX.Y.X.
Set the header before sending the signal in the POST operation.

Additional context
https://www.geeksforgeeks.org/http-headers-user-agent/

@antonjim-te antonjim-te changed the title User-Agent header in the Otlp http exporter [exporterhelper] User-Agent header in the Otlp http exporter Oct 2, 2023
@bryan-aguilar
Copy link
Contributor

I believe there is already established methods for the user agent getting set within an exporter. For example the Prometheus remote write exporter parses build info and description to build it. The PRWE also uses confighttp.HTTPClientSettings which is this new field is suggested.

I believe it could make sense to give the user some agency in determining the values of the user agent header. I would like to challenge the idea of otel-collector-vX.Y.X being a default though. I think that information should already be available in the build info. Instead, I think it should be set to a zero value, exporters can then choose to adopt this new config field and handle it in the manner they see best fit. For example, some exporters may choose to adopt this by appending the user configured string to the the existing user agent string they build.

@jpkrohling
Copy link
Member

@bryan-aguilar, I'm not 100% sure I understood your message. Would you be OK in having the default user agent to be the same as the user agent that the Prometheus Remote Write Exporter uses? It's certainly a good default to me:

	userAgentHeader := fmt.Sprintf("%s/%s", strings.ReplaceAll(strings.ToLower(set.BuildInfo.Description), " ", "-"), set.BuildInfo.Version)

It would yield something like: OpenTelemetry Collector-0.86.0, which is fine to me. Or are you against the idea of having the version there at all?

Letting users customize this would be great, but my concern right now is in providing ways for service owners (ie, those who receive requests from Collectors) to identify the clients sending data to them.

@jpkrohling
Copy link
Member

@antonjim-te, if you are still interested in this, I'd implement it like we have it for the Prometheus Remote Write exporter. We can iterate in the future and allow users to customize.

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

No branches or pull requests

3 participants