Hi Peng Hui (and Garren), I think the Prometheus support would be an awesome feature! >From the e-mail it's not clear to me what would happen to the already existing endpoints mentioned (`_stats`, `_system` and `_active_tasks`). Are they going to be deprecated / removed? Or does the info become available in multiple formats (and places)?
Thank you, Donat On Tue, 22 Sep 2020 at 14:55, jiangph <jiangpeng...@hotmail.com> wrote: > > Hey all, > > We would like to add a Prometheus metrics endpoint for CouchDB and wanted to > see if the community would be interested in us contributing this to CouchDB > 4.x. > > Prometheus is a CNCF open-source project and the Prometheus metrics endpoint > format is supported by many monitoring tools. Its data model is based around > having a metric name which then contains a label name and a label value: > > <metric name>{<label name>=<label value>, ...} > > And it supports the Counter, Gauge, Histogram, and Summary metric types. > > The idea for the new Prometheus endpoint, /_metrics, would be that the > endpoint is a consolidation of the _stats [1], _system [2], and > _active_tasks [3] endpoints. > > For _stats and _system, the conversion from JSON to Prometheus-based format > seems to be straightforward. > > JSON format: > { > "value": { > "min": 0, > "max": 0, > "arithmetic_mean": 0, > "geometric_mean": 0, > "harmonic_mean": 0, > "median": 0, > "variance": 0, > "standard_deviation": 0, > ... > "percentile": [ > [ > 50, > 0 > ], > [ > 75, > 0 > ], > [ > 90, > 0 > ], > [ > 95, > 0 > ], > [ > 99, > 0 > ], > [ > 999, > 0 > ] > ], > "histogram": [ > [ > 0, > 0 > ] > ], > } > > Prometheus-based format: > > couchdb_stats{value="min"} 0 > couchdb_stats{value="max"} 0 > couchdb_stats{value="percentile50"} 0 > couchdb_stats{value="percentile75"} 0 > couchdb_stats{value="percentile95"} 0 > > For _active_tasks, the change will be a bit more complicated, and some fields > will be added to labels and tags. > > JSON format: > > { > "checkpointed_source_seq": 68585, > "continuous": false, > "doc_id": null, > "doc_write_failures": 0, > "docs_read": 4524, > "docs_written": 4524, > "missing_revisions_found": 4524, > "pid": "<0.1538.5>", > "progress": 44, > "replication_id": "9bc1727d74d49d9e157e260bb8bbd1d5", > "revisions_checked": 4524, > "source": "mailbox", > "source_seq": 154419, > "started_on": 1376116644, > "target": "http://mailsrv:5984/mailbox <http://mailsrv:5984/mailbox>", > "type": "replication", > "updated_on": 1376116651 > } > > Prometheus-based would look something like: > > format:couchdb_active_task{type="replication", source="mailbox", > target="http://mailsrv:5984/mailbox <http://mailsrv:5984/mailbox>", > docs_count = "docs_read"} 4524 > couchdb_active_task{type="replication", source="mailbox", > target="http://mailsrv:5984/mailbox <http://mailsrv:5984/mailbox>", > docs_count = "docs_written"} 4524 > couchdb_active_task{type="replication", source="mailbox", > target="http://mailsrv:5984/mailbox <http://mailsrv:5984/mailbox>", > docs_count = "missing_revisions_found"} 4524 > > > Best regards, > Garren Smith > Peng Hui Jiang > > [1] > https://docs.couchdb.org/en/latest/api/server/common.html#node-node-name-stats > > <https://docs.couchdb.org/en/latest/api/server/common.html#node-node-name-stats> > [2] https://docs.couchdb.org/en/latest/api/server/common.html#active-tasks > <https://docs.couchdb.org/en/latest/api/server/common.html#active-tasks> > [3] > https://docs.couchdb.org/en/latest/api/server/common.html#node-node-name-system > > <https://docs.couchdb.org/en/latest/api/server/common.html#node-node-name-system>