Skip to content

fix(provider): set User-Agent on clients that were missing it#2593

Open
Duologic wants to merge 1 commit intomainfrom
duologic/useragent
Open

fix(provider): set User-Agent on clients that were missing it#2593
Duologic wants to merge 1 commit intomainfrom
duologic/useragent

Conversation

@Duologic
Copy link
Copy Markdown
Contributor

Summary

  • Set the User-Agent header on the Grafana OpenAPI, SLO, and CloudProvider clients
  • These clients were not propagating the provider's UserAgent config, making API requests appear as generic Go or OpenAPI-Generator clients in server logs

Clients not covered

The following clients need upstream library changes to support setting User-Agent:

  • ML client (machine-learning-go-client): The Config struct has no UserAgent or headers field. Would need either an upstream addition or an HTTP transport wrapper.
  • SM client (synthetic-monitoring-api-go-client): Only supports X-Client-ID/X-Client-Version custom headers via SetCustomClientID/SetCustomClientVersion. No User-Agent support. Same options: upstream change or transport wrapper.

Both could be worked around with an http.RoundTripper wrapper that injects the header, but the cleaner path is adding UserAgent support upstream in those libraries.

Clients already covered

AppPlatform, Cloud (gcom), OnCall, Connections, FleetManagement, FrontendO11y, Asserts, and K6 clients already set UserAgent correctly.

Test plan

  • Verify User-Agent header appears in Grafana server logs for OpenAPI client requests
  • Verify User-Agent header appears for SLO API requests
  • Verify User-Agent header appears for CloudProvider API requests

@Duologic Duologic requested a review from a team as a code owner March 12, 2026 11:25
@github-actions
Copy link
Copy Markdown
Contributor

In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically.
To do so, a Grafana Labs employee must trigger the cloud acceptance tests workflow manually.

@Duologic Duologic force-pushed the duologic/useragent branch from 81b3be5 to 10fe35c Compare March 12, 2026 14:06
The Grafana OpenAPI, SLO, and CloudProvider clients were not setting
the User-Agent header, making it impossible to identify the source of
API requests in server logs.
@Duologic Duologic force-pushed the duologic/useragent branch from 10fe35c to 6bb5f80 Compare April 10, 2026 20:04
@github-actions
Copy link
Copy Markdown
Contributor

In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically.
To do so, a Grafana Labs employee must trigger the cloud acceptance tests workflow manually.

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.

2 participants