-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix tests, add docs, apply nits, fix types #10
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
import { of } from 'rxjs'; | ||
import type { AnalyticsClient } from '@kbn/analytics-client'; | ||
import { createAnalytics } from '@kbn/analytics-client'; | ||
import { registerMetricEventType } from '@kbn/ebt-tools'; | ||
import type { CoreContext } from '@kbn/core-base-browser-internal'; | ||
import type { InternalInjectedMetadataSetup } from '@kbn/core-injected-metadata-browser-internal'; | ||
import type { AnalyticsServiceSetup, AnalyticsServiceStart } from '@kbn/core-analytics-browser'; | ||
|
@@ -34,6 +35,8 @@ export class AnalyticsService { | |
}); | ||
|
||
this.registerBuildInfoAnalyticsContext(core); | ||
// Register special `metrics` type | ||
registerMetricEventType(this.analyticsClient); | ||
Comment on lines
+38
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The analytics service in core registers the metric type 😇 We can work on a follow up PR to move the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think it's critical, we already have a package. |
||
|
||
// We may eventually move the following to the client's package since they are not Kibana-specific | ||
// and can benefit other consumers of the client. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { AnalyticsClient } from '@kbn/analytics-client'; | ||
import { Subject } from 'rxjs'; | ||
|
||
export const analyticsClientMock: jest.Mocked<AnalyticsClient> = { | ||
optIn: jest.fn(), | ||
reportEvent: jest.fn(), | ||
registerEventType: jest.fn(), | ||
registerContextProvider: jest.fn(), | ||
removeContextProvider: jest.fn(), | ||
registerShipper: jest.fn(), | ||
telemetryCounter$: new Subject(), | ||
shutdown: jest.fn(), | ||
}; | ||
|
||
jest.doMock('@kbn/analytics-client', () => ({ | ||
createAnalytics: () => analyticsClientMock, | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the issue with the properties being forced to extend
Record<string, unknown>