Skip to main content

Import

magpie-server import loads traces from files into a store: a Magpie export, OTLP/JSON files of the OpenTelemetry Collector’s file exporter, or LangSmith runs.
Stop the server first, or import into a new folder: an import is a writer.
An OTLP/JSON file has one request per line (jq -c . trace.json makes one line of a request that is printed on many lines):
  • Formats: magpie (the lines of POST /v1/export and /v1/export/scores), otlp, langsmith. A file that ends in .gz is read as gzip; - is the standard input.
  • A bad line is skipped and counted; the first 10 are named in the summary. --strict stops at the first one.
  • An import is safe to run again: every span replaces the stored span with the same ids. There is no resume: a stopped import starts from the first line again.
  • The import writes in time order. So import old traces first, into an empty store, then go live.
  • --prices and --mask work as on the server: give the import the same files.
  • Memory (--memory-mb, default 1024), disk, and formats in full: Server reference, “Import old traces”.

Backup

There is no backup command. Two ways work and were run here.

1. Export, then import

The server keeps running. The export is the commit of the moment of the request.
To restore, import both files into an empty folder:

2. Stop the server, copy the folder

A store folder that no process has open is a whole store. Copy it, and a server opens the copy:

What is not tested

  • A copy of the folder while the server writes is not tested. Do not rely on it: use the export, or stop the server.
  • A disk snapshot of the whole volume (for example an EBS snapshot) is not tested either.
  • With --s3, the bucket is a copy that is at most about 10 s behind (the S3 guide).
A backup holds private data. Deletes and purges do not touch it: delete old backups by your own rule.