-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add prometheus as metric exporter #1509
Add prometheus as metric exporter #1509
Conversation
An init method supporting prometheus for the metric exporter has been added for the opentelemetry pkg. NSMgr or any metric collector could now export the metrics via prometheus. span trace and metrics can now be individually disabled by passing nil value to the optl init function. Signed-off-by: Lionel Jouin <lionel.jouin@est.tech>
e0ef7ab
to
ca604b9
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1509 +/- ##
=======================================
Coverage ? 70.15%
=======================================
Files ? 248
Lines ? 11203
Branches ? 0
=======================================
Hits ? 7860
Misses ? 2842
Partials ? 501 ☔ View full report in Codecov by Sentry. |
pkg/tools/opentelemetry/exporter.go
Outdated
// InitMetricExporter - returns an instance of OpenTelemetry Metric Exporter. | ||
func InitMetricExporter(ctx context.Context, exporterURL string) *sdkmetric.Exporter { | ||
// InitOPTLMetricExporter - returns an instance of OpenTelemetry Metric Exporter. | ||
func InitOPTLMetricExporter(ctx context.Context, exporterURL string) sdkmetric.Reader { |
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 not sure about the change because it breaks compatibility with cmd apps.
Could you explain how is critical to change signature?
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.
The open telemetry SDK returns a metric.Reader for Prometheus for the prometheus exporter.
https://github.com/open-telemetry/opentelemetry-go/blob/v1.16.0/exporters/prometheus/exporter.go#L53
From what I understood with the open telemetry SDK, metric.Reader
is more generic way to be used as way of collecting data than sdkmetric.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.
OK, got it.
Do you need the change in release v1.11.0?
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.
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.
Right now I don't think it is critical to have it in 1.11.0.
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.
@LionelJouin , @szvincze OK, let's target this for release 1.12.0 because this change will require updating all cmd apps due to the changing contract of function InitMetricExporter -> InitOPTLMetricExporter
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.
@LionelJouin , @szvincze OK, let's target this for release 1.12.0 because this change will require updating all cmd apps due to the changing contract of function InitMetricExporter -> InitOPTLMetricExporter
@denis-tingaikin: We had some internal discussions about this topic. It seems this change would save quite significant effort for us if we could get it in 1.11.0. Is it possible to consider it in 1.11.0? Is there other alternative to get it before 1.12.0?
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.
Sure, but we'll need a help with updating cmd-repos.
Also, we supposed to be ready for delaying in release if something went wrong.
@edwarnicke Don't you mind if we consider this PR in this release (v.1.11.0)?
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.
@denis-tingaikin Go for it
pkg/tools/opentelemetry/exporter.go
Outdated
return &exporter | ||
return sdkmetric.NewPeriodicReader( | ||
exporter, | ||
sdkmetric.WithInterval(10*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.
Isn't it better to make it configurable?
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.
do you mean the 10 seconds?
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.
yes
58de845
to
6ea7633
Compare
Update to v1.19.0-rc.1 and v0.42.0 which are fixing bugs related to Prometheus exporter. Remove Jaeger exporter since it is deprecated Signed-off-by: Lionel Jouin <lionel.jouin@est.tech>
6ea7633
to
1eac726
Compare
Signed-off-by: Lionel Jouin <lionel.jouin@est.tech>
@LionelJouin try run |
I think the CI needs an update, I get this error with go 1.20.5 (1.20.8 and 1.21.1 are working fine):
|
@LionelJouin I think we may start with v1.20.8 https://github.com/networkservicemesh/.github/blob/main/.github/workflows/build-and-test.yaml#L22 |
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
@glazychev-art , @NikitaSkrynnik Could you also have a look?
…k@main PR link: networkservicemesh/sdk#1509 Commit: 97bacd7 Author: Lionel Jouin Date: 2023-09-22 12:06:10 +0200 Message: - Add prometheus as metric exporter (#1509) * Add prometheus as metric exporter An init method supporting prometheus for the metric exporter has been added for the opentelemetry pkg. NSMgr or any metric collector could now export the metrics via prometheus. span trace and metrics can now be individually disabled by passing nil value to the optl init function. Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> * Update open telemetry dependencies Update to v1.19.0-rc.1 and v0.42.0 which are fixing bugs related to Prometheus exporter. Remove Jaeger exporter since it is deprecated Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> * Add export interval parameter for the optl exporter Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> --------- Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k@main PR link: networkservicemesh/sdk#1509 Commit: 97bacd7 Author: Lionel Jouin Date: 2023-09-22 12:06:10 +0200 Message: - Add prometheus as metric exporter (#1509) * Add prometheus as metric exporter An init method supporting prometheus for the metric exporter has been added for the opentelemetry pkg. NSMgr or any metric collector could now export the metrics via prometheus. span trace and metrics can now be individually disabled by passing nil value to the optl init function. Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> * Update open telemetry dependencies Update to v1.19.0-rc.1 and v0.42.0 which are fixing bugs related to Prometheus exporter. Remove Jaeger exporter since it is deprecated Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> * Add export interval parameter for the optl exporter Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> --------- Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k@main PR link: networkservicemesh/sdk#1509 Commit: 97bacd7 Author: Lionel Jouin Date: 2023-09-22 12:06:10 +0200 Message: - Add prometheus as metric exporter (#1509) * Add prometheus as metric exporter An init method supporting prometheus for the metric exporter has been added for the opentelemetry pkg. NSMgr or any metric collector could now export the metrics via prometheus. span trace and metrics can now be individually disabled by passing nil value to the optl init function. Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> * Update open telemetry dependencies Update to v1.19.0-rc.1 and v0.42.0 which are fixing bugs related to Prometheus exporter. Remove Jaeger exporter since it is deprecated Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> * Add export interval parameter for the optl exporter Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> --------- Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k@main PR link: networkservicemesh/sdk#1509 Commit: 97bacd7 Author: Lionel Jouin Date: 2023-09-22 12:06:10 +0200 Message: - Add prometheus as metric exporter (#1509) * Add prometheus as metric exporter An init method supporting prometheus for the metric exporter has been added for the opentelemetry pkg. NSMgr or any metric collector could now export the metrics via prometheus. span trace and metrics can now be individually disabled by passing nil value to the optl init function. Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> * Update open telemetry dependencies Update to v1.19.0-rc.1 and v0.42.0 which are fixing bugs related to Prometheus exporter. Remove Jaeger exporter since it is deprecated Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> * Add export interval parameter for the optl exporter Signed-off-by: Lionel Jouin <lionel.jouin@est.tech> --------- Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
Description
An init method supporting prometheus for the metric exporter has been added for the opentelemetry pkg. NSMgr or any metric collector could now export the metrics via prometheus.
span trace and metrics can now be individually disabled by passing nil value to the optl init function.
Issue link
/
How Has This Been Tested?
Types of changes