Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions utils/build/docker/nodejs/fastify/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ fastify.get('/otel_drop_in_default_propagator_inject', async (request, reply) =>

fastify.get('/otel_drop_in_baggage_api_otel', async (request, reply) => {
const api = require('@opentelemetry/api')
const ContextManager = require('dd-trace/packages/dd-trace/src/opentelemetry/context_manager')
Comment on lines 611 to +612

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a dd-trace path that exists in npm installs

This endpoint now requires dd-trace/packages/dd-trace/src/opentelemetry/context_manager, but in the default Docker build dd-trace is installed from npm (see utils/build/docker/nodejs/install_ddtrace.sh). The published package doesn’t include the monorepo path packages/dd-trace/..., so require will throw MODULE_NOT_FOUND and the endpoint will 500 in the common npm-install case. This only works when the monorepo layout is present (e.g., a local repo build), so the endpoint becomes broken for standard installs.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do i fix it?


const url = request.query.url
console.log(url)
Expand All @@ -627,6 +628,9 @@ fastify.get('/otel_drop_in_baggage_api_otel', async (request, reply) => {
const baggageToRemove = baggageRemove ? baggageRemove.split(',') : []
const baggageToSet = baggageSet ? baggageSet.split(',').map(item => item.split('=')) : []

const contextManager = new ContextManager()
api.context.setGlobalContextManager(contextManager)

let baggage = api.propagation.getActiveBaggage() || api.propagation.createBaggage()
for (const key of baggageToRemove) {
baggage = baggage.removeEntry(key.trim())
Expand Down
Loading