[9.4] Gracefully handle deprecated telemetry config (#266029)#266169
Merged
kibanamachine merged 1 commit intoelastic:9.4from Apr 28, 2026
Merged
[9.4] Gracefully handle deprecated telemetry config (#266029)#266169kibanamachine merged 1 commit intoelastic:9.4from
kibanamachine merged 1 commit intoelastic:9.4from
Conversation
## Summary Informed from [internal slack thread](https://elastic.slack.com/archives/C0D8P2XK5/p1777023957119899) `telemetry.enabled` is a deprecated config key. Its intended migration path is to translate a value of `false` into `telemetry.optIn: false` + `telemetry.allowChangingOptInStatus: false` and then remove the key, so that the telemetry plugin itself continues to load while honoring the user's intent to opt out. This allows dependent plugins — including `security_solution`, `fleet`, and others that declare `telemetry` as a `requiredPlugin` — to continue functioning normally. ## The bug The deprecation handler was checking for the disabled case with strict equality: ```ts if (cfg.telemetry?.enabled === false) { ... } ``` This did not account for the string `"false"`, which is a valid YAML value and one that `@kbn/config-schema`'s `schema.boolean()` type explicitly coerces to the boolean `false`. The two systems run at different moments in the startup pipeline: 1. **Deprecations run first**, against the raw, pre-schema config object coming directly from `kibana.yml`. At this point `"false"` is still a string, so `"false" === false` evaluates to `false` and the migration is silently skipped. 2. **Schema validation runs second**, inside `ConfigService.isEnabledAtPath`. Here `schema.boolean()` coerces the string `"false"` to the boolean `false`, causing `isEnabledAtPath` to return `false` and mark the plugin as disabled. Because the plugin is disabled, every plugin that lists `telemetry` in its `requiredPlugins` is also transitively disabled — including `security_solution`, making it completely non-functional with no obvious error pointing to the root cause. ## The fix The deprecation handler is updated to match any value that `schema.boolean()` would coerce to `false` — both the native boolean and any case-insensitive string variant — before schema validation has a chance to run, this ensures the migration fires regardless of how the value is expressed in `kibana.yml` (`false`, `"false"`, `"False"`, `"FALSE"`), removes `telemetry.enabled` from the config before `isEnabledAtPath` inspects it, and applies the correct opt-out semantics via `optIn` and `allowChangingOptInStatus`. The OpenTelemetry sub-configs (`tracing.enabled`, `metrics.enabled`) are also set to `false` for consistency. ## Tests A new `deprecations: telemetry.enabled` suite is added to `config.test.ts`. It drives the deprecation function directly through `applyDeprecations` (the same code path core uses at startup), and asserts: - All four falsy variants (`false`, `"false"`, `"False"`, `"FALSE"`) trigger the migration, unset `enabled`, and correctly populate `optIn`, `allowChangingOptInStatus`, `tracing.enabled`, and `metrics.enabled`. - Absent or truthy values (`undefined`, `true`, `"true"`, `"True"`, `"TRUE"`) leave the config unchanged. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 6f3c889)
Contributor
Author
💚 Build Succeeded
Metrics [docs]
cc @eokoneyo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.4:Questions ?
Please refer to the Backport tool documentation