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/31 15:40:03 UTC
[GitHub] [couchdb] willholley opened a new pull request, #4507: feat: additional prometheus metrics
willholley opened a new pull request, #4507:
URL: https://github.com/apache/couchdb/pull/4507
<!-- Thank you for your contribution!
Please file this form by replacing the Markdown comments
with your text. If a section needs no action - remove it.
Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
of code collaboration. Positive feedback is represented +1 from committers
and negative is a -1. The -1 also means veto, and needs to be addressed
to proceed. Once there are no objections, the PR can be merged by a
CouchDB committer.
See: http://couchdb.apache.org/bylaws.html#decisions for more info. -->
## Overview
This adds a number of additional _prometheus metrics to get closer to parity with the `_system` endpoint that is commonly scraped by monitoring tools.
Namely:
- `couchdb_erlang_message_queue_size{queue_name=<message queue name>}`
- `couchdb_internal_replication_jobs`
- `couchdb_membership{nodes=all_nodes|cluster_nodes}`
The following metric types are changed to `gauge` in the `_prometheus` endpoint to match prometheus semantics that assume counters are cumulative only:
- `couchdb_open_databases`
- `couchdb_couchdb_open_os_files`
- `couchdb_httpd_clients_requesting_changes`
## Testing recommendations
`make eunit apps=couch_prometheus`
## 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 commented on a diff in pull request #4507: feat: additional prometheus metrics
Posted by "willholley (via GitHub)" <gi...@apache.org>.
willholley commented on code in PR #4507:
URL: https://github.com/apache/couchdb/pull/4507#discussion_r1155763877
##########
src/couch_prometheus/src/couch_prometheus_server.erl:
##########
@@ -177,24 +200,27 @@ get_io_stats() ->
].
get_message_queue_stats() ->
- QLenFun = fun(Name) -> message_queue_len(whereis(Name)) end,
- Queues = lists:map(QLenFun, registered()),
+ QFun = fun(Name) -> {Name, message_queue_len(whereis(Name))} end,
+ Queues = lists:map(QFun, registered()),
+ QueueLens = lists:map(fun({_, Len}) -> Len end, Queues),
+ QueueLenByLabel = lists:map(fun({Name, Len}) -> {[{queue_name, Name}], Len} end, Queues),
Review Comment:
I think it's just wasted cycles to sort, yes
--
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] nickva commented on a diff in pull request #4507: feat: additional prometheus metrics
Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on code in PR #4507:
URL: https://github.com/apache/couchdb/pull/4507#discussion_r1154677573
##########
src/couch_prometheus/src/couch_prometheus_server.erl:
##########
@@ -177,24 +200,27 @@ get_io_stats() ->
].
get_message_queue_stats() ->
- QLenFun = fun(Name) -> message_queue_len(whereis(Name)) end,
- Queues = lists:map(QLenFun, registered()),
+ QFun = fun(Name) -> {Name, message_queue_len(whereis(Name))} end,
+ Queues = lists:map(QFun, registered()),
+ QueueLens = lists:map(fun({_, Len}) -> Len end, Queues),
+ QueueLenByLabel = lists:map(fun({Name, Len}) -> {[{queue_name, Name}], Len} end, Queues),
Review Comment:
```
# HELP couchdb_erlang_message_queue_size size of message queue
# TYPE couchdb_erlang_message_queue_size gauge
couchdb_erlang_message_queue_size{queue_name="httpd_sup"} 0
couchdb_erlang_message_queue_size{queue_name="rex"} 0
couchdb_erlang_message_queue_size{queue_name="index_server_1"} 0
couchdb_erlang_message_queue_size{queue_name="folsom_metrics_histogram_ets"} 0
...
```
Would it make sense to sort them, or would that be a waste of cpus resources as nobody will normally look at stats that way anyway?
##########
.devcontainer/devcontainer.json:
##########
@@ -26,4 +26,4 @@
"postCreateCommand": "./configure && make",
"extensions": ["erlang-ls.erlang-ls"]
-}
+}
Review Comment:
whitespace-only change
--
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 #4507: feat: additional prometheus metrics
Posted by "willholley (via GitHub)" <gi...@apache.org>.
willholley merged PR #4507:
URL: https://github.com/apache/couchdb/pull/4507
--
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] nickva commented on a diff in pull request #4507: feat: additional prometheus metrics
Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on code in PR #4507:
URL: https://github.com/apache/couchdb/pull/4507#discussion_r1154664018
##########
src/couch_prometheus/src/couch_prometheus_server.erl:
##########
@@ -177,24 +200,27 @@ get_io_stats() ->
].
get_message_queue_stats() ->
- QLenFun = fun(Name) -> message_queue_len(whereis(Name)) end,
- Queues = lists:map(QLenFun, registered()),
+ QFun = fun(Name) -> {Name, message_queue_len(whereis(Name))} end,
+ Queues = lists:map(QFun, registered()),
+ QueueLens = lists:map(fun({_, Len}) -> Len end, Queues),
+ QueueLenByLabel = lists:map(fun({Name, Len}) -> {[{queue_name, Name}], Len} end, Queues),
[
to_prom(
- erlang_message_queues, gauge, "total size of all message queues", lists:sum(Queues)
+ erlang_message_queues, gauge, "total size of all message queues", lists:sum(QueueLens)
),
to_prom(
erlang_message_queue_min,
gauge,
"minimum size across all message queues",
- lists:min(Queues)
+ lists:min(QueueLens)
Review Comment:
Wondering if min queue length is useful at all. Amongst all the registered processes it's probably going to always be 0?
--
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] nickva commented on a diff in pull request #4507: feat: additional prometheus metrics
Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on code in PR #4507:
URL: https://github.com/apache/couchdb/pull/4507#discussion_r1154664894
##########
.devcontainer/devcontainer.json:
##########
@@ -26,4 +26,4 @@
"postCreateCommand": "./configure && make",
"extensions": ["erlang-ls.erlang-ls"]
-}
+}
Review Comment:
whitespace-only change
--
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] big-r81 commented on a diff in pull request #4507: feat: additional prometheus metrics
Posted by "big-r81 (via GitHub)" <gi...@apache.org>.
big-r81 commented on code in PR #4507:
URL: https://github.com/apache/couchdb/pull/4507#discussion_r1154669174
##########
.devcontainer/devcontainer.json:
##########
@@ -26,4 +26,4 @@
"postCreateCommand": "./configure && make",
"extensions": ["erlang-ls.erlang-ls"]
-}
+}
Review Comment:
Small nit: No \n at eof.
--
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 #4507: feat: additional prometheus metrics
Posted by "willholley (via GitHub)" <gi...@apache.org>.
willholley commented on code in PR #4507:
URL: https://github.com/apache/couchdb/pull/4507#discussion_r1155765983
##########
src/couch_prometheus/src/couch_prometheus_server.erl:
##########
@@ -177,24 +200,27 @@ get_io_stats() ->
].
get_message_queue_stats() ->
- QLenFun = fun(Name) -> message_queue_len(whereis(Name)) end,
- Queues = lists:map(QLenFun, registered()),
+ QFun = fun(Name) -> {Name, message_queue_len(whereis(Name))} end,
+ Queues = lists:map(QFun, registered()),
+ QueueLens = lists:map(fun({_, Len}) -> Len end, Queues),
+ QueueLenByLabel = lists:map(fun({Name, Len}) -> {[{queue_name, Name}], Len} end, Queues),
[
to_prom(
- erlang_message_queues, gauge, "total size of all message queues", lists:sum(Queues)
+ erlang_message_queues, gauge, "total size of all message queues", lists:sum(QueueLens)
),
to_prom(
erlang_message_queue_min,
gauge,
"minimum size across all message queues",
- lists:min(Queues)
+ lists:min(QueueLens)
Review Comment:
I think it's a valid question, though `erlang_message_queue_min` already existed before this PR so it's technically a breaking change to remove it - perhaps something to schedule for removal in 4.x?
--
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