[Telemetry] Log opt-in status at the INFO level (#158830)

This commit is contained in:
Alejandro Fernández Haro 2023-06-02 22:59:04 +02:00 committed by GitHub
parent 076b470e37
commit 18e145ccb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View file

@ -767,5 +767,8 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
synthetics: {
featureRoles: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/synthetics-feature-roles.html`,
},
telemetry: {
settings: `${KIBANA_DOCS}telemetry-settings-kbn.html`,
},
});
};

View file

@ -536,4 +536,7 @@ export interface DocLinks {
readonly synthetics: {
readonly featureRoles: string;
};
readonly telemetry: {
readonly settings: string;
};
}

View file

@ -149,9 +149,16 @@ export class TelemetryPlugin implements Plugin<TelemetryPluginSetup, TelemetryPl
}
public setup(
{ analytics, http, savedObjects }: CoreSetup,
{ analytics, docLinks, http, savedObjects }: CoreSetup,
{ usageCollection, telemetryCollectionManager }: TelemetryPluginsDepsSetup
): TelemetryPluginSetup {
this.isOptedIn$.subscribe((optedIn) => {
const optInStatusMsg = optedIn ? 'enabled' : 'disabled';
this.logger.info(
`Telemetry collection is ${optInStatusMsg}. For more information on telemetry settings, refer to ${docLinks.links.telemetry.settings}.`
);
});
if (this.isOptedIn !== undefined) {
analytics.optIn({ global: { enabled: this.isOptedIn } });
}