Daytona OpenTelemetry
Send Daytona sandbox telemetry to RawTree using the Daytona SDK's built-in OpenTelemetry support.
Daytona OpenTelemetry example
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 ships with optional OpenTelemetry instrumentation. When it is enabled, the SDK records a span for each SDK operation, such as Daytona.create or Process.executeCommand, and exports those spans over OTLP/HTTP using the standard OTEL_EXPORTER_OTLP_* environment variables. RawTree accepts native OTLP exports directly, so the SDK can send its telemetry straight to RawTree. No collector, agent, or proxy is required.
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 RawTree
- 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/resourcesPoint the OTLP exporter at RawTree with your project API key:
export OTEL_EXPORTER_OTLP_ENDPOINT=https://api.rawtree.com/otlp
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer%20$API_KEY"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. Spans are batched and flushed when the process receives SIGTERM or when the client is disposed, so dispose the client at the end of short-lived scripts 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