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

Benchtool: add -bench.write.proxy-url argument. #223

Merged
merged 1 commit into from
Nov 16, 2021
Merged

Conversation

stevesg
Copy link
Contributor

@stevesg stevesg commented Nov 15, 2021

This allows configuring the Prometheus remote-write client with a HTTP proxy URL.

Getting the client to support the HTTP[S]_PROXY environment variables is not
straightforward, as the creation of the HTTP transport is deep in the upstream
code. Additionally, the client appears to have it's own mechanism for
configuring a HTTP proxy, so it would be safer to use that without meddling.


Tested by running benchtool with a proxy to a useless URL (localhost):

$ ./cmd/benchtool/benchtool \
    -bench.write.enabled=true \
    -bench.query.enabled=false \
    -bench.ring-check.enabled=false \
    -log.level=debug \
    -bench.write.endpoint=example.com \
    -bench.write.proxy-url=http://localhost/
level=info ts=2021-11-15T19:07:11.782043772Z msg="building workload"
level=info ts=2021-11-15T19:07:11.782313845Z msg="starting benchmarker"
level=debug ts=2021-11-15T19:07:11.785365452Z msg="sending timeseries batch" num_series=1000
level=warn ts=2021-11-15T19:07:11.786947337Z msg="unable to send batch" err="remote-write request failed: Post \"http://example.com/api/v1/push\": proxyconnect tcp: dial tcp 127.0.0.1:80: connect: connection refused"

For comparison, this is the output without giving the proxy:

$ ./cmd/benchtool/benchtool \
    -bench.write.enabled=true \
    -bench.query.enabled=false \
    -bench.ring-check.enabled=false \
    -log.level=debug \
    -bench.write.endpoint=example.com
level=info ts=2021-11-15T19:01:38.635670139Z msg="building workload"
level=info ts=2021-11-15T19:01:38.635920193Z msg="starting benchmarker"
run
level=debug ts=2021-11-15T19:01:38.639106715Z msg="sending timeseries batch" num_series=1000
test
level=warn ts=2021-11-15T19:01:39.155580753Z msg="unable to send batch" err="remote-write request failed: server returned HTTP status 404 Not Found: <?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"

This allows configuring the Prometheus remote-write client with a HTTP proxy URL.

Getting the client to support the HTTP[S]_PROXY environment variables is not
straightforward, as the creation of the HTTP transport is deep in the upstream
code. Additionally, the client appears to have it's own mechanism for
configuring a HTTP proxy, so it would be safer to use that without meddling.
@stevesg stevesg marked this pull request as ready for review November 15, 2021 19:23
@stevesg stevesg requested a review from a team as a code owner November 15, 2021 19:23
@stevesg stevesg merged commit c9664fe into main Nov 16, 2021
@stevesg stevesg deleted the benchtool-write-proxy branch November 16, 2021 09:56
simonswine pushed a commit to grafana/mimir that referenced this pull request Jan 12, 2022
…ls#223)

This allows configuring the Prometheus remote-write client with a HTTP proxy URL.

Getting the client to support the HTTP[S]_PROXY environment variables is not
straightforward, as the creation of the HTTP transport is deep in the upstream
code. Additionally, the client appears to have it's own mechanism for
configuring a HTTP proxy, so it would be safer to use that without meddling.
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