Skip to Content
Docs

Query solution metrics from mongo.changes

POST
/metrics/solution

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

Authorization

jwt
headerAuthorizationBearer <JWT>

Request Body

Query body. Use the Examples dropdown for one request per output type (value, table, pie, timeseries).

application/json
  1. body
coll_name?string
Length1 <= length
coll_name_prefix?string
Match^[a-zA-Z0-9_-]+:$
dedup?boolean
include_deletes?boolean
last?string|
from?|
to?|
output*string
Default"table"
Value in"value""table""pie""timeseries""histogram"
time_field?string|
time_bucket?string
Value in"minute""5minute""15minute""30minute""hour""6hour""12hour""day""week""month"
week_start?string
Value in"sunday""monday"
select*array<>
Items1 <= items <= 250
group_by?array<|||>
Itemsitems <= 10
ref?
where?array<|>
Itemsitems <= 20
where_mode?string|string
subquery?
having?array<>
Itemsitems <= 10
anomaly?
test?
detect_period?boolean
decompose?
bins?integer
Range2 <= value <= 100
bin_edges?array<number>
Items2 <= items <= 101
compare?string
order_by?string
Match^[a-zA-Z0-9_,.\s]+$
limit?integer
Range0 < value <= 100000
rollup_other?boolean|
series_limit?integer
Range0 < value <= 100
fill?boolean
sample?number
Range0.000001 <= value <= 0.999999
debug*boolean
Defaultfalse

Response Body

application/json
  1. response
output*string
Value 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"  }}