ashutosh
ashutosh4d ago

OpenTelemetry Setup with Axiom.co

all the docs and demo videos by deno assumes that the endpoint is not authenticated. can someone help me to configure this with Axiom.co endoints I tried with these variables within env but this didn't work
OTEL_DENO=true
OTEL_SERVICE_NAME=service
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.axiom.co/v1/traces
OTEL_EXPORTER_OTLP_HEADERS='authorization=Bearer AXIOM_API_KEY,X-Axiom-Dataset=my-dataset'
OTEL_DENO=true
OTEL_SERVICE_NAME=service
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.axiom.co/v1/traces
OTEL_EXPORTER_OTLP_HEADERS='authorization=Bearer AXIOM_API_KEY,X-Axiom-Dataset=my-dataset'
4 Replies
foobar
foobar3d ago
axiom.co looks great. did you look at https://docs.deno.com/runtime/fundamentals/open_telemetry/ and authorize in deno deno run --unstable-otel
Deno
OpenTelemetry
Learn how to implement observability in Deno applications using OpenTelemetry. Covers tracing, metrics collection, and integration with monitoring systems.
foobar
foobar3d ago
Deno Blog
Zero-config Debugging with Deno and OpenTelemetry
Debugging requires implementation to get the right data for you to resolve issues quickly. Here's how you can use Deno to capture necessary telemetry data without any additional work.
foobar
foobar3d ago
I succeed in sending something to axiom.co by adding --strace-ops --log-level=debug & OTEL_EXPORTER_OTLP_ENDPOINT=https://api.axiom.co
{
"tasks": {
"start": "deno --allow-env --allow-net --env-file server.ts",
"otel": "OTEL_DENO=true OTEL_SERVICE_NAME=test_app
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.axiom.co
OTEL_EXPORTER_OTLP_HEADERS='authorization=Bearer xxxxxxx,X-Axiom-Dataset=dataset-test'
deno run --strace-ops --log-level=debug --unstable-otel --allow-net --allow-read --allow-env --env-file server.ts"
},
"imports": {
"hono": "jsr:@hono/hono"
}
}
{
"tasks": {
"start": "deno --allow-env --allow-net --env-file server.ts",
"otel": "OTEL_DENO=true OTEL_SERVICE_NAME=test_app
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.axiom.co
OTEL_EXPORTER_OTLP_HEADERS='authorization=Bearer xxxxxxx,X-Axiom-Dataset=dataset-test'
deno run --strace-ops --log-level=debug --unstable-otel --allow-net --allow-read --allow-env --env-file server.ts"
},
"imports": {
"hono": "jsr:@hono/hono"
}
}
it is a good start I refine the setup deno.jsonc
{
"tasks": {
"start": "deno --allow-env --allow-net --env-file server.ts",
"otel": "OTEL_DENO=true OTEL_SERVICE_NAME=test_app
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.axiom.co
OTEL_EXPORTER_OTLP_HEADERS='authorization=Bearer xxxxxx,X-Axiom-Dataset=dataset-test'
deno run --unstable-otel --allow-net --allow-read --allow-env --env-file server.ts"
},
"imports": {
"hono": "jsr:@hono/hono"
}
}
{
"tasks": {
"start": "deno --allow-env --allow-net --env-file server.ts",
"otel": "OTEL_DENO=true OTEL_SERVICE_NAME=test_app
OTEL_EXPORTER_OTLP_ENDPOINT=https://api.axiom.co
OTEL_EXPORTER_OTLP_HEADERS='authorization=Bearer xxxxxx,X-Axiom-Dataset=dataset-test'
deno run --unstable-otel --allow-net --allow-read --allow-env --env-file server.ts"
},
"imports": {
"hono": "jsr:@hono/hono"
}
}
server.ts
import { Hono } from 'hono'
const app = new Hono()

app.get('/', (c) =>{

const myUUID = crypto.randomUUID();
console.debug({uuid : myUUID})


if (0.5 > Math.random()) {
throw new Error('Random error')
}
return c.text('Hono!')

} )

Deno.serve(app.fetch)
import { Hono } from 'hono'
const app = new Hono()

app.get('/', (c) =>{

const myUUID = crypto.randomUUID();
console.debug({uuid : myUUID})


if (0.5 > Math.random()) {
throw new Error('Random error')
}
return c.text('Hono!')

} )

Deno.serve(app.fetch)
ashutosh
ashutoshOP3d ago
Thanks @foobar , I also got to know that deno.json can be renamed to deno.jsonc It works. Thanks a ton!

Did you find this page helpful?