-
Notifications
You must be signed in to change notification settings - Fork 0
chore: Integrate prometheus for metrics WPB-21843 #46
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
Changes from all commits
e22b867
652e0e0
f971072
6fe19e7
3999efe
a1b9a54
be33207
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: ServiceMonitor | ||
| metadata: | ||
| name: {{ include "pollapp.fullname" . }} | ||
| labels: | ||
| {{- include "pollapp.labels" . | nindent 4 }} | ||
| spec: | ||
| endpoints: | ||
| - port: http | ||
| path: /metrics | ||
| selector: | ||
| matchLabels: | ||
| {{- include "pollapp.selectorLabels" . | nindent 6 }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.wire.apps.polls.setup.metrics | ||
|
|
||
| import io.micrometer.core.instrument.Counter | ||
| import io.micrometer.core.instrument.MeterRegistry | ||
|
|
||
| class UsageMetrics( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also add a counter for buttons being clicked ? Differentiate between a Delete button and clicking on an option
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @spoonman01 Regarding voting action: I thought about it but then I was not convinced about the benefit of it. Because people will vote they can change the vote and this means another voting action. So the metric will not show sth very clear. --> Maybe later we can find more meaningful reason for that. Wdyt? Regarding delete poll: At the moment we don't have Delete functionality, but actually I can add the metric now, so it can be used when the feature implemented.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📣 Custom metric for "delete poll" is added although we don't have the functionality yet. Maybe this is not a good proactice to add unneeded things but since we are introducing the custom metrics first time in this app, I just wanted to make it ready from now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right it's total votes and not by person, still better than nothing I think.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer not adding a metric for voting for now. Because it will not tell us anything meaningful. We can send metrics with the information of the pool itself (such as poll-id) but then it will be out of the purpose of metrics. Metrics are for general overview not for every instance of polls created. Also just to keep here updated: I reverted the "delete poll" as we agreed as a team. |
||
| registry: MeterRegistry | ||
| ) { | ||
| private val helpCommandCounter: Counter = Counter | ||
| .builder("pollapp_help_commands_total") | ||
| .description("Number of Poll help commands received") | ||
| .register(registry) | ||
|
|
||
| private val createPollCommandCounter: Counter = Counter | ||
| .builder("pollapp_create_poll_commands_total") | ||
| .description("Number of Poll creation commands received") | ||
| .register(registry) | ||
|
|
||
| fun onHelpCommand() { | ||
| helpCommandCounter.increment() | ||
| } | ||
|
|
||
| fun onCreatePollCommand() { | ||
| createPollCommandCounter.increment() | ||
| } | ||
| } | ||
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.
This is good, apart from the business metrics you have defined, does the /metrics now export JVM or server data?
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, this automatically emits JVM and system metrics (https://micrometer.io/docs/ref/jvm) and also http metrics.
Some more info:
Also: https://chatgpt.com/s/t_6926c4491864819181ee50f4b42ec07d
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.
metrics_on_local_test.txt
This is how they look.
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.
Very nice. If it's easy then as a test could you try to setup the full micrometer dashboard, just for this service? Not building it by hand, there should be some pre-made things in Grafana https://grafana.com/grafana/dashboards/4701-jvm-micrometer/