Skip to content

Comments

Add DI circuit breaker test#6362

Draft
p-datadog wants to merge 4 commits intomainfrom
di-circuit-breaker
Draft

Add DI circuit breaker test#6362
p-datadog wants to merge 4 commits intomainfrom
di-circuit-breaker

Conversation

@p-datadog
Copy link
Member

@p-datadog p-datadog commented Feb 20, 2026

Motivation

Dynamic Instrumentation's circuit breaker automatically disables probes that consume too much CPU time to protect application performance. The Ruby tracer recently added environment variable support for configuring the circuit breaker timeout.

This PR adds system tests for the circuit breaker feature:

  1. Adds circuit breaker environment variables to scenarios (DD_DYNAMIC_INSTRUMENTATION_CAPTURE_TIMEOUT for Java/Ruby, DD_DYNAMIC_INSTRUMENTATION_CAPTURE_TIMEOUT_MS for Node)
  2. Adds a new circuit breaker test for Ruby (with @missing_feature decorator for other languages)

Related Ruby Tracer PR: DataDog/dd-trace-rb#5386

Changes

Added Environment Variables (utils/_context/_scenarios/__init__.py)

Added circuit breaker configuration to scenarios for cross-language support:

  • debugger_probes_snapshot: Added DD_DYNAMIC_INSTRUMENTATION_CAPTURE_TIMEOUT="-1" (Java/Ruby) and DD_DYNAMIC_INSTRUMENTATION_CAPTURE_TIMEOUT_MS="-1" (Node) to disable circuit breaker during capture limits tests
  • debugger_circuit_breaker: New scenario with both variables set to "0" to trip circuit breaker immediately for testing

New Test (tests/debugger/test_debugger_circuit_breaker.py)

Added comprehensive circuit breaker test that:

  • Calls instrumented endpoint twice
  • Asserts exactly ONE snapshot captured (circuit breaker prevents second)
  • Asserts probe reaches ERROR status
  • Asserts diagnostic payload contains exception field with circuit breaker message
  • Currently Ruby-only with @missing_feature decorator for other languages

New Feature Decorator (utils/_features.py)

Added @features.debugger_circuit_breaker decorator with feature_id=None - needs Feature Parity Dashboard registration

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?
    • Get a review from R&P team - Yes, added debugger_circuit_breaker scenario

@github-actions
Copy link
Contributor

CODEOWNERS have been resolved as:

tests/debugger/test_debugger_circuit_breaker.py                         @DataDog/debugger @DataDog/system-tests-core
utils/_context/_scenarios/__init__.py                                   @DataDog/system-tests-core
utils/_features.py                                                      @DataDog/system-tests-core

@p-datadog p-datadog changed the title Update DI circuit breaker environment variables and add test Add DI circuit breaker test and environment variables Feb 20, 2026
@p-datadog p-datadog changed the title Add DI circuit breaker test and environment variables Add DI circuit breaker test Feb 20, 2026
Unicorn Enterprises added 2 commits February 20, 2026 17:40
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