Replies: 2 comments 1 reply
-
|
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a project where having a grafana server is overkill, but I still would like to have all the OTEL data collected go to a file (per day for example).
Is this possible without writing (much) code? How would I go about? I googled, I asked the LLM powers that be, and I have not been able to formulate an answer for myself.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions