Skip to content

OpenTelemetry instrumentation #442

@aldy505

Description

@aldy505

Most popular Node.js HTTP server libraries has some kind of OpenTelemetry support (Express, Fastify, Koa, Hapi, Connect, even Restify has it). I'm wondering how much people are needing OpenTelemetry instrumentation capability for Tinyhttp. Please raise a thumbs up 👍 on the issue if you'd like to see it happen.

If people are keen for this, there are two options moving forward:

  1. Provide @tinyhttp/opentelemetry package, which will patch the Tinyhttp library. Very similar to what all the links above did. Personally, I dislike this approach since we're adding maintenance burden if Tinyhttp hits another major version update.
  2. Include the tracer.startSpan() stuff inside the @tinyhttp/app package. This will add additional dependency of @opentelemetry/api in which we can make it as a peerDependency, very similar to what Drizzle did here: https://github.com/drizzle-team/drizzle-orm/blob/c8359a16fff4b05aff09445edd63fc65a7430ce9/drizzle-orm/src/node-postgres/session.ts#L48-L80 (the tracer function is implemented here: https://github.com/drizzle-team/drizzle-orm/blob/c8359a16fff4b05aff09445edd63fc65a7430ce9/drizzle-orm/src/tracing.ts#L25)

Feel free to give out your opinions on this. Personally, for performance reasons, I prefer the second approach. The first approach is popular, but it causes a slowdown on application initialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions