application/x-ndjson): one JSON object per line. Right: read. The server sends the body in chunks while it makes it, so an export of any size fits in a few MB of server memory.
Export spans
POST /v1/export sends every span that matches the filter, one per line, oldest first. Spans with the same startedAt come in no promised order.
A span filter.
{} or no body: every span. A time range: {"filter": {"from": a, "to": b}}.write takes, so the lines load back into a store (magpie-server import --format magpie).
Export scores
POST /v1/export/scores sends every score, one per line, in no promised order.
Scores are a second file because a score can come long after its trace. A span filter does not pick scores. For the scores of one trace, use GET /v1/traces/:id/scores.
How an export behaves
- One span per line. A line has no line break inside. JSON escapes the control characters, and the server also writes U+0085, U+2028 and U+2029 as
\uescapes. So tools that end a line at them (Node’sreadline, Python’sstr.splitlines) still see one span per line. - Chunks. The body comes in chunks of whole lines, at most a few MB each (more if one span is bigger). The server makes the next chunk only when the one before is on its way, so it holds about three chunks. A client that goes away stops the export.
- One commit. The export reads the commit that the store shows when the request comes, from start to end: later writes and deletes are not in it. It keeps the files of that commit open until it ends, so a merge during a long export cannot free their disk space before.
- Errors. A request that cannot run (an unknown field, a bad filter) gets
400before any line. If the export fails after its first chunk, the status is already sent: the connection ends without the end of the body. A body read to its end with no error has every line.
Read and export
A guide with real exports.
Backup and import
Load an export into another store.