-
Notifications
You must be signed in to change notification settings - Fork 292
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
Expose prometheus metrics for BotKube #219
Conversation
9d8463d
to
2cbf531
Compare
helm/botkube/templates/service.yaml
Outdated
@@ -0,0 +1,26 @@ | |||
{{- if .Values.service }} | |||
{{- range $port := .Values.service.ports }} | |||
{{- $service_type := $port.type | default "ClusterIP" }} |
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.
@Surbhidongaonkar We shouldn't be creating service if serviceMonitor.enabled is not set true
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.
Have modified service.yaml with required changes
2cbf531
to
b62c493
Compare
b62c493
to
6113a33
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.
Can you please remove the botkube
binary from the commit?
Few minor changes, otherwise looks good to me. Thank you for adding the metrics support.
cmd/botkube/main.go
Outdated
@@ -30,6 +30,9 @@ func main() { | |||
go mb.Start() | |||
} | |||
|
|||
//Prometheus metrics |
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.
Small typo here: space after //
6113a33
to
1e8ab1c
Compare
1e8ab1c
to
9b83c42
Compare
pkg/metrics/metrics.go
Outdated
// ServeMetrics exposes metrics in Prometheus format | ||
func ServeMetrics() { | ||
http.Handle("/metrics", promhttp.Handler()) | ||
http.ListenAndServe(":2112", nil) |
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.
@Surbhidongaonkar We should read port from env var. Something like METRICS_PORT
. And pass that env variable through deployment spec (like https://github.com/infracloudio/botkube/blob/develop/helm/botkube/templates/deployment.yaml#L41)
4b5f93d
to
a93ccd0
Compare
a93ccd0
to
5c5acb7
Compare
ISSUE TYPE
SUMMARY
Adding prometheus which exposes different metrics from botkube like no of resources scanned, no of goroutines that currently exist etc.
Fixes ##182
Dependencies: github.com/prometheus/client_golang/prometheus/promhttp