jasnell / jasnell/proposal-fetch-server

OpenTelemetry support

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Bikeshed
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

It seems proposed API may make it impossible to instrument HTTP servers, created by calling serve().

OpenTelemetry instrumentations use either import-in-the-middle to hook into classes and exported functions or (in case of fetch()) leverage diagnostics channel.

For a server, tracing via node:diagnostics_channel is not enough, because handler needs to be wrapped in AsyncLocalStorage that carries tracing context.

From the proposal, I see one possible injection point, which is wrapping serve on FetchServer.prototype. The question is, is this going to be possible? Is FetchServer globally available or exported? Does directly setting FetchServer.prototype.serve = wrapServe(FetchServer.prototype.serve) allows one to catch all requests that pass through every server created? Will one be able, with the help of import-in-the-middle, to hook into loading "http", "node:http", "node:serve" and wrap FetchServer.prototype.serve?

Hopefully, these will be addressed before the proposal lands.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the proposal sections covering FetchServer and serve() first, then compare them with the stated OpenTelemetry requirements around AsyncLocalStorage and node:diagnostics_channel. Done means the proposal clearly addresses whether FetchServer is exported or globally available, whether serve() can be wrapped for every created server, and whether the relevant Node modules can be hooked.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend-api-design, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.