Daytona OpenTelemetry
Send Daytona sandbox telemetry to RawTree using the Daytona SDK's built-in OpenTelemetry support.
Daytona OpenTelemetry example
The destination is the OpenTelemetry app in RawTree Cloud or RawTree BYOC, where enabled. Configure your deployment endpoint and cluster API key.
This example sends Daytona sandbox telemetry to RawTree with the Daytona TypeScript SDK's built-in OpenTelemetry support.
How it works
The Daytona TypeScript SDK includes optional OpenTelemetry instrumentation.
When enabled, it records a span for each SDK operation, such as Daytona.create or Process.executeCommand.
It exports spans over OTLP/HTTP with the standard OTEL_EXPORTER_OTLP_* environment variables.
The service accepts native OTLP exports directly and writes them to RawTree.
The SDK sends telemetry to RawTree without a collector, agent, or proxy.
Features
- Direct OTLP/HTTP export from the Daytona SDK to RawTree
- No collector, agent, or proxy required
- One span per SDK operation, including sandbox lifecycle, command execution, and file transfers
- gzip-compressed export payloads, accepted by the service
- Query sandbox activity in the
tracestable immediately after export
Quick Start
Install the Daytona SDK together with the OpenTelemetry packages it loads when instrumentation is enabled:
npm install @daytonaio/sdk @opentelemetry/api @opentelemetry/sdk-node \
@opentelemetry/instrumentation-http @opentelemetry/sdk-trace-base \
@opentelemetry/exporter-trace-otlp-http @opentelemetry/otlp-exporter-base \
@opentelemetry/semantic-conventions @opentelemetry/resourcesConfigure the OTLP exporter with your cluster API key and database:
export OTEL_EXPORTER_OTLP_ENDPOINT=https://api.rawtree.com/otlp
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer%20$API_KEY,x-rawtree-database=analytics"Enable instrumentation when constructing the client:
import { Daytona } from "@daytonaio/sdk";
const daytona = new Daytona({
apiKey: process.env.DAYTONA_API_KEY,
otelEnabled: true,
});
const sandbox = await daytona.create({ language: "typescript" });
await sandbox.process.executeCommand("echo hello");Setting DAYTONA_OTEL_ENABLED=true in the environment enables the same instrumentation without code changes.
The SDK exports traces only.
It batches spans and flushes them when the process receives SIGTERM or when you dispose the client.
Dispose the client at the end of a short-lived script to export the final batch:
await daytona[Symbol.asyncDispose]();Workloads running inside a sandbox can export their own OTLP telemetry to RawTree with the same endpoint and headers.
Query your data
Daytona spans arrive in the traces table with service.name set to daytona-typescript-sdk:
SELECT name, count() AS spans
FROM traces
WHERE service.name = 'daytona-typescript-sdk'
GROUP BY name
ORDER BY spans DESC
LIMIT 20