Skip to content
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

Merged
merged 1 commit into from Nov 30, 2019

Conversation

Surbhidongaonkar
Copy link
Contributor

@Surbhidongaonkar Surbhidongaonkar commented Nov 20, 2019

ISSUE TYPE
  • Feature Pull Request
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

@Surbhidongaonkar Surbhidongaonkar force-pushed the surbhi-botkube branch 3 times, most recently from 9d8463d to 2cbf531 Compare Nov 26, 2019
@@ -0,0 +1,26 @@
{{- if .Values.service }}
{{- range $port := .Values.service.ports }}
{{- $service_type := $port.type | default "ClusterIP" }}
Copy link
Collaborator

@PrasadG193 PrasadG193 Nov 26, 2019

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

Copy link
Contributor Author

@Surbhidongaonkar Surbhidongaonkar Nov 27, 2019

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

Copy link
Contributor

@bhavin192 bhavin192 left a comment

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.

helm/botkube/values.yaml Outdated Show resolved Hide resolved
@@ -30,6 +30,9 @@ func main() {
go mb.Start()
}

//Prometheus metrics
Copy link
Contributor

@bhavin192 bhavin192 Nov 28, 2019

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 //

pkg/metrics/metrics.go Outdated Show resolved Hide resolved
@Surbhidongaonkar Surbhidongaonkar requested a review from bhavin192 Nov 29, 2019
@Surbhidongaonkar Surbhidongaonkar changed the title prometheus metrics Expose prometheus metrics for BotKube Nov 29, 2019
// ServeMetrics exposes metrics in Prometheus format
func ServeMetrics() {
http.Handle("/metrics", promhttp.Handler())
http.ListenAndServe(":2112", nil)
Copy link
Collaborator

@PrasadG193 PrasadG193 Nov 29, 2019

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)

@Surbhidongaonkar Surbhidongaonkar force-pushed the surbhi-botkube branch 2 times, most recently from 4b5f93d to a93ccd0 Compare Nov 29, 2019
@PrasadG193 PrasadG193 merged commit d8f10a6 into kubeshop:develop Nov 30, 2019
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants