Skip to content

Conversation

@monwolf
Copy link

@monwolf monwolf commented Dec 16, 2025

… circular imports

should fix #181

@monwolf monwolf force-pushed the fix/otel-circular-import branch 3 times, most recently from b7b0341 to ab07580 Compare December 16, 2025 13:24
initializeChannels()
return _producerSendsChannel[prop as keyof typeof _producerSendsChannel]
}
})
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately using proxy would slow this library down massively, we should identify a different approach.

Copy link
Author

Choose a reason for hiding this comment

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

I think removing the circular export should be enough let me double check it

Copy link
Author

Choose a reason for hiding this comment

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

@mcollina I reverted this file. And it's working also.

Signed-off-by: Bernat Mut <bernat.mut@aireuropa.com>
@monwolf monwolf force-pushed the fix/otel-circular-import branch from ab07580 to 6e13771 Compare December 18, 2025 07:43
@monwolf monwolf requested a review from mcollina December 18, 2025 07:57
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

'protocol/index.ts should not contain circular self-reference')
})

it('should use lazy initialization for diagnostic channels', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be removed as well

Comment on lines +15 to +16
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
Copy link
Member

Choose a reason for hiding this comment

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

These are not needed anymore, use import.meta.dirname and import.meta.filename

describe('OpenTelemetry Integration', () => {
it('should import library without hanging when OTEL hook is active', async () => {
// Create a minimal test script that imports the library
const { pathToFileURL } = await import('node:url')
Copy link
Member

Choose a reason for hiding this comment

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

move this import to the top

`

// Write test script to a temporary file
const { writeFileSync, unlinkSync, mkdtempSync } = await import('node:fs')
Copy link
Member

Choose a reason for hiding this comment

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

move to the top


// Write test script to a temporary file
const { writeFileSync, unlinkSync, mkdtempSync } = await import('node:fs')
const { tmpdir } = await import('node:os')
Copy link
Member

Choose a reason for hiding this comment

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

to the top

}
})

it('should not have circular self-import in protocol/index.ts', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

I think this is not a good test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem with --experimental-loader with @opentelemetry/instrumentation/hook.mjs in Node.js 24+

2 participants