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

Polish config #48

Merged
merged 3 commits into from Nov 7, 2022
Merged

Polish config #48

merged 3 commits into from Nov 7, 2022

Conversation

codebien
Copy link
Contributor

@codebien codebien commented Oct 21, 2022

This PR includes changes for the config and the URL printing in the description.

Renamed for consistency the following env var options:

K6_PROMETHEUS_FLUSH_PERIOD => K6_PROMETHEUS_PUSH_INTERVAL (it aligns to the same name used by timescaledb, influxdb and statsd outputs).

K6_PROMETHEUS_USER => K6_PROMETHEUS_USERNAME (it aligns to the same name used by influxdb output).

Removed completely for aligning to what we are doing with other outputs the following options:

KeepTags, KeepNameTag, KeepUrlTag, as explained in #47, tags should be controlled by systemTags option or by the solution explained in #5 (TLDR; grafana/k6#1321) when we will have implemented it.

Removed Mapping option because at the moment the output does not support different kinds of mappings so it does not make sense to export an option.

The documentation must be aligned when we will have merged this PR.

@codebien codebien self-assigned this Oct 21, 2022
Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

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

Generaly looks good, I left a few comments 👍

pkg/remotewrite/config.go Show resolved Hide resolved
pkg/remotewrite/config.go Outdated Show resolved Hide resolved
pkg/remotewrite/remotewrite_test.go Show resolved Hide resolved
@codebien codebien requested a review from na-- October 25, 2022 08:31
README.md Outdated
K6_PROMETHEUS_REMOTE_URL=https://localhost:9090/api/v1/write K6_PROMETHEUS_INSECURE_SKIP_TLS_VERIFY=false K6_CA_CERT_FILE=example/tls.crt K6_PROMETHEUS_USER=foo K6_PROMETHEUS_PASSWORD=bar ./k6 run script.js -o output-prometheus-remote
K6_PROMETHEUS_REMOTE_URL=https://localhost:9090/api/v1/write \
K6_PROMETHEUS_INSECURE_SKIP_TLS_VERIFY=false \
K6_PROMETHEUS_CA_CERT_FILE=example/tls.crt \
Copy link
Contributor Author

@codebien codebien Oct 25, 2022

Choose a reason for hiding this comment

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

I forgot to ask before. Do we need this? The user could use the Go env vars SSL_CERT_FILE and SSL_CERT_DIR for passing the location or the dir of the root store.

Note: the comment is related to K6_PROMETHEUS_CA_CERT_FILE

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a good question 🤔

Honestly, I think that we can stick with the default golang's environment variable if that works precisely the same way, but I guess it's still important to mention that because maybe not all of our users are golang devs. But I'm not so strict in that opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yorugac WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Apologies for the delay! This message totally got lost in my Github subscriptions.
This env var appeared in order to connect to Prometheus set up with auth: if there is another way to connect to such an instance without using env var, it should be checked.

Btw, Mimir has something similar in its setup to Prometheus: https://grafana.com/docs/mimir/latest/operators-guide/secure/securing-communications-with-tls/#configure-tls-certificates-in-grafana-mimir

Additionally, IIRC, I had a reasoning that one might want to keep specific certificates separately, and external env vars like SSL_CERT_FILE are not explicit enough and / or may not be available. This reasoning is debatable and a matter of product design, of course.

Hope that helps!

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, @yorugac. If I'm understanding well we don't have a specific requirement for it; then it sounds reasonable to me to keep the k6 and the output config consistent and with as less as possible options for reducing the risk of breaking change in the future. I would be happy to bring back this if we will receive an explicit request for improving the UX on this front.

if there is another way to connect to such an instance without using env var, it should be checked.

There is and it's even better than env var because it is just implicit and it is the system trusted certs store. We are doing the same with the k6 core. grafana/k6#218 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, sounds good to me 👍

pkg/remotewrite/config.go Outdated Show resolved Hide resolved
Removed useless Options where k6 native alternatives are available.
Renamed some options to have them consistent with other k6 outputs.
It helps to see what is the configured remote url and catch eventual
error in the set config.
@codebien codebien merged commit 3743b65 into main Nov 7, 2022
@codebien codebien deleted the simplify-config branch November 7, 2022 15:51
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.

None yet

4 participants