-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Exploratory view] Fix core web vital breakdown (#104630)
Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
bde7455
commit 04c05f8
Showing
7 changed files
with
216 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...blic/components/shared/exploratory_view/configurations/rum/core_web_vitals_config.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { mockAppIndexPattern, mockIndexPattern } from '../../rtl_helpers'; | ||
import { getDefaultConfigs } from '../default_configs'; | ||
import { LayerConfig, LensAttributes } from '../lens_attributes'; | ||
import { sampleAttributeCoreWebVital } from '../test_data/sample_attribute_cwv'; | ||
import { SERVICE_NAME, USER_AGENT_OS } from '../constants/elasticsearch_fieldnames'; | ||
|
||
describe('Core web vital config test', function () { | ||
mockAppIndexPattern(); | ||
|
||
const seriesConfig = getDefaultConfigs({ | ||
reportType: 'core-web-vitals', | ||
dataType: 'ux', | ||
indexPattern: mockIndexPattern, | ||
}); | ||
|
||
let lnsAttr: LensAttributes; | ||
|
||
const layerConfig: LayerConfig = { | ||
seriesConfig, | ||
indexPattern: mockIndexPattern, | ||
reportDefinitions: { [SERVICE_NAME]: ['elastic-co'] }, | ||
time: { from: 'now-15m', to: 'now' }, | ||
breakdown: USER_AGENT_OS, | ||
}; | ||
|
||
beforeEach(() => { | ||
lnsAttr = new LensAttributes([layerConfig]); | ||
}); | ||
it('should return expected json', function () { | ||
expect(lnsAttr.getJSON()).toEqual(sampleAttributeCoreWebVital); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
...ublic/components/shared/exploratory_view/configurations/test_data/sample_attribute_cwv.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
export const sampleAttributeCoreWebVital = { | ||
description: '', | ||
references: [ | ||
{ | ||
id: 'apm-*', | ||
name: 'indexpattern-datasource-current-indexpattern', | ||
type: 'index-pattern', | ||
}, | ||
{ | ||
id: 'apm-*', | ||
name: 'indexpattern-datasource-layer-layer0', | ||
type: 'index-pattern', | ||
}, | ||
], | ||
state: { | ||
datasourceStates: { | ||
indexpattern: { | ||
layers: { | ||
layer0: { | ||
columnOrder: [ | ||
'x-axis-column-layer0', | ||
'y-axis-column-layer0', | ||
'y-axis-column-1', | ||
'y-axis-column-2', | ||
], | ||
columns: { | ||
'x-axis-column-layer0': { | ||
dataType: 'string', | ||
isBucketed: true, | ||
label: 'Top values of Operating system', | ||
operationType: 'terms', | ||
params: { | ||
missingBucket: false, | ||
orderBy: { | ||
columnId: 'y-axis-column-layer0', | ||
type: 'column', | ||
}, | ||
orderDirection: 'desc', | ||
otherBucket: true, | ||
size: 10, | ||
}, | ||
scale: 'ordinal', | ||
sourceField: 'user_agent.os.name', | ||
}, | ||
'y-axis-column-1': { | ||
dataType: 'number', | ||
filter: { | ||
language: 'kuery', | ||
query: | ||
'transaction.marks.agent.largestContentfulPaint > 2500 and transaction.marks.agent.largestContentfulPaint < 4000', | ||
}, | ||
isBucketed: false, | ||
label: 'Average', | ||
operationType: 'count', | ||
scale: 'ratio', | ||
sourceField: 'Records', | ||
}, | ||
'y-axis-column-2': { | ||
dataType: 'number', | ||
filter: { | ||
language: 'kuery', | ||
query: 'transaction.marks.agent.largestContentfulPaint > 4000', | ||
}, | ||
isBucketed: false, | ||
label: 'Poor', | ||
operationType: 'count', | ||
scale: 'ratio', | ||
sourceField: 'Records', | ||
}, | ||
'y-axis-column-layer0': { | ||
dataType: 'number', | ||
filter: { | ||
language: 'kuery', | ||
query: 'transaction.type: page-load and processor.event: transaction', | ||
}, | ||
isBucketed: false, | ||
label: 'Good', | ||
operationType: 'count', | ||
scale: 'ratio', | ||
sourceField: 'Records', | ||
}, | ||
}, | ||
incompleteColumns: {}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
filters: [], | ||
query: { | ||
language: 'kuery', | ||
query: '', | ||
}, | ||
visualization: { | ||
axisTitlesVisibilitySettings: { | ||
x: true, | ||
yLeft: true, | ||
yRight: true, | ||
}, | ||
curveType: 'CURVE_MONOTONE_X', | ||
fittingFunction: 'Linear', | ||
gridlinesVisibilitySettings: { | ||
x: true, | ||
yLeft: true, | ||
yRight: true, | ||
}, | ||
layers: [ | ||
{ | ||
accessors: ['y-axis-column-layer0', 'y-axis-column-1', 'y-axis-column-2'], | ||
layerId: 'layer0', | ||
seriesType: 'bar_horizontal_percentage_stacked', | ||
xAccessor: 'x-axis-column-layer0', | ||
yConfig: [ | ||
{ | ||
color: '#209280', | ||
forAccessor: 'y-axis-column', | ||
}, | ||
{ | ||
color: '#d6bf57', | ||
forAccessor: 'y-axis-column-1', | ||
}, | ||
{ | ||
color: '#cc5642', | ||
forAccessor: 'y-axis-column-2', | ||
}, | ||
], | ||
}, | ||
], | ||
legend: { | ||
isVisible: true, | ||
position: 'right', | ||
}, | ||
preferredSeriesType: 'line', | ||
tickLabelsVisibilitySettings: { | ||
x: true, | ||
yLeft: true, | ||
yRight: true, | ||
}, | ||
valueLabels: 'hide', | ||
}, | ||
}, | ||
title: 'Prefilled from exploratory view app', | ||
visualizationType: 'lnsXY', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters