-
Notifications
You must be signed in to change notification settings - Fork 4
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
Align configuration with OpenTelemetry SDK, HTTP exporter #5
Conversation
c71e28e
to
d4fff88
Compare
Looks good to me! 👍 |
Co-authored-by: Joan López de la Franca Beltran <[email protected]>
abd91b2
to
612399f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a few minor comments but overall looks great! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I left two comments which can be addressed later as well - but might be good idea to happen before we put this in core.
func NewConfig(p output.Params) (Config, error) { | ||
cfg := Config{ | ||
MetricPrefix: "", | ||
ReceiverType: grpcReceiverType, | ||
GRPCReceiverEndpoint: "localhost:4317", | ||
PushInterval: 1 * time.Second, | ||
FlushInterval: 1 * time.Second, | ||
ServiceName: "k6", | ||
ServiceVersion: k6Const.Version, | ||
MetricPrefix: "", | ||
ExporterType: grpcExporterType, | ||
|
||
HTTPExporterInsecure: null.BoolFrom(false), | ||
HTTPExporterEndpoint: "localhost:4318", | ||
HTTPExporterURLPath: "/v1/metrics", | ||
|
||
GRPCExporterInsecure: null.BoolFrom(false), | ||
GRPCExporterEndpoint: "localhost:4317", | ||
|
||
ExportInterval: 1 * time.Second, | ||
FlushInterval: 1 * time.Second, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: In general it is better idea to always use null
types for everything as that lets you know if you should use a default value or if somebody just managed to match it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented as part of: #11
for k, v := range p.Environment { | ||
switch k { | ||
case "K6_OTEL_PUSH_INTERVAL": | ||
cfg.PushInterval, err = time.ParseDuration(v) | ||
if err != nil { | ||
return cfg, fmt.Errorf("error parsing environment variable 'K6_OTEL_PUSH_INTERVAL': %w", err) | ||
} | ||
case "K6_OTEL_SERVICE_NAME": | ||
cfg.ServiceName = v | ||
case "K6_OTEL_SERVICE_VERSION": | ||
cfg.ServiceVersion = v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not certain if jut using envconfig.Process as all the other outputs will not be better especially before we move the whole configuration over to not using envconfig.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, implemented as part of: #11
@mstoykov, both comments are relevant. I'll try to implement the following configuration-related PRs. This is mostly about aligning with OpenTelemetry terms, so will merge this as it is for now 👍 |
What?
This PR aligns configuration (k6 environment variables) with the OpenTelemetry SDK and introduces more configuration options, along with the HTTP metric exporter.
Why?
It's essential to be aligned so as not to confuse the users, as proven in the comment.