-
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
enhancementNew feature or requestNew feature or request
Description
What is the problem this feature would solve?
Right now the opentelemetry plugin:
- Initializes the OpenTelemetry NodeSDK by default
- Automatically records request/response body + sizes, which requires body/stream transformations
Both add noticeable overhead and make it hard to run lightweight or custom OTel setups (Bun, edge, manual SDK, etc), especially with larger streaming calls (e.g. proxying LLM calls). It also kind of goes against the performance spirit of Elysia.
Per the OTel HTTP semantic conventions, body size attributes are opt-in and should only be recorded when explicitly enabled or already known (e.g. via content-length):
https://opentelemetry.io/docs/specs/semconv/http/http-spans/
Specifically:
http.request.bodyhttp.request.body.sizehttp.response.bodyhttp.response.body.size
What is the feature you are proposing to solve the problem?
- Make NodeSDK initialisation opt-in:
new Elysia()
.use(
opentelemetry({
// default to empty array
instrumentations: [getNodeAutoInstrumentations()]
})
)- Make body + size capture opt-in:
new Elysia()
.use(
opentelemetry({
// default to false
captureBodies: true
})
)- Less performance critical, but to align with OTEL spec conventions, headers should also be opt-in for security reasons.
This would probably also allow to reduce the dependencies from @opentelemetry/sdk-node to @opentelemetry/sdk-trace-base.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request