[Telemetry] Swallow errors in opt-in remote notification from the server (#75641)

This commit is contained in:
Alejandro Fernández Haro 2020-08-24 17:28:19 +01:00 committed by GitHub
parent 9fa43b4e47
commit f49f010d90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View file

@ -89,6 +89,7 @@ export class TelemetryPlugin implements Plugin {
config$,
currentKibanaVersion,
isDev,
logger: this.logger,
router,
telemetryCollectionManager,
});

View file

@ -18,7 +18,7 @@
*/
import { Observable } from 'rxjs';
import { IRouter } from 'kibana/server';
import { IRouter, Logger } from 'kibana/server';
import { TelemetryCollectionManagerPluginSetup } from 'src/plugins/telemetry_collection_manager/server';
import { registerTelemetryOptInRoutes } from './telemetry_opt_in';
import { registerTelemetryUsageStatsRoutes } from './telemetry_usage_stats';
@ -28,6 +28,7 @@ import { TelemetryConfigType } from '../config';
interface RegisterRoutesParams {
isDev: boolean;
logger: Logger;
config$: Observable<TelemetryConfigType>;
currentKibanaVersion: string;
router: IRouter;

View file

@ -21,7 +21,7 @@ import moment from 'moment';
import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { schema } from '@kbn/config-schema';
import { IRouter } from 'kibana/server';
import { IRouter, Logger } from 'kibana/server';
import {
StatsGetterConfig,
TelemetryCollectionManagerPluginSetup,
@ -39,12 +39,14 @@ import { TelemetryConfigType } from '../config';
interface RegisterOptInRoutesParams {
currentKibanaVersion: string;
router: IRouter;
logger: Logger;
config$: Observable<TelemetryConfigType>;
telemetryCollectionManager: TelemetryCollectionManagerPluginSetup;
}
export function registerTelemetryOptInRoutes({
config$,
logger,
router,
currentKibanaVersion,
telemetryCollectionManager,
@ -95,11 +97,16 @@ export function registerTelemetryOptInRoutes({
if (config.sendUsageFrom === 'server') {
const optInStatusUrl = config.optInStatusUrl;
await sendTelemetryOptInStatus(
sendTelemetryOptInStatus(
telemetryCollectionManager,
{ optInStatusUrl, newOptInStatus },
statsGetterConfig
);
).catch((err) => {
// The server is likely behind a firewall and can't reach the remote service
logger.warn(
`Failed to notify "${optInStatusUrl}" from the server about the opt-in selection. Possibly blocked by a firewall? - Error: ${err.message}`
);
});
}
await updateTelemetrySavedObject(context.core.savedObjects.client, attributes);