-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[exporter/tanzuobservability] Make metrics stanza optional in config. #9098
Conversation
f5ed447
to
f23c8c3
Compare
It appears that unit tests in the exporter/prometheusremotewriteexporter are failing, which is a different exporter than what this PR is for. What can be done to resolve? |
Failed tests restarted. |
Even though the tests were restarted it looks like: |
Hi. Thank you for restarting the tests. It looks like the build for this PR is now green. Are there any upcoming comments for this PR? As a gentle reminder we want to get this in a release as soon as possible because it fixes a major backward compatibility bug. Thank you. |
Hello. This code has been approved my my colleagues and the build is green. Is anything else needed for this code to be reviewed? This PR contains a fix for a backward compatibility bug in the configuration for this exporter. We would like it to be merged and released sooner than later. Thank you for your time. Hope to hear from you soon. |
@codeboten Hello. This PR, #9098, still needs to be reviewed by an owner. I notice that your name is on this PR to review it. Is there anything you need from us to facilitate review of this code? As a gentle reminder, this PR fixes a major bug related to backward compatibility issues in the config file; therefore, we would like this to be merged to the main branch as soon as possible. Thank you for your attention. |
} | ||
tracesURL = &url.URL{} | ||
*tracesURL = *metricsURL | ||
tracesURL.Host = hostWithPort(metricsURL.Host, 30001) |
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'm a little confused. If the user does not configure traces, this is adding traces configuration and using the supplied metrics endpoint right? I think the part I'm missing is why the traces settings need filled out in order for the exporter to work if it is only defined in a metrics pipeline? Or is the issue that users are adding the exporter to the trace pipeline but not supplying trace configuration?
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.
Good point. I think the intention (please correct me @keep94) was to be able to separately specify metrics configuration and traces configuration and when only one is available, assume it's like the other but on a different (default) port.
Perhaps that's something tied to tanzuobservability but if not, I would suggest to consider approach similar to used in OTLP/HTTP. Either a single endpoint can be configured (in this case, this would be the hostname) or specifically traces_endpoint/metrics_endpoint/logs_endpoint
.
Also, if endpoint for the signal was not defined and it's used in the pipeline it should just trigger an error
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.
@pmm-sumo you are correct. If only the traces configuration is present, we assume the metrics configuration is like it but on a different port. Initially I wanted to throw an error if our tanzuobservability exporter is used in the metrics pipeline but no metrics configuration is defined, but I wasn't able to figure out how to do this in the code. I mean how can I tell if my exporter is used in a metrics pipeline from within the code?
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 haven't verified this yet, but perhaps the createMetricsExporter
function only gets called when our exporter is used in a metrics pipeline. Perhaps all I have to do is throw an error in createMetricsExporter
if there is no metrics configuration. But, I just remembered that for tanzuobservability we have a unique requirement. Our traces exporter uses both the metrics and traces endpoint. Before we added the metrics exporter, we hardcoded the metrics endpoint to be the same as the traces endpoint except use port 2878. Now that we have both the metrics and traces exporter, we want the traces exporter to use the same metrics endpoint as the metrics exporter
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.
Initially I wanted to throw an error if our tanzuobservability exporter is used in the metrics pipeline but no metrics configuration is defined, but I wasn't able to figure out how to do this in the code.
Unfortunately, Validate()
can be only used in context of Config, without awareness of which pipeline it is. You might still throw an error when e.g. createTraces
is called and not all config is available.
Another option is that you might prefer hostname and port numbers. The port numbers would have default values, so they would always point somewhere. This has the limitation of not supporting url's with paths.
Looking at the ideas, I would circle back to how otlphttp exporter does it. Perhaps you could have three fields:
hostname
- if set, default port numbers are used and you can support both metrics and tracesmetrics_endpoint
- by default: "https://<hostname>:2878" but could be overwritten here if neededtraces_endpoint
- be default: "https://<hostname>:30001" but could be overwritten here if needed
So a valid configuration would be:
hostname: myserver.example.com
or:
hostname: myserver.example.com
metrics_endpoint: https://myotherserver.example.com:2878
or:
traces_endpoint: https://myserver1.example.com:30001
metrics_endpoint: https://myotherserver.example.com:2878
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 think this idea a lot. I think it will simplify a lot of config.go, since you can be sure there is always an endpoint to use.
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.
Hi @pmm-sumo and @TylerHelmuth: I'm a maintainer of this exporter (in addition to @keep94), and I had question. I'll let Travis consider your suggestions and reply on his own.
Your config changes are backwards-incompatible with our existing yaml. Is there an otel-collector procedure or policy for introducing breaking changes like this? Whether or not we go down that path in this PR, it'd be good to know how to go about breaking changes in the future. I'm pretty sure I've seen other exporters change or deprecate config options, so I do think it's possible. Thanks!
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.
Hi @oppegard, I think this config change could be done in a non-breaking way. E.g. the new configuration fields could be added. When user uses the old one (essentially "endpoint"), a deprecation warning shows up in the logs.
After some time, the old configuration fields can be removed then.
Ultimately, I think it's your call since this is your exporter :)
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.
Example of deprecated config:
Metrics []string `mapstructure:"metrics"` |
opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor/processor.go
Line 111 in b9915f7
// Legacy support for deprecated Metrics config |
Agree with @pmm-sumo, its your exporter so you can handle this however you want.
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.
Thanks @pmm-sumo and @TylerHelmuth!
374fac7
to
860e98f
Compare
Just did a quick review of this and so far I find this iteration easier to interpret. If I am reading things correctly, both a trace endpoint and metrics endpoint can be supplied, but they must have the same hostname. Trace endpoint must be supplied, but metrics endpoint is optional. If metrics endpoint is not supplied, a default port is used with the trace endpoint. If a metrics endpoint is supplied then the port on the supplied endpoint is used as the metrics port. My only question right now is did you mean to remove your updates to the README.md? That was a beautiful README file with some great detail. |
Hello. Based on what was discussed, I now have brand new code. I will reach out again once my team has had a chance to approve the PR. |
@TylerHelmuth Thanks for pointing out the missing README.md, I will work on getting those changes back in this PR. As for your comment, both the traces and metrics endpoints are optional, neither have to be supplied, but if there is a traces pipeline, the traces endpoint must be supplied. If there is a metrics pipeline, the metrics endpoint must be supplied. |
Hello everyone. My tech lead approved these changes yesterday. You may resume reviewing this PR. Thank you. |
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 think it looks OK, need a rebasing though (we have released v0.50.0 in the meantime and this impacts changelog)
I either missed the |
Hello. I just rebased this PR to resolve the conflicts in CHANGELOG.md |
It looks like CHANGELOG.md became out of data even since this morning when I rebased. Is there a way we can coordinate a time for when I should rebase and then somebody can merge immediately after I rebase? |
Just rebased to resolve conflicts with CHANGELOG.md |
Just now rebased to resolve conflicts in CHANGELOG.md. Please consider merging before CHANGELOG.md changes again. There are failing load tests, but I believe these failures are transient because the only changes made to this PR since it was approved was resolving conflicts in CHANGELOG.md |
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.
@pmm-sumo please approve if your comments have been addressed 👍
Sure, will take a look later today |
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.
Some nits that are not blocking from my end
I think that such conflicts are actually trivial to resolve and I think usually this is done by one of the maintainers when merging the PR. So no need to worry about these :) |
…open-telemetry#9098) * [exporter/tanzuobservability] Make metrics stanza optional in config. * Minor changes from pmm-sumo. * Add distribution port for delta histograms. Co-authored-by: Alex Boten <[email protected]>
Description:
Fixed bug. The collector failed to start if the tanzuobservability exporter was configured with traces only and not metrics and the traces endpoint had anything other than localhost. This is a bug because traces came first, and metrics came later. If a user has only traces configured for tanzuobservability exporter, they should be able to start the collector even if they have upgraded to a version that supports metrics too.
To fix, I made the Metrics field in our config struct be a pointer field instead of a struct field, so that it will be nil if it is missing. If metrics aren't configured in the config file, we don't send any metrics.
Link to tracking Issue: Not available to public.
Testing:.
Documentation: Changes to README.md