Subchapter 43.3
metrics.mdMarkdown3 KBView on GitHub
Load this file when you need aggregation across a large dataset — unique users, counts by dimension, time-bucketed trends — or before building a graph.
query-logs, query-traces, query-error-groups, or query-sessionsThe query-aggregations tool returns bucketed aggregated values, suitable for charting and analysis.
product_type is required; one of errors, traces, logs, sessions (requests is accepted as an alias for traces).start_date is required; ISO format.end_date defaults to now.query is an attribute filter — e.g. error EXISTS AND service_name=foo.group_by is an attribute to group results by (e.g. message, service_name). Single field.Note: across different product types, the same attribute keys work — query query-aggregations with product_type="sessions" and group_by="identifier" for session-grouping analogous to product_type="logs" with group_by="level".
When requesting aggregations, use coarser intervals or fewer groupings — bloated responses exceed the context window. Prefer 10–30 buckets over 1000; prefer a single group_by over multi-dimension pivots.
product_type="errors", 24-hour window, group_by service_name → top offending services.query-aggregations with product_type="sessions", group_by="identifier". Don’t paginate through individual sessions.create-graph, run a query-aggregations query to verify the data shape is what you expect (non-empty, reasonable bucket distribution).Before aggregating on an unfamiliar attribute, call get-keys for the product type to see which grouping keys exist. Attribute names vary — service_name vs service.name vs serviceName.
query-error-groups and query-logs to get the specific errors.query-aggregations with group_by.get-keys and guessing attribute names. Wrong name returns an empty metric — silently.