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

Move exometer to prometheus #6

Merged
merged 6 commits into from
Dec 3, 2024
Merged

Move exometer to prometheus #6

merged 6 commits into from
Dec 3, 2024

Conversation

NelsonVides
Copy link
Collaborator

@NelsonVides NelsonVides commented Nov 25, 2024

We can move support in amoc-arsenal from exometer to prometheus.

Note that this will potentially change the names of many metrics. Also note that it fixes an issue where env-loaded metrics would not be initialised for applications pulling this repo as a dependency (amoc-arsenal-xmpp) because it was checking the env of amoc-arsenal instead of the parent repo.

See also esl/amoc-arsenal-xmpp#40.

@NelsonVides NelsonVides force-pushed the prometheus branch 3 times, most recently from 7d8c9a5 to 5a0c529 Compare November 27, 2024 08:22
@NelsonVides NelsonVides force-pushed the openapi_server branch 2 times, most recently from 1062fcd to c6f6fe0 Compare November 27, 2024 09:45
Base automatically changed from openapi_server to main November 27, 2024 09:50
@NelsonVides NelsonVides marked this pull request as ready for review November 27, 2024 11:47
@NelsonVides NelsonVides force-pushed the prometheus branch 2 times, most recently from 2fb819b to 86a30e8 Compare December 2, 2024 09:43
@NelsonVides NelsonVides requested a review from chrzaszcz December 2, 2024 09:46
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general. I added some comments.

Dockerfile Show resolved Hide resolved
doc/metrics.md Outdated
* example: `AMOC_GRAPHITE_PORT='2003'`
* `prometheus_ip` - prometheus IP:
* default value - `{127, 0, 0, 1}`
* example: `AMOC_PROMETHEUS_IP='{0, 0, 0, 0}'`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to specify this as an Erlang tuple? It's fine for me, but I guess it might be more difficult to e.g. share the same variable between components, or understand for non-erlangers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The env string is parsed as an erlang term so it would at the very least need to be '"127.0.0.1"' or "\"127.0.0.1\"", with the quotes inside quotes.

init(gauge, Name) ->
prometheus_gauge:new([{name, Name}]);
init(times, Name) ->
prometheus_summary:new([{name, Name}]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I'd suggest using a histogram (with a good set of buckets) instead, because for times like TTD, we really need the quantiles, while prometheus_summary would only give us the number of events and the sum of the values. Btw, prometheus_quantile_summary would not help, because it is completely broken and unusable (this is why are not using it in MIM). See https://github.com/esl/MongooseIM/blob/master/src/instrument/mongoose_instrument_prometheus.erl#L53 for reference.

@NelsonVides NelsonVides requested a review from chrzaszcz December 2, 2024 13:31
doc/metrics.md Outdated
Comment on lines 10 to 11
* default value - `"127.0.0.1"`
* example: `AMOC_PROMETHEUS_IP='"127,0,0,1"'`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines are inconsistent now...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry 🫣

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good in general, but by just reading it the second time, I found new small issues. This makes me think: should we have some minimal unit tests here? Just like the ones for MongooseIM...

src/amoc_metrics.erl Outdated Show resolved Hide resolved
src/amoc_metrics.erl Show resolved Hide resolved
src/amoc_metrics.erl Outdated Show resolved Hide resolved
@NelsonVides NelsonVides force-pushed the prometheus branch 2 times, most recently from 3b53a95 to 016c23b Compare December 2, 2024 20:54
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@chrzaszcz chrzaszcz merged commit f4c785f into main Dec 3, 2024
2 checks passed
@chrzaszcz chrzaszcz deleted the prometheus branch December 3, 2024 07:46
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.

2 participants