-
Notifications
You must be signed in to change notification settings - Fork 19
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 an option to expose Prometheus metrics via http/s server #839
Add an option to expose Prometheus metrics via http/s server #839
Conversation
80fea91
to
5e2f8fb
Compare
0fc738e
to
726928e
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.
LGTM.
Could you fix linter?
Hi @denis-tingaikin, Thank you for the feedback! Regarding the linter issue, do you have any recommendations on where to initialize the Prometheus metric types? I'm considering moving the content of my |
I think we can define static sync.Once in the stats/prometheus and do initialization in the NewServer function if promeheus enabled. |
May I ask which specific NewServer function you are referring to @denis-tingaikin? |
Sure, I'd try something like this: in the package stats
+ import "sync"
+ var prometheusInitOnce sync.Once
- func init() {
+ func registerMetrics() {
+ if !prometheus.Enabled() {
+ return
+ }
...
} Then we could initiate it in the stats client/server https://github.com/networkservicemesh/sdk-vpp/blob/main/pkg/networkservice/metrics/stats/server.go#L44, https://github.com/networkservicemesh/sdk-vpp/blob/main/pkg/networkservice/metrics/stats/client.go#L46 via adding one line prometheusInitOnce.Do(registerMetrics) |
19a731f
to
7acdd19
Compare
Signed-off-by: Botond Szirtes <botond.szirtes@est.tech>
7acdd19
to
760a289
Compare
Hi @denis-tingaikin, Thank you for the clarification! I've made the changes as you recommended. |
…k-vpp@main PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main (#713) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main (#695) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main (#97) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main (#358) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main (#531) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main (#261) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nsc-vpp@main PR link: networkservicemesh/cmd-nsc-vpp#713 Commit: 05a2533 Author: Network Service Mesh Bot Date: 2024-08-26 21:04:23 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#713) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main (#247) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…d-lb-vl3-vpp@main PR link: networkservicemesh/cmd-lb-vl3-vpp#97 Commit: 188e92b Author: Network Service Mesh Bot Date: 2024-08-26 21:04:29 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#97) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nse-icmp-responder-vpp@main PR link: networkservicemesh/cmd-nse-icmp-responder-vpp#695 Commit: 75cd411 Author: Network Service Mesh Bot Date: 2024-08-26 21:04:28 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#695) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…k-vpp@main (#503) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nse-vl3-vpp@main PR link: networkservicemesh/cmd-nse-vl3-vpp#358 Commit: d148d84 Author: Network Service Mesh Bot Date: 2024-08-26 21:04:30 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#358) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nse-firewall-vpp@main PR link: networkservicemesh/cmd-nse-firewall-vpp#531 Commit: 0e87f1f Author: Network Service Mesh Bot Date: 2024-08-26 21:04:31 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#531) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nse-simple-vl3-docker@main PR link: networkservicemesh/cmd-nse-simple-vl3-docker#261 Commit: 97c8bdc Author: Network Service Mesh Bot Date: 2024-08-26 21:04:34 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#261) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nsc-simple-docker@main PR link: networkservicemesh/cmd-nsc-simple-docker#247 Commit: 393f898 Author: Network Service Mesh Bot Date: 2024-08-26 21:04:44 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#247) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nse-vlan-vpp@main PR link: networkservicemesh/cmd-nse-vlan-vpp#503 Commit: 36b1daa Author: Network Service Mesh Bot Date: 2024-08-26 21:04:50 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#503) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
…d-lb-vl3-vpp@main (#12256) PR link: networkservicemesh/cmd-lb-vl3-vpp#97 Commit: 188e92b Author: Network Service Mesh Bot Date: 2024-08-26 21:04:29 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#97) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nsc-vpp@main (#12266) PR link: networkservicemesh/cmd-nsc-vpp#713 Commit: 05a2533 Author: Network Service Mesh Bot Date: 2024-08-26 21:04:23 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#713) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nse-firewall-vpp@main (#12185) PR link: networkservicemesh/cmd-nse-firewall-vpp#531 Commit: 0e87f1f Author: Network Service Mesh Bot Date: 2024-08-26 21:04:31 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#531) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nse-simple-vl3-docker@main (#12132) PR link: networkservicemesh/cmd-nse-simple-vl3-docker#261 Commit: 97c8bdc Author: Network Service Mesh Bot Date: 2024-08-26 21:04:34 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#261) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
…d-nsc-simple-docker@main (#12184) PR link: networkservicemesh/cmd-nsc-simple-docker#247 Commit: 393f898 Author: Network Service Mesh Bot Date: 2024-08-26 21:04:44 -0500 Message: - Update go.mod and go.sum to latest version from networkservicemesh/sdk-vpp@main (#247) PR link: networkservicemesh/sdk-vpp#839 Commit: 441b551 Author: Botond Szirtes Date: 2024-08-27 04:01:09 +0200 Message: - Add an option to expose Prometheus metrics via http/s server (#839) Signed-off-by: NSMBot <nsmbot@networkservicmesh.io> Co-authored-by: NSMBot <nsmbot@networkservicmesh.io>
Description
Initialized Prometheus metric types and expanded current metrics to push values into Prometheus too, if enabled.
Issue link
networkservicemesh/sdk#1652
How Has This Been Tested?
Types of changes