You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "willholley (via GitHub)" <gi...@apache.org> on 2023/03/13 19:13:48 UTC
[GitHub] [couchdb] willholley opened a new pull request, #4475: fix: add type and descriptions to prometheus output
willholley opened a new pull request, #4475:
URL: https://github.com/apache/couchdb/pull/4475
## Overview
The `/_node/_local/_prometheus` is missing `# TYPE` annotations for
some metrics. In addition, it contains no `# HELP` annotations, which
are useful particularly where metrics do not strictly match those
returned by the `_stats` or `_system` endpoints.
This PR adds the missing `# TYPE` annotations and adds `# HELP` annotations
to all metrics.
The spec for the prometheus text format is at
https://github.com/prometheus/docs/blob/main/content/docs/instrumenting/exposition_formats.md,
for reference.
## couch_prometheus_util:to_prom/3
`couch_prometheus_util:to_prom/3` is replaced by `couch_prometheus_util:to_prom/4`
which now expects a description alongside the metric name and type.
## couch_prometheus_util:couch_to_prom/3
`couch_prometheus_util:couch_to_prom/3` now extracts the metrics
description from the object returned for each metric by `couch_stats`.
In some cases, where the metrics are transformed e.g. from multiple
metrics to a single metric with a tag, the description is explicitly
changed to be more generic.
## Testing recommendations
Unit tests are updated to expect the `# HELP` annotations alongside the `# TYPE` annotations for each metric.
## Related Issues or Pull Requests
<!-- If your changes affect multiple components in different
repositories please put links to those issues or pull requests here. -->
## Checklist
- [ ] Code is written and works correctly
- [ ] Changes are covered by tests
- [ ] Any new configurable parameters are documented in `rel/overlay/etc/default.ini`
- [ ] Documentation changes were made in the `src/docs` folder
- [ ] Documentation changes were backported (separated PR) to affected branches
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] willholley merged pull request #4475: feat: add type and descriptions to prometheus output
Posted by "willholley (via GitHub)" <gi...@apache.org>.
willholley merged PR #4475:
URL: https://github.com/apache/couchdb/pull/4475
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] iilyak commented on a diff in pull request #4475: feat: add type and descriptions to prometheus output
Posted by "iilyak (via GitHub)" <gi...@apache.org>.
iilyak commented on code in PR #4475:
URL: https://github.com/apache/couchdb/pull/4475#discussion_r1142559552
##########
src/couch_prometheus/src/couch_prometheus_server.erl:
##########
@@ -131,29 +131,70 @@ get_vm_stats() ->
ProcCount = erlang:system_info(process_count),
ProcLimit = erlang:system_info(process_limit),
[
- to_prom(erlang_memory_bytes, gauge, MemLabels),
- to_prom(erlang_gc_collections_total, counter, NumGCs),
- to_prom(erlang_gc_words_reclaimed_total, counter, WordsReclaimed),
- to_prom(erlang_context_switches_total, counter, CtxSwitches),
- to_prom(erlang_reductions_total, counter, Reds),
- to_prom(erlang_processes, gauge, ProcCount),
- to_prom(erlang_process_limit, gauge, ProcLimit)
+ to_prom(
+ erlang_memory_bytes,
+ gauge,
+ "size of memory (in bytes) dynamically allocated by the Erlang emulator",
+ MemLabels
+ ),
+ to_prom(
+ erlang_gc_collections_total,
+ counter,
+ "number of garbage collections by the Erlang emulator",
+ NumGCs
+ ),
+ to_prom(
+ erlang_gc_words_reclaimed_total,
+ counter,
+ "number of words reclaimed by garbage collections",
+ WordsReclaimed
+ ),
+ to_prom(
+ erlang_context_switches_total, counter, "total number of context switches", CtxSwitches
+ ),
+ to_prom(erlang_reductions_total, counter, "total number of reductions", Reds),
+ to_prom(erlang_processes, gauge, "the number of Erlang processes", ProcCount),
+ to_prom(
+ erlang_process_limit,
+ gauge,
+ "the maximum number of simultaneously existing Erlang processes",
+ ProcLimit
+ )
].
get_io_stats() ->
{{input, In}, {output, Out}} = erlang:statistics(io),
[
- to_prom(erlang_io_recv_bytes_total, counter, In),
- to_prom(erlang_io_sent_bytes_total, counter, Out)
+ to_prom(
+ erlang_io_recv_bytes_total,
+ counter,
+ "the total number of bytes received through ports",
+ In
+ ),
+ to_prom(
+ erlang_io_sent_bytes_total, counter, "the total number of bytes output to ports", Out
+ )
].
get_message_queue_stats() ->
QLenFun = fun(Name) -> message_queue_len(whereis(Name)) end,
Queues = lists:map(QLenFun, registered()),
[
- to_prom(erlang_message_queues, gauge, lists:sum(Queues)),
- to_prom(erlang_message_queue_min, gauge, lists:min(Queues)),
- to_prom(erlang_message_queue_max, gauge, lists:max(Queues))
+ to_prom(
+ erlang_message_queues, gauge, "total size of all message queues", lists:sum(Queues)
Review Comment:
Never mind and don't worry about it. There is no consistency in this file anyway.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] iilyak commented on a diff in pull request #4475: feat: add type and descriptions to prometheus output
Posted by "iilyak (via GitHub)" <gi...@apache.org>.
iilyak commented on code in PR #4475:
URL: https://github.com/apache/couchdb/pull/4475#discussion_r1142558095
##########
src/couch_prometheus/src/couch_prometheus_server.erl:
##########
@@ -131,29 +131,70 @@ get_vm_stats() ->
ProcCount = erlang:system_info(process_count),
ProcLimit = erlang:system_info(process_limit),
[
- to_prom(erlang_memory_bytes, gauge, MemLabels),
- to_prom(erlang_gc_collections_total, counter, NumGCs),
- to_prom(erlang_gc_words_reclaimed_total, counter, WordsReclaimed),
- to_prom(erlang_context_switches_total, counter, CtxSwitches),
- to_prom(erlang_reductions_total, counter, Reds),
- to_prom(erlang_processes, gauge, ProcCount),
- to_prom(erlang_process_limit, gauge, ProcLimit)
+ to_prom(
+ erlang_memory_bytes,
+ gauge,
+ "size of memory (in bytes) dynamically allocated by the Erlang emulator",
+ MemLabels
+ ),
+ to_prom(
+ erlang_gc_collections_total,
+ counter,
+ "number of garbage collections by the Erlang emulator",
+ NumGCs
+ ),
+ to_prom(
+ erlang_gc_words_reclaimed_total,
+ counter,
+ "number of words reclaimed by garbage collections",
+ WordsReclaimed
+ ),
+ to_prom(
+ erlang_context_switches_total, counter, "total number of context switches", CtxSwitches
+ ),
+ to_prom(erlang_reductions_total, counter, "total number of reductions", Reds),
+ to_prom(erlang_processes, gauge, "the number of Erlang processes", ProcCount),
+ to_prom(
+ erlang_process_limit,
+ gauge,
+ "the maximum number of simultaneously existing Erlang processes",
+ ProcLimit
+ )
].
get_io_stats() ->
{{input, In}, {output, Out}} = erlang:statistics(io),
[
- to_prom(erlang_io_recv_bytes_total, counter, In),
- to_prom(erlang_io_sent_bytes_total, counter, Out)
+ to_prom(
+ erlang_io_recv_bytes_total,
+ counter,
+ "the total number of bytes received through ports",
+ In
+ ),
+ to_prom(
+ erlang_io_sent_bytes_total, counter, "the total number of bytes output to ports", Out
+ )
].
get_message_queue_stats() ->
QLenFun = fun(Name) -> message_queue_len(whereis(Name)) end,
Queues = lists:map(QLenFun, registered()),
[
- to_prom(erlang_message_queues, gauge, lists:sum(Queues)),
- to_prom(erlang_message_queue_min, gauge, lists:min(Queues)),
- to_prom(erlang_message_queue_max, gauge, lists:max(Queues))
+ to_prom(
+ erlang_message_queues, gauge, "total size of all message queues", lists:sum(Queues)
Review Comment:
This format is inconsistent with the following lines. In all subsequent lines each argument takes its own line.
However I am fine with it as long as linter (`make erlfmt-check`) is fine with it as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] iilyak commented on a diff in pull request #4475: feat: add type and descriptions to prometheus output
Posted by "iilyak (via GitHub)" <gi...@apache.org>.
iilyak commented on code in PR #4475:
URL: https://github.com/apache/couchdb/pull/4475#discussion_r1142162661
##########
src/couch_prometheus/src/couch_prometheus_server.erl:
##########
@@ -131,29 +131,70 @@ get_vm_stats() ->
ProcCount = erlang:system_info(process_count),
ProcLimit = erlang:system_info(process_limit),
[
- to_prom(erlang_memory_bytes, gauge, MemLabels),
- to_prom(erlang_gc_collections_total, counter, NumGCs),
- to_prom(erlang_gc_words_reclaimed_total, counter, WordsReclaimed),
- to_prom(erlang_context_switches_total, counter, CtxSwitches),
- to_prom(erlang_reductions_total, counter, Reds),
- to_prom(erlang_processes, gauge, ProcCount),
- to_prom(erlang_process_limit, gauge, ProcLimit)
+ to_prom(
+ erlang_memory_bytes,
+ gauge,
+ "size of memory dynamically allocated by the Erlang emulator",
Review Comment:
Consider adding units into help message.
```
"size of memory (in bytes) dynamically allocated by the Erlang emulator"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] willholley commented on a diff in pull request #4475: feat: add type and descriptions to prometheus output
Posted by "willholley (via GitHub)" <gi...@apache.org>.
willholley commented on code in PR #4475:
URL: https://github.com/apache/couchdb/pull/4475#discussion_r1142573569
##########
src/couch_prometheus/src/couch_prometheus_server.erl:
##########
@@ -131,29 +131,70 @@ get_vm_stats() ->
ProcCount = erlang:system_info(process_count),
ProcLimit = erlang:system_info(process_limit),
[
- to_prom(erlang_memory_bytes, gauge, MemLabels),
- to_prom(erlang_gc_collections_total, counter, NumGCs),
- to_prom(erlang_gc_words_reclaimed_total, counter, WordsReclaimed),
- to_prom(erlang_context_switches_total, counter, CtxSwitches),
- to_prom(erlang_reductions_total, counter, Reds),
- to_prom(erlang_processes, gauge, ProcCount),
- to_prom(erlang_process_limit, gauge, ProcLimit)
+ to_prom(
+ erlang_memory_bytes,
+ gauge,
+ "size of memory (in bytes) dynamically allocated by the Erlang emulator",
+ MemLabels
+ ),
+ to_prom(
+ erlang_gc_collections_total,
+ counter,
+ "number of garbage collections by the Erlang emulator",
+ NumGCs
+ ),
+ to_prom(
+ erlang_gc_words_reclaimed_total,
+ counter,
+ "number of words reclaimed by garbage collections",
+ WordsReclaimed
+ ),
+ to_prom(
+ erlang_context_switches_total, counter, "total number of context switches", CtxSwitches
+ ),
+ to_prom(erlang_reductions_total, counter, "total number of reductions", Reds),
+ to_prom(erlang_processes, gauge, "the number of Erlang processes", ProcCount),
+ to_prom(
+ erlang_process_limit,
+ gauge,
+ "the maximum number of simultaneously existing Erlang processes",
+ ProcLimit
+ )
].
get_io_stats() ->
{{input, In}, {output, Out}} = erlang:statistics(io),
[
- to_prom(erlang_io_recv_bytes_total, counter, In),
- to_prom(erlang_io_sent_bytes_total, counter, Out)
+ to_prom(
+ erlang_io_recv_bytes_total,
+ counter,
+ "the total number of bytes received through ports",
+ In
+ ),
+ to_prom(
+ erlang_io_sent_bytes_total, counter, "the total number of bytes output to ports", Out
+ )
].
get_message_queue_stats() ->
QLenFun = fun(Name) -> message_queue_len(whereis(Name)) end,
Queues = lists:map(QLenFun, registered()),
[
- to_prom(erlang_message_queues, gauge, lists:sum(Queues)),
- to_prom(erlang_message_queue_min, gauge, lists:min(Queues)),
- to_prom(erlang_message_queue_max, gauge, lists:max(Queues))
+ to_prom(
+ erlang_message_queues, gauge, "total size of all message queues", lists:sum(Queues)
Review Comment:
yeah - the reformatting was a result of running `make erlfmt-format`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] willholley commented on a diff in pull request #4475: feat: add type and descriptions to prometheus output
Posted by "willholley (via GitHub)" <gi...@apache.org>.
willholley commented on code in PR #4475:
URL: https://github.com/apache/couchdb/pull/4475#discussion_r1142534066
##########
src/couch_prometheus/src/couch_prometheus_server.erl:
##########
@@ -131,29 +131,70 @@ get_vm_stats() ->
ProcCount = erlang:system_info(process_count),
ProcLimit = erlang:system_info(process_limit),
[
- to_prom(erlang_memory_bytes, gauge, MemLabels),
- to_prom(erlang_gc_collections_total, counter, NumGCs),
- to_prom(erlang_gc_words_reclaimed_total, counter, WordsReclaimed),
- to_prom(erlang_context_switches_total, counter, CtxSwitches),
- to_prom(erlang_reductions_total, counter, Reds),
- to_prom(erlang_processes, gauge, ProcCount),
- to_prom(erlang_process_limit, gauge, ProcLimit)
+ to_prom(
+ erlang_memory_bytes,
+ gauge,
+ "size of memory dynamically allocated by the Erlang emulator",
Review Comment:
yes good thought @iilyak. I think all the other descriptions added in the PR have units so it's just this line to fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org