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

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

Merged
merged 1 commit into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/plugins/telemetry/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class TelemetryPlugin implements Plugin {
config$,
currentKibanaVersion,
isDev,
logger: this.logger,
router,
telemetryCollectionManager,
});
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/telemetry/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -28,6 +28,7 @@ import { TelemetryConfigType } from '../config';

interface RegisterRoutesParams {
isDev: boolean;
logger: Logger;
config$: Observable<TelemetryConfigType>;
currentKibanaVersion: string;
router: IRouter;
Expand Down
13 changes: 10 additions & 3 deletions src/plugins/telemetry/server/routes/telemetry_opt_in.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down