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

[Application Usage] Remove deprecated & unused legacy.appChanged API #91464

Merged
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
3 changes: 0 additions & 3 deletions src/plugins/usage_collection/public/mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ const createSetupContract = (): Setup => {
allowTrackUserAgent: jest.fn(),
reportUiCounter: jest.fn(),
METRIC_TYPE,
__LEGACY: {
appChanged: jest.fn(),
},
};

return setupContract;
Expand Down
25 changes: 6 additions & 19 deletions src/plugins/usage_collection/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
*/

import { Reporter, METRIC_TYPE, ApplicationUsageTracker } from '@kbn/analytics';
import { Subject, merge, Subscription } from 'rxjs';
import type { Subscription } from 'rxjs';
import React from 'react';
import { Storage } from '../../kibana_utils/public';
import { createReporter, trackApplicationUsageChange } from './services';
import {
import type {
PluginInitializerContext,
Plugin,
CoreSetup,
CoreStart,
HttpSetup,
} from '../../../core/public';
} from 'src/core/public';
import { Storage } from '../../kibana_utils/public';
import { createReporter, trackApplicationUsageChange } from './services';
import { ApplicationUsageContext } from './components/track_application_view';

export interface PublicConfigType {
Expand All @@ -39,15 +39,6 @@ export interface UsageCollectionSetup {
applicationUsageTracker: IApplicationUsageTracker;
reportUiCounter: Reporter['reportUiCounter'];
METRIC_TYPE: typeof METRIC_TYPE;
__LEGACY: {
/**
* Legacy handler so we can report the actual app being used inside "kibana#/{appId}".
* To be removed when we get rid of the legacy world
*
* @deprecated
*/
appChanged: (appId: string) => void;
};
}

export interface UsageCollectionStart {
Expand All @@ -65,7 +56,6 @@ export function isUnauthenticated(http: HttpSetup) {
}

export class UsageCollectionPlugin implements Plugin<UsageCollectionSetup, UsageCollectionStart> {
private readonly legacyAppId$ = new Subject<string>();
private applicationUsageTracker?: ApplicationUsageTracker;
private trackUserAgent: boolean = true;
private subscriptions: Subscription[] = [];
Expand Down Expand Up @@ -103,9 +93,6 @@ export class UsageCollectionPlugin implements Plugin<UsageCollectionSetup, Usage
},
reportUiCounter: this.reporter.reportUiCounter,
METRIC_TYPE,
__LEGACY: {
appChanged: (appId) => this.legacyAppId$.next(appId),
},
};
}

Expand All @@ -118,7 +105,7 @@ export class UsageCollectionPlugin implements Plugin<UsageCollectionSetup, Usage
this.reporter.start();
this.applicationUsageTracker.start();
this.subscriptions = trackApplicationUsageChange(
merge(application.currentAppId$, this.legacyAppId$),
application.currentAppId$,
this.applicationUsageTracker
);
}
Expand Down