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

Fix CouchDB 2+ message_queues metric collection #19521

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

janl
Copy link
Contributor

@janl janl commented Jan 30, 2025

At the moment, the count value in the metric block is recorded as a gauge. That value is the number of instances of each type of message queue. Say you have two database files open, then message_queues.couch_file.count will be 2. That information is already available in the _stats endpoint as open_os_files.

The actually valuable part of the message_queue metric is the max entry, it shows that the longest backlog of messages for each instance type. A longer backlog means a reduction in performance. Without this patch, this value is not available.

Technically all of the max, min, 50, 90, 99 are valuable, but I wanted to keep this patch as small as possible until it is clear the change will be accepted.

I’m happy to add the other fields as well if desired.

What does this PR do?

Motivation

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

At the moment, the `count` value in the metric block is recorded
as a gauge. That value is the number of instances of each type
of message queue. Say you have two database files open, then
`message_queues.couch_file.count` will be `2`. That information
is already available in the `_stats` endpoint as `open_os_files`.

The actually valuable part of the message_queue metric is the
`max` entry, it shows that the longest backlog of messages for
each instance type. A longer backlog means a reduction in
performance. Without this patch, this value is not available.

Technically all of the `max`, `min`, `50`, `90`, `99` are
valuable, but I wanted to keep this patch as small as possible
until it is clear the change will be accepted.

I’m happy to add the other fields as well if desired.
@janl
Copy link
Contributor Author

janl commented Jan 30, 2025

Package "couch" has changes that require a changelog. Please run ddev release changelog new to add it.

I could find no mention of ddev in README.md or CONTRIBUTING.md, how do I set that up?

@janl
Copy link
Contributor Author

janl commented Jan 30, 2025

The second commit includes the other useful metrics, but do feel free to skip that if the change seems too big

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Project coverage is 88.14%. Comparing base (c9eaec7) to head (3cda929).
Report is 36 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
cassandra ?
couch 94.41% <45.45%> (?)
hive ?
hivemq ?
hudi ?
ignite ?
jboss_wildfly ?
kafka ?
presto ?
solr ?

Flags with carried forward coverage won't be shown. Click here to find out more.

@steveny91
Copy link
Contributor

@janl Thanks for the contribution, can I trouble you to take a look at the failing tests and update them? If not I can take a stab at it later this week.

@steveny91 steveny91 self-assigned this Feb 4, 2025
@janl
Copy link
Contributor Author

janl commented Feb 5, 2025

@steveny91 I would, but I need clarification.

@janl janl force-pushed the fix-couchdb-message-queues branch from 0359bf8 to 3cda929 Compare February 5, 2025 14:17
@steveny91
Copy link
Contributor

steveny91 commented Feb 7, 2025

@janl Sorry I missed that question. So essentially our CI relies heavily on a tool called ddev:
https://datadoghq.dev/integrations-core/setup/#installers
https://docs.datadoghq.com/developers/integrations/python/?tab=macos

We then ship tests that are located in these files:
https://github.com/DataDog/integrations-core/tree/master/couch/tests

Which test functionality of the code. Given that new metrics were added, two tests are were failing and I see you already addressed. The only thing missing now is just adding a changelog for this change. For that if you want to go through with installing ddev you can then run the command.

ddev release changelog new and follow the prompt, but you can also create a changelog.d folder and add a new file that has the <pr_number>.<change_type> and then include the change there. For this one it'll be ./changelog.d/19521.added. Then inside you can just include a short message on what was added. Here's an example:

https://github.com/DataDog/integrations-core/tree/master/keda/changelog.d.

But I can also do so if you would allow me to push to your fork/branch

We greatly appreciate the contribution!

Comment on lines +264 to +268
couchdb.erlang.message_queues.max,gauge,,,,,0,couchdb,,
couchdb.erlang.message_queues.min,gauge,,,,,0,couchdb,,
couchdb.erlang.message_queues.50,gauge,,,,,0,couchdb,,
couchdb.erlang.message_queues.90,gauge,,,,,0,couchdb,,
couchdb.erlang.message_queues.99,gauge,,,,,0,couchdb,,
Copy link
Contributor

Choose a reason for hiding this comment

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

Non blocking nit: can you also leave a brief description describing these metrics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants