Query solution metrics from mongo.changes
POST
Composable analytics queries on any coll_name in mongo.changes. Set output to value (scalar KPI), table (grouped rows), pie (slices), timeseries (time series), or histogram (numeric distribution). For native-object collections, map JSON Schema properties to data.<property> paths. Full guide: Solution Metrics AI Reference
jwtheader
AuthorizationBearer <JWT>Query body. Use the Examples dropdown for one request per output type (value, table, pie, timeseries).
application/json- body
coll_name?stringLength
1 <= lengthcoll_name_prefix?stringMatch
^[a-zA-Z0-9_-]+:$dedup?booleaninclude_deletes?booleanlast?string|from?|to?|output*stringDefault
"table"Value in
"value""table""pie""timeseries""histogram"time_field?string|time_bucket?stringValue in
"minute""5minute""15minute""30minute""hour""6hour""12hour""day""week""month"week_start?stringValue in
"sunday""monday"select*array<>Items
1 <= items <= 250group_by?array<|||>Items
items <= 10ref?where?array<|>Items
items <= 20where_mode?string|stringsubquery?having?array<>Items
items <= 10anomaly?test?detect_period?booleandecompose?bins?integerRange
2 <= value <= 100bin_edges?array<number>Items
2 <= items <= 101compare?stringorder_by?stringMatch
^[a-zA-Z0-9_,.\s]+$limit?integerRange
0 < value <= 100000rollup_other?boolean|series_limit?integerRange
0 < value <= 100fill?booleansample?numberRange
0.000001 <= value <= 0.999999debug*booleanDefault
falseapplication/json- response
output*stringValue in
"value""table""pie""timeseries""histogram"data*|array<>|array<>meta*curl -X POST 'https://observability.your-tenant-id.my.contextual.io/api/v1/metrics/solution' \ -H 'Content-Type: application/json' \ -d '{ "coll_name": "contextual:files", "last": "-30d", "output": "value", "select": [ { "path": "data.meta.size", "agg": "count", "alias": "total_attachments" }, { "path": "data.meta.size", "agg": "sum", "alias": "total_storage_bytes" }, { "path": "data.meta.size", "agg": "avg", "alias": "avg_file_size_bytes" }, { "path": "data.meta.contentType", "agg": "count_distinct", "alias": "unique_content_types" } ], "where": [ { "path": "data.meta.contentType", "operator": "!=", "value": "" } ]}'Example Response
{ "output": "value", "data": { "property1": null, "property2": null }, "meta": { "metrics": [ "string" ], "series_keys": [ "string" ], "time_bucket": "string", "time_field": "string", "week_start": "sunday", "dedup": true, "deletes_excluded": true, "sql_generated": "string" }}