File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -443,6 +443,31 @@ When the doc.type map/reduce is in place and the couch_get_dbs_stats.sh has it e
443443```
444444
445445Below will return all of the doc types count series for a metric and couch db name:
446+ ```
447+
448+ CREATE OR REPLACE VIEW couch_dbs_stats AS
449+ WITH dbs AS (
450+ SELECT abtest.doc ->> 'ts'::text AS "time",
451+ abtest.doc ->> 'name'::text AS metric_name,
452+ json_array_elements((abtest.doc ->> 'dbs'::text)::json) AS adoc
453+ FROM abtest
454+ WHERE (abtest.doc ->> 'type'::text) = 'couch_dbs_stats'::text
455+ ), doc_types_counts_working AS (
456+ SELECT dbs."time",
457+ dbs.metric_name,
458+ dbs.adoc ->> 'db_name'::text AS db_name,
459+ json_array_elements((dbs.adoc ->> 'doc_types_count'::text)::json) AS mdoc
460+ FROM dbs
461+ WHERE (dbs.adoc ->> 'doc_types_count'::text) IS NOT NULL
462+ )
463+ SELECT doc_types_counts_working."time",
464+ doc_types_counts_working.metric_name,
465+ doc_types_counts_working.db_name,
466+ json_object_keys(doc_types_counts_working.mdoc) AS doc_type,
467+ doc_types_counts_working.mdoc ->> json_object_keys(doc_types_counts_working.mdoc) AS doc_count
468+ FROM doc_types_counts_working;
469+ ```
470+
446471```
447472CREATE OR REPLACE FUNCTION get_couch_dbs_doc_type_counts(metricname TEXT, dbname TEXT)
448473 RETURNS text AS
You can’t perform that action at this time.
0 commit comments