Monitor Modal Functions and Sandboxes with OpenTelemetry SigNoz has published a guide for monitoring Modal functions and Sandboxes with OpenTelemetry, detailing three non-overlapping telemetry paths: the Modal OpenTelemetry integration for workspace-wide logs and metrics, tracing in the caller for per-command latency and failures, and tracing inside the Sandbox for code-level spans. The integration requires creating a Modal Secret with an authorization header containing the SigNoz ingestion key, setting the OpenTelemetry push URL to the SigNoz endpoint, and testing the connection with a test log that appears in SigNoz as 'Hello from Modal!' with service.name 'modal.test_logs'. Overview Modal https://modal.com runs Python functions and Sandboxes on demand. A Sandbox is a container that Modal creates at runtime to execute untrusted or AI-generated code. Your agent creates a Sandbox, runs commands in it, reads the output, and terminates it. Two things go wrong in that loop, and each needs its own telemetry. The code inside the Sandbox fails or hangs, and the Sandbox itself starts slowly or runs out of memory. Prerequisites - An instance of SigNoz either Cloud https://signoz.io/teams/ or Self-Hosted https://signoz.io/docs/install/self-host/ - A SigNoz ingestion key https://signoz.io/docs/ingestion/signoz-cloud/keys/ - A Modal account https://modal.com/signup , with permission to edit workspace settings - The modal CLI, installed with pip install modal and authenticated with modal setup How it works Modal offers three OpenTelemetry paths. They do not overlap, so pick the ones that answer your question. | Path | What you get | What it costs you | |---|---|---| | Modal OpenTelemetry integration | Function logs, Sandbox logs, and container metrics for the whole workspace | One workspace setting | | Tracing in the caller | Latency and failures for every Sandbox.create and every command you run | Code in the application that drives the Sandboxes | | Tracing inside the Sandbox | Spans and logs from the code your agent runs | Packages and a Secret in the Sandbox image | Start with the integration. It needs no code changes, and it covers every Function and every Sandbox in the workspace. It sends no traces, so add the second path when you need to know which command an agent ran, how long it took, and whether it failed. Monitoring Modal The Modal OpenTelemetry integration sends Function logs, Sandbox logs, and container metrics to any backend that accepts OTLP over HTTP. You give Modal two things: the base URL of your SigNoz endpoint, and a Modal Secret that holds the authentication header. Step 1: Create the Modal Secret Modal builds the request headers from a Secret. Each key starts with OTEL HEADER , and the rest of the key is the header name. Use the authorization header, which SigNoz accepts with the ingestion key as its value: modal secret create signoz-otel \ OTEL HEADER authorization=