Skip to content

Commit

Permalink
Revert Telemetry deep cleaning (#24)
Browse files Browse the repository at this point in the history
* Revert "Add missing brace lost during merge conflict (#22)"

This reverts commit c6db074.

* Revert "[PURIFY] usageCollector removal of ui metrics reporting (#10) (#18)"

This reverts commit f7243ff.

Signed-off-by: Peter Nied <petern@amazon.com>
  • Loading branch information
mihirsoni authored and peternied committed Mar 13, 2021
1 parent e6fcfb6 commit 470e6c0
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 24 deletions.
17 changes: 13 additions & 4 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"interpreter": "src/legacy/core_plugins/interpreter",
"kbn": "src/legacy/core_plugins/kibana",
"kbnDocViews": "src/legacy/core_plugins/kbn_doc_views",
"management": ["src/legacy/core_plugins/management", "src/plugins/management"],
"management": [
"src/legacy/core_plugins/management",
"src/plugins/management"
],
"maps_legacy": "src/plugins/maps_legacy",
"indexPatternManagement": "src/plugins/index_pattern_management",
"advancedSettings": "src/plugins/advanced_settings",
Expand All @@ -39,7 +42,10 @@
"security": "src/plugins/security_oss",
"server": "src/legacy/server",
"statusPage": "src/legacy/core_plugins/status_page",
"telemetry": ["src/plugins/telemetry", "src/plugins/telemetry_management_section"],
"telemetry": [
"src/plugins/telemetry",
"src/plugins/telemetry_management_section"
],
"tileMap": "src/plugins/tile_map",
"timelion": ["src/plugins/timelion", "src/plugins/vis_type_timelion"],
"uiActions": "src/plugins/ui_actions",
Expand All @@ -54,8 +60,11 @@
"visTypeXy": "src/plugins/vis_type_xy",
"visualizations": "src/plugins/visualizations",
"visualize": "src/plugins/visualize",
"apmOss": "src/plugins/apm_oss"
"apmOss": "src/plugins/apm_oss",
"usageCollection": "src/plugins/usage_collection"
},
"exclude": ["src/legacy/ui/ui_render/ui_render_mixin.js"],
"exclude": [
"src/legacy/ui/ui_render/ui_render_mixin.js"
],
"translations": []
}
6 changes: 3 additions & 3 deletions packages/kbn-analytics/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class Reporter {
checkInterval: number;
private interval?: NodeJS.Timer;
private lastAppId?: string;
// private http: ReportHTTP;
private http: ReportHTTP;
private reportManager: ReportManager;
private storageManager: ReportStorageManager;
private readonly applicationUsage: ApplicationUsage;
Expand All @@ -48,8 +48,8 @@ export class Reporter {
private started = false;

constructor(config: ReporterConfig) {
const { storage, debug, checkInterval = 90000, storageKey = 'analytics' } = config;
// this.http = http;
const { http, storage, debug, checkInterval = 90000, storageKey = 'analytics' } = config;
this.http = http;
this.checkInterval = checkInterval;
this.applicationUsage = new ApplicationUsage();
this.storageManager = new ReportStorageManager(storageKey, storage);
Expand Down
15 changes: 11 additions & 4 deletions src/plugins/data/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
"version": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["expressions", "uiActions"],
"optionalPlugins": [],
"requiredPlugins": [
"expressions",
"uiActions"
],
"optionalPlugins": ["usageCollection"],
"extraPublicDirs": ["common", "common/utils/abort_utils"],
"requiredBundles": ["kibanaUtils", "kibanaReact", "inspector"]
"requiredBundles": [
"usageCollection",
"kibanaUtils",
"kibanaReact",
"inspector"
]
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { SEARCH_EVENT_TYPE, SearchUsageCollector } from './types';
import { METRIC_TYPE } from '@kbn/analytics';
import { from } from 'rxjs';

describe.skip('Search Usage Collector', () => {
describe('Search Usage Collector', () => {
let mockCoreSetup: MockedKeys<CoreSetup>;
let mockUsageCollectionSetup: Setup;
let usageCollector: SearchUsageCollector;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/collectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
* under the License.
*/

// export { createUsageCollector } from './create_usage_collector';
export { createUsageCollector } from './create_usage_collector';
export { SEARCH_EVENT_TYPE, SearchUsageCollector } from './types';
4 changes: 2 additions & 2 deletions src/plugins/data/public/search/search_interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
ISearchOptions,
ES_SEARCH_STRATEGY,
} from '../../common';
// import { SearchUsageCollector } from './collectors';
import { SearchUsageCollector } from './collectors';
import { SearchTimeoutError, PainlessError, isPainlessError, TimeoutErrorMode } from './errors';
import { toMountPoint } from '../../../kibana_react/public';

Expand All @@ -38,7 +38,7 @@ export interface SearchInterceptorDeps {
uiSettings: CoreSetup['uiSettings'];
startServices: Promise<[CoreStart, any, unknown]>;
toasts: ToastsSetup;
// usageCollector?: SearchUsageCollector;
usageCollector?: SearchUsageCollector;
}

export class SearchInterceptor {
Expand Down
17 changes: 8 additions & 9 deletions src/plugins/data/public/search/search_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import { getCallMsearch } from './legacy';
import { AggsService, AggsStartDependencies } from './aggs';
import { IndexPatternsContract } from '../index_patterns/index_patterns';
import { ISearchInterceptor, SearchInterceptor } from './search_interceptor';
// import { SearchUsageCollector, createUsageCollector } from './collectors';
// import { UsageCollectionSetup } from '../../../usage_collection/public';
import { SearchUsageCollector, createUsageCollector } from './collectors';
import { UsageCollectionSetup } from '../../../usage_collection/public';
import { esdsl, esRawResponse } from './expressions';
import { ExpressionsSetup } from '../../../expressions/public';
import { ConfigSchema } from '../../config';
Expand All @@ -50,7 +50,7 @@ import { aggShardDelay } from '../../common/search/aggs/buckets/shard_delay_fn';
/** @internal */
export interface SearchServiceSetupDependencies {
expressions: ExpressionsSetup;
// usageCollection?: UsageCollectionSetup;
usageCollection?: UsageCollectionSetup;
}

/** @internal */
Expand All @@ -63,16 +63,15 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
private readonly aggsService = new AggsService();
private readonly searchSourceService = new SearchSourceService();
private searchInterceptor!: ISearchInterceptor;
// private usageCollector?: SearchUsageCollector;
private usageCollector?: SearchUsageCollector;

constructor(private initializerContext: PluginInitializerContext<ConfigSchema>) {}

public setup(
{ http, getStartServices, notifications, uiSettings }: CoreSetup,
// { expressions, usageCollection }: SearchServiceSetupDependencies
{ expressions }: SearchServiceSetupDependencies
{ expressions, usageCollection }: SearchServiceSetupDependencies
): ISearchSetup {
// this.usageCollector = createUsageCollector(getStartServices, usageCollection);
this.usageCollector = createUsageCollector(getStartServices, usageCollection);

/**
* A global object that intercepts all searches and provides convenience methods for cancelling
Expand All @@ -83,7 +82,7 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
http,
uiSettings,
startServices: getStartServices(),
usageCollector: undefined, // this.usageCollector!,
usageCollector: this.usageCollector!,
});

expressions.registerFunction(esdsl);
Expand All @@ -101,7 +100,7 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {

return {
aggs,
usageCollector: undefined, // this.usageCollector!,
usageCollector: this.usageCollector!,
__enhance: (enhancements: SearchEnhancements) => {
this.searchInterceptor = enhancements.searchInterceptor;
},
Expand Down
File renamed without changes.

0 comments on commit 470e6c0

Please sign in to comment.