Skip to content

Deno OTEL support missing logs #6

@kimdcottrell

Description

@kimdcottrell

In Deno 2.2, OTEL support is at a point where traces and logs show up with minimal configuration in Grafana. You can test it out by following this: https://deno.com/blog/v2.2#built-in-opentelemetry

When using acorn in Deno, the router should fallback to Deno.serve(), so I expected Grafana to easily pick up everything.

However, if you use this code:

import { Router } from '@oak/acorn';

const router = new Router({
	logger: { // this setting does not matter, Grafana can't make the Trace Span -> Log connection either way
		console: true,
	},
});

router.get('/', (ctx) => {
	console.log(ctx);
	return { hello: 'world' };
});

router.listen({ port: 4001 });

And then hit http://0.0.0.0:4001 and go into Grafana, it's almost completely working - which is very exciting - save for if you try to access logs from a trace. If you go into Tempo in Grafana, and then click a trace, and then click the service's span, and then click Logs for this span, you'll see that Grafana can't link the span to the logs.

However, if you run some basic Deno.serve code, it works just fine:


export default {
	async fetch(_req) {
		const JSON_ROUTE = new URLPattern({ pathname: '/' });
		console.log(_req);
		if (JSON_ROUTE.exec(_req.url)) {
			return Response.json({ hello: 'world' });
		}
	},
};

Linking this commit diff incase it's helpful for pinning this down: denoland/deno@bf79971#diff-847a11c353dfb7aeae6e35bc104b83a091ef797bdfc559d22ccfc804a3615000

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions