* memory * jest test * typo Co-authored-by: Liza Katz <lizka.k@gmail.com>
This commit is contained in:
parent
b05ee6ddca
commit
a94d4cc5de
|
@ -136,16 +136,31 @@ describe('Cloud Plugin', () => {
|
|||
expect(fullStoryApiMock.identify).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('calls FS.event when security is available', async () => {
|
||||
const { initContext } = await setupPlugin({
|
||||
config: { full_story: { enabled: true, org_id: 'foo' } },
|
||||
currentUserProps: {
|
||||
username: '1234',
|
||||
},
|
||||
describe('with memory', () => {
|
||||
beforeAll(() => {
|
||||
// @ts-expect-error
|
||||
window.performance.memory = {
|
||||
someMetric: 1,
|
||||
};
|
||||
});
|
||||
|
||||
expect(fullStoryApiMock.event).toHaveBeenCalledWith('Loaded Kibana', {
|
||||
kibana_version_str: initContext.env.packageInfo.version,
|
||||
afterAll(() => {
|
||||
// @ts-expect-error
|
||||
delete window.performance.memory;
|
||||
});
|
||||
|
||||
it('calls FS.event when security is available', async () => {
|
||||
const { initContext } = await setupPlugin({
|
||||
config: { full_story: { enabled: true, org_id: 'foo' } },
|
||||
currentUserProps: {
|
||||
username: '1234',
|
||||
},
|
||||
});
|
||||
|
||||
expect(fullStoryApiMock.event).toHaveBeenCalledWith('Loaded Kibana', {
|
||||
kibana_version_str: initContext.env.packageInfo.version,
|
||||
some_metric_int: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import {
|
|||
} from 'src/core/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { mapKeys, snakeCase } from 'lodash';
|
||||
import type {
|
||||
AuthenticatedUser,
|
||||
SecurityPluginSetup,
|
||||
|
@ -248,10 +249,17 @@ export class CloudPlugin implements Plugin<CloudSetup> {
|
|||
);
|
||||
}
|
||||
|
||||
// Get performance information from the browser (non standard property
|
||||
const memoryInfo = mapKeys(
|
||||
// @ts-expect-error
|
||||
window.performance.memory || {},
|
||||
(_, key) => `${snakeCase(key)}_int`
|
||||
);
|
||||
// Record an event that Kibana was opened so we can easily search for sessions that use Kibana
|
||||
fullStory.event('Loaded Kibana', {
|
||||
// `str` suffix is required, see docs: https://help.fullstory.com/hc/en-us/articles/360020623234
|
||||
kibana_version_str: this.initializerContext.env.packageInfo.version,
|
||||
...memoryInfo,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue