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

Datasources: Add user_agent header customization for outgoing HTTP requests #63769

Merged
merged 3 commits into from
Feb 28, 2023
Merged

Datasources: Add user_agent header customization for outgoing HTTP requests #63769

merged 3 commits into from
Feb 28, 2023

Conversation

zhichli
Copy link
Contributor

@zhichli zhichli commented Feb 25, 2023

Fix #63767 based on comment in the original discussion #58714

@zhichli zhichli requested review from torkelo, a team and chri2547 as code owners February 25, 2023 00:23
@zhichli zhichli requested review from marefr, andresmgot, asimpson, bossinc, mildwonkey, yangkb09 and ying-jeanne and removed request for a team February 25, 2023 00:23
@grafanabot grafanabot added type/docs Flags the technical writing team for documentation support; auto adds to org-wide docs project area/backend datasource/Azure Azure Monitor Datasource pr/external This PR is from external contributor labels Feb 25, 2023
@@ -484,6 +484,10 @@ Limits the amount of bytes that will be read/accepted from responses of outgoing

Limits the number of rows that Grafana will process from SQL (relational) data sources. Default is `1000000`.

### user_agent

Sets a custom value for `User-Agent` header for outgoing data proxy requests. If empty, default value will be `Grafana/<BuildVersion>` (e.g. `Grafana/9.0.0`).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Sets a custom value for `User-Agent` header for outgoing data proxy requests. If empty, default value will be `Grafana/<BuildVersion>` (e.g. `Grafana/9.0.0`).
Sets a custom value for the `User-Agent` header for outgoing data proxy requests. If empty, the default value is `Grafana/<BuildVersion>` (for example `Grafana/9.0.0`).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! Addressed.

Copy link
Collaborator

@chri2547 chri2547 left a comment

Choose a reason for hiding this comment

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

Added a suggestion for you. Thank you for the contribution!

Copy link
Contributor

@marefr marefr left a comment

Choose a reason for hiding this comment

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

Thanks. Looks great. A test failure needs to be fixed

@@ -243,7 +242,6 @@ func (e *AzureResourceGraphDatasource) createRequest(ctx context.Context, logger
}
req.URL.Path = "/"
req.Header.Set("Content-Type", "application/json")
req.Header.Set("User-Agent", fmt.Sprintf("Grafana/%s", setting.BuildVersion))
Copy link
Contributor

Choose a reason for hiding this comment

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

You seem to have a failed test due to this change

@marefr marefr added this to the 9.5.0 milestone Feb 28, 2023
@marefr marefr added add to changelog no-backport Skip backport of PR labels Feb 28, 2023
@zhichli zhichli changed the title Add user_agent config in dataproxy Configuration: Add user_agent header customization in dataproxy configuration Feb 28, 2023
Copy link
Contributor

@marefr marefr left a comment

Choose a reason for hiding this comment

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

LGTM

@marefr marefr changed the title Configuration: Add user_agent header customization in dataproxy configuration Datasources: Add user_agent header customization for outgoing HTTP requests Feb 28, 2023
@marefr marefr merged commit 3c218d7 into grafana:main Feb 28, 2023
@marefr
Copy link
Contributor

marefr commented Feb 28, 2023

Thank you for contributing to Grafana

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/backend datasource/Azure Azure Monitor Datasource no-backport Skip backport of PR pr/external This PR is from external contributor type/docs Flags the technical writing team for documentation support; auto adds to org-wide docs project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Enable customizable User-Agent header in outgoing data requests
4 participants