Deno Open Telemetry data to a simple file log #31280
-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
|
Deno's OTEL only exports to OTLP endpoints, not files directly. Create a minimal HTTP server (~15 lines) that receives OTLP JSON and writes to files: const data = { spans: [], logs: [] };
Deno.serve({ port: 4318 }, async (req) => {
const body = await req.json();
body.resourceLogs?.forEach(r => r.scopeLogs.forEach(s => data.logs.push(...s.logRecords)));
body.resourceSpans?.forEach(r => r.scopeSpans.forEach(s => data.spans.push(...s.spans)));
Deno.writeTextFileSync(`otel-${new Date().toISOString().split('T')[0]}.json`, JSON.stringify(data));
return Response.json({ partialSuccess: {} });
});Then set |
Beta Was this translation helpful? Give feedback.
-
|
You could try using a simple file exporter in OpenTelemetry. Most OTEL SDKs support exporting traces or metrics to a local file instead of sending them to a full server. For example, in Deno, you could write a small script to collect OTEL data and append it to a file per day. Even a basic implementation that writes JSON lines to a .log file can work. This way, you avoid setting up Grafana but still capture all the data for later analysis. |
Beta Was this translation helpful? Give feedback.
-
|
PR for this feature: #32717 |
Beta Was this translation helpful? Give feedback.

PR for this feature: #32717