Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Telemetry] Make telemetry plugin non-disableable #133205

Merged
merged 2 commits into from
Jun 27, 2022

Conversation

afharo
Copy link
Member

@afharo afharo commented May 31, 2022

Summary

Resolves #129015.

Some conversations around #129015 led to highlight the reasons for deprecating telemetry.enabled: false are purely technical and they shouldn't affect how the feature works from the users' POV.

This PR internally converts telemetry.enabled: false to telemetry.optIn: false + telemetry.allowChangingOptInStatus: false without actually disabling the telemetry plugin. Both flags should provide feature parity without disabling the plugin.

Why do we not want to disable the plugin?

The reasoning is already explained in #129015, but the main reasons are:

  1. Saved Objects migrations won't fail in deployments where telemetry was previously enabled.
  2. We don't need a workaround to call optIn(false) in EBT.

Checklist

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Users might be concerned that they can see in the logs that the plugin is still enabled and the bundles loaded in the UI when they set telemetry.enabled: false Medium Low Documentation making clear that telemetry.optIn: false doesn't send any data to Elastic should address those concerns.
External consumers hitting the HTTP API POST /api/telemetry/v2/clusters/_stats may generate a high load Low High It's an undocumented API, and should not be used. If a user is polling that API, they can simply configure their external systems to stop polling it.

For maintainers

@afharo afharo added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Telemetry release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v8.4.0 labels May 31, 2022
@afharo afharo force-pushed the non-disableable-telemetry-plugin branch 6 times, most recently from 7f8c000 to 532f94a Compare June 1, 2022 15:28
@afharo afharo force-pushed the non-disableable-telemetry-plugin branch from 532f94a to bd8bc03 Compare June 24, 2022 16:26
Comment on lines -21 to -25
[[telemetry-enabled]] `telemetry.enabled`::
Set to `true` to send cluster statistics to Elastic. Reporting your
cluster statistics helps us improve your user experience. Your data is never
shared with anyone. Set to `false` to disable statistics reporting from any
browser connected to the {kib} instance. Defaults to `true`.
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing documentation for telemetry.enabled so users are not tempted to use it. Even when we are not "officially" deprecating them and it will work if they set it.

Is this OK?

Comment on lines -13 to -15
"optionalPlugins": [
"telemetry"
]
Copy link
Member Author

Choose a reason for hiding this comment

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

The workaround is no-longer needed 😇

import { plugin } from '.';

describe('kibana_usage_collection/public', () => {
const pluginInstance = plugin();

describe('optIn fallback from telemetry', () => {
test('should call optIn(false) when telemetry is disabled', () => {
describe('EBT stats -> UI Counters', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't want to leave this test file empty, so I repurposed the tests to validate another piece of logic in the plugin.

Comment on lines +50 to +60
(cfg) => {
if (cfg.telemetry?.enabled === false) {
return {
set: [
{ path: 'telemetry.optIn', value: false },
{ path: 'telemetry.allowChangingOptInStatus', value: false },
],
unset: [{ path: 'telemetry.enabled' }],
};
}
},
Copy link
Member Author

Choose a reason for hiding this comment

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

Using a custom config deprecation provider to be able to set 2 values out of 1 and to avoid logging any deprecation warning (hence not showing the warning in the Upgrade Assistant).

@afharo afharo marked this pull request as ready for review June 24, 2022 17:43
@afharo afharo requested review from a team as code owners June 24, 2022 17:43
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

Copy link
Member

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

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

Changes in expectedExposedConfigKeys LGTM.

@afharo
Copy link
Member Author

afharo commented Jun 27, 2022

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kibanaUsageCollection 1.5KB 1.4KB -55.0B
Unknown metric groups

API count

id before after diff
telemetry 44 43 -1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

Got a question, apart that LGTM

Comment on lines -24 to -27
if (!telemetry) {
// If the telemetry plugin is disabled, let's set optIn false to flush the queues.
coreSetup.analytics.optIn({ global: { enabled: false } });
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we base this on telemetry.optIn now?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was a fallback to overcome that telemetry was disabled and wouldn't call analytics.optIn(false) so that EBT would stop holding the events until an optIn response was provided.

Since the telemetry plugin cannot be disabled now, it will always call analytics.optIn(true|false) so we don't need this workaround anymore.

Comment on lines -79 to -82
if (!telemetry) {
// If the telemetry plugin is disabled, let's set optIn false to flush the queues.
coreSetup.analytics.optIn({ global: { enabled: false } });
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here?

@afharo afharo merged commit 2410b87 into elastic:main Jun 27, 2022
@afharo afharo deleted the non-disableable-telemetry-plugin branch June 27, 2022 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Telemetry release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate telemetry.enabled: false
6 participants