Troubleshooting
First: run zyonix doctor where the application runs
Most problems are settings the application does not see. Run zyonix doctor in the same
environment as the application (the same shell, docker compose exec app zyonix doctor,
kubectl exec deploy/app -- zyonix doctor), not on your laptop. It shows the settings it found and
stops at the first problem, with the fix on the next line. See
What zyonix doctor checks.
If the zyonix command is not found, the virtual environment is not active (or its scripts folder
is not on PATH). python -m zyonix.cli doctor runs the same command.
Seeing the SDK's messages
The SDK logs through Python's standard logging, under the logger name zyonix. Warnings (a
refused endpoint, an invalid zyonix.yaml, dropped data) appear on standard error even if your
application configures no logging. Informational and debug messages (for example
zyonix: tracing is off, or the reason an export failed) appear only if you ask for them:
import logging
logging.basicConfig()
logging.getLogger("zyonix").setLevel(logging.DEBUG)
The SDK never logs document content or exception messages from its export path, only types and counts.
Nothing arrives in Zyonix
Work down this list.
| Cause | How to tell | Fix |
|---|---|---|
ZYONIX_API_KEY is not set in the application's process. Without a key, tracing is off and nothing is sent. | zyonix doctor in that environment says api_key=(not set) and tracing is off. | Set the variable where the application runs: service definition, container environment, secret. Restart the application: environment variables are read at start-up. |
The application reads .env itself. pydantic-settings and dotenv_values() read the file into your settings only, not into the process environment the SDK reads. | It works in Docker Compose (env_file exports the lines) but not when run directly. | Export the variables, or call load_dotenv() before zyonix.init. See Settings in a .env file. |
ZYONIX_ENDPOINT is not set. The SDK then sends to http://localhost:8000. | doctor shows endpoint=http://localhost:8000. | Set ZYONIX_ENDPOINT=https://zyonix.example.com. |
The address is a public name not listed in egress_allow. | Warning endpoint host ... is not local and not listed in egress_allow (local-only mode); remote tracing is disabled. | Set ZYONIX_EGRESS_ALLOW=zyonix.example.com (the host only). See Data boundary. |
Plain http:// to a public host. Refused whatever egress_allow says. | Warning ... is not local and the endpoint is plain http://. | Use the https:// address. |
| A private certificate authority. | doctor: cannot reach ...: ... CERTIFICATE_VERIFY_FAILED. | Set ZYONIX_CA_FILE to the authority's PEM file. See Private certificate authority. |
| The wrong kind of key, or a revoked key. An agent key cannot send documents. A revoked or rotated-out key is refused. | doctor: API key rejected (HTTP 401), or test trace not exported. In the application's log: span(s) were not exported: the backend rejected the API key (401/403). | Create an sdk key under Team → API keys and put it in the environment. |
| A key of another agent or installation. | Documents arrive, but under another agent on the website. doctor's API key accepted (project ...) names the agent. | Use a key created while that agent was selected in the switcher. |
An invalid zyonix.yaml (YAML error, unknown key, wrong value). Tracing is off until it is fixed. | Warning config file zyonix.yaml is invalid (...); tracing is disabled. doctor shows the reason. | Fix the file, or remove it. |
zyonix.yaml is not where the process starts. The SDK reads it from the working directory. A service started from another folder runs without it (and in hash_only). | doctor in the service's folder says config file: (none, ...). | Set ZYONIX_CONFIG=/path/to/zyonix.yaml, or start the process from that folder. |
zyonix.init is never called in this process (for example it sits under if __name__ == "__main__": in a module that worker processes only import). | zyonix.current_trace_id() inside the run returns None. | Call init in code every process runs at start-up. See Multiple processes. |
| The script exits before the data is sent. | Documents from long-running services arrive, from a short script they do not (or only some). | Call zyonix.flush(10) at the end. See Short scripts. |
| The run function is not the one being called, or steps run outside it. | Local mode shows no zyonix.run span. | Put @zyonix.run on the function that actually handles each document. |
zyonix doctor can pass while the application sends nothing when doctor finds a key the
application does not: a variable set only in your shell, or (with zyonix-cli installed) the
session saved by zyonix login. Always compare with the application's own environment.
Documents arrive but show as not checked
| Cause | Fix |
|---|---|
Capture is hash_only (the default). Zyonix has hashes, not content, so it cannot check values. | Turn on full capture deliberately: see Capture. |
No zyonix.output(...) in the run, so there is no result to check. | Call zyonix.output(result, schema=...) before the run returns. |
No output format for this kind of document yet (the schema name is new to Zyonix). | Ask an administrator to set up the checks on the Checks page, or keep the same schema name your output format uses. |
The output record was cut by max_payload_bytes. | Raise max_payload_bytes. See Payload size. |
Duplicate or missing documents
The same document appears many times. Each time your application processes a document, that is
a new run, so retries and reprocessing show up as several entries with the same document id.
That is expected. Entries with different ids for what you consider one document mean the
doc_id is not stable:
- A random
doc_id(uuid4(), a timestamp,id(obj)): every attempt looks like a new document, and corrections cannot be matched. Use the document's own id: a message id, an upload id, a database key, a content hash. - Nested runs. A
@zyonix.runfunction that calls another@zyonix.runfunction creates two runs, because every run starts its own trace. Put@zyonix.runonly on the outermost function for one document; mark the inner one as a step.
Many documents appear as one. The run is around a loop (@zyonix.run on a function that
processes a whole batch). Move it to the function that handles one document.
A document is missing its steps. The steps ran outside the run: in a thread the run did not start with its context (see threads), or in a different process.
Short scripts and jobs
The SDK sends in a background thread, about once per second. A process that ends right after its work can exit before that thread has sent everything.
- Call
zyonix.flush(10)as the last thing a script or batch job does. It returnsTruewhen everything was sent. - At a normal interpreter exit the SDK flushes for up to 2 seconds by itself. That does not happen
when the process is killed (
SIGKILL, a container stop past its grace period, an out-of-memory kill) or ends withos._exit(). - Serverless functions (AWS Lambda, Cloud Functions, Azure Functions) freeze the process between
invocations: call
zyonix.flush(5)at the end of every invocation. - In a web application, call
zyonix.shutdown()in its shutdown hook, so a restart does not lose the last documents.
Multiple processes and workers
Each process sends its own data and needs its own zyonix.init().
- gunicorn, uvicorn
--workers, Celery, RQ, multiprocessing pools: callinitin code that each worker runs when it starts (the app's start-up or lifespan hook, Celery'sworker_process_initsignal, the pool'sinitializer). - Forking after
init(for example gunicorn--preload, ormultiprocessingwith theforkstart method afterinitwas called): the background sending thread does not survive the fork, so the child processes record but never send. Callinitafter the fork instead (gunicorn: thepost_forkhook). inittwice in one process is ignored with a warning. To restart with other settings, callzyonix.shutdown()first.
LLM calls are missing
| Cause | Fix |
|---|---|
| The extra for your library is not installed. | pip install "zyonix-sdk[openai]" (or your library). doctor lists not instrumented. |
instrument: none, or a list without your library. | Change instrument. |
| The application already instrumented the library on its own OpenTelemetry provider. | Set otel_provider: shared, aware that your exporters then receive Zyonix data too. See LLM libraries. |
| The library is not supported. | Wrap the call in a step; see Other libraries. |
| The call is made outside a run, or in a thread without the run's context. | Make the call inside the run, in the run's context. |
Data dropped by the SDK
When data cannot be delivered, the SDK drops it rather than slowing down your application, counts it by reason, and logs a warning at most once a minute per reason:
zyonix: 12 span(s) were not exported: the backend could not be reached or timed out (12 in total; see zyonix.stats())
| Reason in the warning | Meaning | Fix |
|---|---|---|
the export queue is full | The server is slower than your application for a long time. | Check the server's health; raise export.queue_size / export.queue_max_bytes only if bursts are short. |
could not be reached or timed out | Network, DNS, firewall, a wrong address, or a certificate problem. | Run zyonix doctor in that environment. |
answered 429 or 5xx | The server is overloaded or down. | Data during that time is lost; check with your Zyonix administrator. |
rejected the API key (401/403) | Wrong, revoked or wrong-kind key. | Use a valid sdk key. |
rejected the request (4xx) | The server refused one request; the next ones may go through. | If it repeats, run zyonix doctor and tell your Zyonix administrator. |
a span is larger than the backend accepts | One step's payload is too large even on its own. | Lower max_payload_bytes, or capture_input=False on that step. |
could not be prepared for export and was withheld | A span could not be redacted or reduced safely, so it was not sent at all. | Usually an unusual value type in a step's arguments or result; capture_input=False / capture_output=False on that step. |
Each run also carries the number of spans the SDK had dropped so far, which zyonix runs show
reports as dropped by the SDK.
(zyonix.stats(), named in the warning, is internal in this version: zyonix._core.stats().)
Performance
The SDK is built to cost your application little:
- On your thread, each step redacts its arguments and its result, turns them into JSON and puts
them on a queue. That is fast for typical payloads and grows with their size: a step whose
arguments are many megabytes costs more. Use
capture_input=Falseorcapture_output=Falsefor steps whose large arguments are not useful evidence, and keep custom redaction patterns simple. - Compression and sending happen on a background thread, in batches, about once per second.
- The queue is bounded by count and bytes (2048 spans, 256 MB by default), so a slow or unreachable server can never block your threads or fill your memory: data is dropped and counted instead.
- Each request has a 5-second timeout and is never retried in a loop.
- With tracing off (no key), the decorators do almost nothing besides calling your function (a
doc_idfunction you gave@zyonix.runis still evaluated).
To measure it in your own application, time a batch of documents with tracing on (local mode) and off (no variables).
The fail-open guarantee
Whatever goes wrong on the Zyonix side, your application behaves as if Zyonix were not there:
- The SDK never raises into your code. Errors inside it are caught, counted and logged at debug
level.
zyonix.init()never raises either: if it cannot start, tracing stays off. - Your own exceptions pass through unchanged: the same exception object, with its traceback.
- Return values are unchanged. Decorators return exactly what your function returns;
zyonix.outputreturns its argument. - An unreachable, slow or refusing server only means data is dropped and counted.
- An invalid configuration turns tracing off, never your application.
The single deliberate exception is zyonix.ReplayBlocked:
raised by a tool with side effects, and only while zyonix test or zyonix replay re-runs a
recorded step, never in your application's normal operation.
So never wrap Zyonix calls in try/except: there is nothing to catch.