willholley opened a new pull request, #4474:
URL: https://github.com/apache/couchdb/pull/4474

   ## Overview
   
   `couch_prometheus_util:counter_metric/1` is intended to add a `_total` 
suffix to the name of metrics with type `counter` if the name does not already 
end with `_total`.
   
   The implementation was previously incorrect, resulting in the metric 
`couchdb_document_purges_total` being named as 
`couchdb_document_purges_total_total`.
   
   Whilst the `counter_metric` function is generic, in practice this only 
changes the name of `couchdb_document_purges_total_total` in the 
`_node/_local/_prometheus` endpoint response. Consumers of this metric via the 
prometheus endpoint will need to update their code accordingly.
   
   ## Testing recommendations
   
   This adds basic eunit tests for the failure / success scenarios and fixes 
the implementation. As part of this, I've inlined the eunit tests for 
`couch_prometheus_util.erl` as this is the pattern used elsewhere in the 
CouchDB codebase and it allows us to test the counter_metric function without 
exporting it.
   
   To verify, run:
   `make eunit apps=couch_prometheus`
   
   You can also query then `/_node/_local/_prometheus` endpoint to observe the 
metric output.
   
   ## 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to