Skip to main content
The library takes the same queries as the server. Every field of each query: text search, filters, whole traces, sums. The examples use an open store (open a store).

Pick the call

Sessions and scores have their own calls: sessions and scores. The route of the server for each call: the same queries in the library.

Search text

Put a shape in text to look in input and output, or in errorText to look in the error message. Attribute values have no text search: attributes is an exact match of a whole value. What a word is, and the limits of contains and prefix: text search.

Find traces

count is the number of all matching traces; traces holds one page of summaries. Every field of a trace filter (root, anySpan, anyScore, ranges of totals, and, or, not): whole traces and filters.

Add up tokens and cost

Each row has key (the group), count, and sums: one exact integer per metric, in the order of metrics. It has percentiles only when the query asks for some; a group where no span has a value gets null. Time buckets, a second key (thenBy), every metric and percentile: sums.

Page through results

findTraces, findSessions and traceSpans page the same way.
  • nextCursor is null (None) on the last page. Ties: spanId, then traceId (spans); traceId (traces); sessionId (sessions).
  • A cursor is a position in the sort order, not a saved result. Each page is read as of its own call and costs about as much as page 1.
  • A row whose sort key does not change comes exactly once, in order, also while writes go on. A new row that sorts before the position does not come; one that sorts after it comes on a later page.
  • A trace whose start moves during the walk (an earlier span arrives) can come twice or not at all.
  • A cursor given with another sort, or to another list, is an error. So is a string that is not a cursor.

Show previews of the text

With previewChars: 80 (Rust: preview_chars: Some(80)), each row also has inputPreview and outputPreview: the first 80 characters of the text.
  • A search row: of the span. It reads the stored span.
  • A trace row: of the root span. A root with no input gives the input of the earliest span that has one (start, then span id). A root with no output gives the output of the span that ended last among those that have one (ties: earlier start, then smaller span id).
  • The summary of a trace keeps the first 200 characters of both texts, so up to 200 the list reads no stored span. With more, it reads the stored span of each longer text.

Defaults

In Rust, ..Default::default() gives limit: 0 in SearchQuery, TraceQuery and SessionQuery: no rows. Set limit, for example to magpiedb::DEFAULT_LIMIT (50).

Sessions and scores

Score traces, sum scores, list sessions.

Read and export

Read whole traces, export to JSON Lines.

All query types

Every query shape, with examples.