central config: hande disable_instrumentations #510
Conversation
This implement disable_instrumentations using a rule based tracer configurator.
✅ Vale Linting ResultsNo issues found on modified lines! The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale. |
🔍 Preview links for changed docs |
Spotted by macroscope
📝 WalkthroughWalkthroughThis pull request introduces support for dynamically deactivating instrumentations in EDOT Python. The changes add a new updatable tracer configurator system with rule-based configuration that supports glob patterns for instrumentation scope matching. A new remote configuration key ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment Tip CodeRabbit can approve the review once all CodeRabbit's comments are resolved.Enable the |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/elasticotel/distro/config.py`:
- Around line 204-223: The code assumes deactivate_instrumentations is always a
string; update _rules_from_deactivate_instrumentations to validate the incoming
csv parameter (and the call site in _handle_deactivate_instrumentations) by
checking isinstance(value, str) before calling .split(",") and treating
non-string/None values as the empty string (or returning an empty rules list),
and add the same validation for the related logic referenced at lines ~286-289
so arrays/numbers/nulls won’t raise when parsed; reference
_rules_from_deactivate_instrumentations and _handle_deactivate_instrumentations
to locate where to add the type check and safe fallback.
- Around line 214-237: The handler currently ACKs success and drops the update
when _set_tracer_configurator is missing and unconditionally replaces any custom
configurator with tracer_configurator._updatable_tracer_configurator; change
_handle_deactivate_instrumentations so that if getattr(tracer_provider,
"_set_tracer_configurator", None) is None it returns a failing ConfigUpdate (do
not persist or claim success) and when rules have changed do not blindly call
set_tracer_configurator with _updatable_tracer_configurator if a different
configurator is already active — instead obtain current_tracer_configurator via
tracer_configurator._get_tracer_configurator(), compose a new configurator that
delegates to the existing configurator and applies the updated rules (or else
return a failing ConfigUpdate if composition is not possible), only clear the
cache and call tracer_configurator._updatable_tracer_configurator /
set_tracer_configurator after successful composition, and only then persist via
_get_config().deactivate_instrumentations.update and return a success
ConfigUpdate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5c72610c-9e7a-4805-a1ae-bd923688edf8
📒 Files selected for processing (8)
docs/reference/edot-python/configuration.mddocs/reference/edot-python/supported-technologies.mdpyproject.tomlsrc/elasticotel/distro/__init__.pysrc/elasticotel/distro/config.pysrc/elasticotel/sdk/trace/__init__.pysrc/elasticotel/sdk/trace/tracer_configurator.pytests/distro/test_distro.py
The Python implementation supports globbing and has way longer instrumentations names. Refs elastic/elastic-otel-python#510
…59003) ## Summary Make `deactivate_instrumentations`available also to EDOT Python agents. The Python implementation supports globbing and has way longer instrumentations names. Refs elastic/elastic-otel-python#510 <img width="2013" height="743" alt="Schermata del 2026-03-23 09-38-39" src="https://github.com/user-attachments/assets/7930ee03-4dc7-4f43-bf43-37f926c4f2cf" /> The short link resolves to: <img width="1447" height="540" alt="Schermata del 2026-03-23 09-39-02" src="https://github.com/user-attachments/assets/25f4621d-23f5-4d7b-a02c-1799c5f440b1" /> ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks <!--Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.--> No risk introduced --------- Co-authored-by: kibanamachine <[email protected]>
…astic#259003) ## Summary Make `deactivate_instrumentations`available also to EDOT Python agents. The Python implementation supports globbing and has way longer instrumentations names. Refs elastic/elastic-otel-python#510 <img width="2013" height="743" alt="Schermata del 2026-03-23 09-38-39" src="https://github.com/user-attachments/assets/7930ee03-4dc7-4f43-bf43-37f926c4f2cf" /> The short link resolves to: <img width="1447" height="540" alt="Schermata del 2026-03-23 09-39-02" src="https://github.com/user-attachments/assets/25f4621d-23f5-4d7b-a02c-1799c5f440b1" /> ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks <!--Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.--> No risk introduced --------- Co-authored-by: kibanamachine <[email protected]>
What does this pull request do?
This implement
disable_instrumentationscentral config option using a rule based tracer configurator.Related issues
Fixed #509