Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

2.3 KiB

Return a scalar count of trace spans matching a filter set. Use this as a cheap pre-flight before query-apm-spans — if the count is large, narrow the filters (or set excludeAttributes) before pulling rows.

All parameters must be nested inside a query object.

When to use

  • Before query-apm-spans, to confirm the filter set returns a tractable number of spans rather than pulling rows blind.
  • When the user asks "how many X spans are there?" and you don't need to see individual spans.
  • To check whether a filter combination matches anything at all before committing to a full query.

This counts spans, not traces. A single trace contains many spans, so a count of matching spans will exceed the number of matching traces.

If the count would scan too much data (a wide date range with no filters), the tool returns a 400 asking you to narrow the window or add filters — narrow the dateRange or add serviceNames / statusCodes / filterGroup, then retry.

Parameters

All parameters go inside query.

query.dateRange

Date range for the count. Defaults to the last hour (-1h).

  • date_from: Start of the range. Accepts ISO 8601 timestamps or relative formats: -1h, -6h, -1d, -7d, -30d.
  • date_to: End of the range. Same format. Omit or null for "now".

query.serviceNames

Filter by service names. Unlike query-apm-spans, an unfiltered count is cheap and useful for sizing up a filter before narrowing. Use apm-services-list to discover services.

query.statusCodes

Filter by OTel span status codes (list of integers: 0 Unset, 1 OK, 2 Error) — not HTTP status codes. Use [2] to select error spans.

query.filterGroup

Property filters to narrow the count. Same format as query-apm-spans filters — each filter specifies key, operator, type (span/span_attribute/span_resource_attribute), and optionally value.

Examples

Count error spans in a service over the last day

{
  "query": {
    "serviceNames": ["api-gateway"],
    "statusCodes": [2],
    "dateRange": { "date_from": "-1d" }
  }
}

Count how many spans match a name before fetching them

{
  "query": {
    "filterGroup": [{ "key": "name", "operator": "exact", "type": "span", "value": "redis_cluster.discovery" }],
    "dateRange": { "date_from": "-6h" }
  }
}