Skip to content

Conversation

@JacksonWeber
Copy link
Contributor

This pull request updates the OpenTelemetry (OTel) global detection logic in the agent loader to delay detection until after the customer application has had time to initialize. This change helps avoid premature detection and potential conflicts. The update also includes a new unit test to verify the delayed detection and adjusts the test setup to use fake timers for accurate timing simulation.

OpenTelemetry Detection Update:

  • The agent loader now waits 1 minute (OTEL_DETECTION_DELAY_MS) after initialization before detecting OTel globals, allowing customer applications to initialize first. The detection timeout is unreferenced so it won't prevent process exit. (src/agent/agentLoader.ts) [1] [2]
  • The changelog has been updated to document this change. (CHANGELOG.md)

Testing Improvements:

  • Unit tests for the agent loader now use fake timers to simulate the OTel detection delay, ensuring reliable and accurate testing of the new behavior. (test/unitTests/agent/agentLoader.tests.ts) [1] [2] [3]
  • A new test verifies that OTel detection is delayed by 1 minute and only occurs after the timeout, checking both the detection call and the appropriate log messages. (test/unitTests/agent/agentLoader.tests.ts)

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.

1 participant