Platform
Metrics
Metrics API
20 min
get /api/public/metrics the metrics api enables you to retrieve customized analytics from your abv data this endpoint allows you to specify dimensions, metrics, filters, and time granularity to build powerful custom reports and dashboards for your llm applications overview the metrics api supports querying across different views (traces, observations, scores) and allows you to select specific dimensions to group your data apply multiple metrics with different aggregation methods filter data based on metadata, timestamps, and other properties analyze data across time with customizable granularity order results according to your needs query parameters the api accepts a json query object passed as a url encoded parameter parameter type description query json string the encoded query object defining what metrics to retrieve query object structure field type required description view string yes the data view to query "traces" , "observations" , "scores numeric" , or "scores categorical" dimensions array no array of dimension objects to group by, e g \[{ "field" "name" }] metrics array yes array of metric objects to calculate, e g \[{ "measure" "latency", "aggregation" "p95" }] filters array no array of filter objects to narrow results, e g \[{ "column" "metadata", "operator" "contains", "key" "customkey", "value" "customvalue", "type" "stringobject" }] timedimension object no configuration for time based analysis, e g { "granularity" "day" } fromtimestamp string yes iso timestamp for the start of the query period totimestamp string yes iso timestamp for the end of the query period orderby array no specification for result ordering, e g \[{ "field" "name", "direction" "asc" }] dimension object structure { "field" "name" } metric object structure { "measure" "count", "aggregation" "count" } common measure types include count count of records latency duration/latency metrics aggregation types include sum sum of values avg average of values count count of records max maximum value min minimum value p50 50th percentile p75 75th percentile p90 90th percentile p95 95th percentile p99 99th percentile filter object structure { "column" "metadata", "operator" "contains", "key" "customkey", "value" "customvalue", "type" "stringobject" } time dimension object { "granularity" "day" } supported granularities include hour , day , week , month , and auto example here's an example of querying the number of traces grouped by name api curl \\ h "authorization basic \<basic auth header>" \\ g \\ \ data urlencode 'query={ "view" "traces", "metrics" \[{"measure" "count", "aggregation" "count"}], "dimensions" \[{"field" "name"}], "filters" \[], "fromtimestamp" "2025 05 01t00 00 00z", "totimestamp" "2025 05 13t00 00 00z" }' \\ https //app abv dev/api/public/metrics response {"data" \[{"name" "trace test 2","count count" "10"},{"name" "trace test 3","count count" "5"},{"name" "trace test 1","count count" "3"}]} python sdk query = """ { "view" "traces", "metrics" \[{"measure" "count", "aggregation" "count"}], "dimensions" \[{"field" "name"}], "filters" \[], "fromtimestamp" "2025 05 01t00 00 00z", "totimestamp" "2025 05 13t00 00 00z" } """ abv api metrics metrics(query = query) data model the metrics api provides access to several data views, each with its own set of dimensions and metrics you can query this section outlines the available options for each view available views view description traces query data at the trace level observations query data at the observation level scores numeric query numeric and boolean scores scores categorical query categorical (string) scores trace dimensions dimension type description id string trace id name string trace name tags string\[] trace tags userid string user id associated with the trace sessionid string session id associated with the trace release string release tag version string version tag environment string environment (e g , production, staging) observationname string name of related observations scorename string name of related scores trace metrics metric description count count of traces observationscount count of observations within traces scorescount count of scores within traces latency trace duration in milliseconds totaltokens total tokens used in the trace totalcost total cost of the trace observation dimensions dimension type description id string observation id traceid string associated trace id tracename string name of the parent trace environment string environment (e g , production, staging) parentobservationid string id of parent observation type string observation type name string observation name level string log level version string version providedmodelname string model name promptname string prompt name promptversion string prompt version userid string user id from parent trace sessionid string session id from parent trace tracerelease string release from parent trace traceversion string version from parent trace scorename string related score name observation metrics metric description count count of observations latency observation duration in milliseconds totaltokens total tokens used totalcost total cost timetofirsttoken time to first token in milliseconds countscores count of related scores score dimensions (common) dimension type description id string score id name string score name environment string environment source string score source datatype string data type traceid string related trace id tracename string related trace name userid string user id from trace sessionid string session id from trace observationid string related observation id observationname string related observation name observationmodelname string model used in related observation observationpromptname string prompt name used in related observation observationpromptversion string prompt version used in related observation configid string configuration id score metrics numeric scores metric description count count of scores value numeric score value categorical scores metric description count count of scores categorical scores have an additional dimension dimension type description stringvalue string string value of the categorical score