Skip to content

Commit f29056d

Browse files
[Exploratory view] Fix mobile device distribution (#104626) (#104914)
Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
1 parent 3bed944 commit f29056d

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/constants/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
TAGS_LABEL,
4545
TBT_LABEL,
4646
URL_LABEL,
47+
BACKEND_TIME_LABEL,
4748
} from './labels';
4849

4950
export const DEFAULT_TIME = { from: 'now-1h', to: 'now' };
@@ -66,7 +67,7 @@ export const FieldLabels: Record<string, string> = {
6667
[TBT_FIELD]: TBT_LABEL,
6768
[FID_FIELD]: FID_LABEL,
6869
[CLS_FIELD]: CLS_LABEL,
69-
[TRANSACTION_TIME_TO_FIRST_BYTE]: 'Page load time',
70+
[TRANSACTION_TIME_TO_FIRST_BYTE]: BACKEND_TIME_LABEL,
7071

7172
'monitor.id': MONITOR_ID_LABEL,
7273
'monitor.status': MONITOR_STATUS_LABEL,

x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ describe('Lens Attribute', () => {
411411
sourceField: USER_AGENT_NAME,
412412
layerId: 'layer0',
413413
indexPattern: mockIndexPattern,
414+
labels: layerConfig.seriesConfig.labels,
414415
});
415416

416417
expect(lnsAttr.visualization.layers).toEqual([

x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/lens_attributes.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
import { urlFiltersToKueryString } from '../utils/stringify_kueries';
3131
import { ExistsFilter, IndexPattern } from '../../../../../../../../src/plugins/data/common';
3232
import {
33-
FieldLabels,
3433
FILTER_RECORDS,
3534
USE_BREAK_DOWN_COLUMN,
3635
TERMS_COLUMN,
@@ -125,17 +124,19 @@ export class LensAttributes {
125124
getBreakdownColumn({
126125
sourceField,
127126
layerId,
127+
labels,
128128
indexPattern,
129129
}: {
130130
sourceField: string;
131131
layerId: string;
132+
labels: Record<string, string>;
132133
indexPattern: IndexPattern;
133134
}): TermsIndexPatternColumn {
134135
const fieldMeta = indexPattern.getFieldByName(sourceField);
135136

136137
return {
137138
sourceField,
138-
label: `Top values of ${FieldLabels[sourceField]}`,
139+
label: `Top values of ${labels[sourceField]}`,
139140
dataType: fieldMeta?.type as DataType,
140141
operationType: 'terms',
141142
scale: 'ordinal',
@@ -304,6 +305,7 @@ export class LensAttributes {
304305
layerId,
305306
indexPattern: layerConfig.indexPattern,
306307
sourceField: layerConfig.breakdown || layerConfig.seriesConfig.breakdownFields[0],
308+
labels: layerConfig.seriesConfig.labels,
307309
});
308310
}
309311

@@ -590,6 +592,7 @@ export class LensAttributes {
590592
layerId,
591593
sourceField: breakdown,
592594
indexPattern: layerConfig.indexPattern,
595+
labels: layerConfig.seriesConfig.labels,
593596
}),
594597
}
595598
: {}),

x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/mobile/device_distribution_config.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { ConfigProps, SeriesConfig } from '../../types';
9-
import { FieldLabels, USE_BREAK_DOWN_COLUMN } from '../constants';
9+
import { FieldLabels, REPORT_METRIC_FIELD, USE_BREAK_DOWN_COLUMN } from '../constants';
1010
import { buildPhraseFilter } from '../utils';
1111
import { SERVICE_NAME } from '../constants/elasticsearch_fieldnames';
1212
import { MOBILE_APP, NUMBER_OF_DEVICES } from '../constants/labels';
@@ -22,9 +22,8 @@ export function getMobileDeviceDistributionConfig({ indexPattern }: ConfigProps)
2222
},
2323
yAxisColumns: [
2424
{
25-
sourceField: 'labels.device_id',
25+
sourceField: REPORT_METRIC_FIELD,
2626
operationType: 'unique_count',
27-
label: NUMBER_OF_DEVICES,
2827
},
2928
],
3029
hasOperationType: false,
@@ -39,6 +38,13 @@ export function getMobileDeviceDistributionConfig({ indexPattern }: ConfigProps)
3938
...MobileFields,
4039
[SERVICE_NAME]: MOBILE_APP,
4140
},
41+
metricOptions: [
42+
{
43+
id: 'labels.device_id',
44+
field: 'labels.device_id',
45+
label: NUMBER_OF_DEVICES,
46+
},
47+
],
4248
definitionFields: [SERVICE_NAME],
4349
};
4450
}

x-pack/plugins/observability/public/components/shared/exploratory_view/configurations/mobile/distribution_config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { ConfigProps, SeriesConfig } from '../../types';
9-
import { FieldLabels, OPERATION_COLUMN, RECORDS_FIELD, REPORT_METRIC_FIELD } from '../constants';
9+
import { FieldLabels, RECORDS_FIELD, REPORT_METRIC_FIELD } from '../constants';
1010
import { buildPhrasesFilter } from '../utils';
1111
import {
1212
METRIC_SYSTEM_CPU_USAGE,
@@ -49,19 +49,16 @@ export function getMobileKPIDistributionConfig({ indexPattern }: ConfigProps): S
4949
label: RESPONSE_LATENCY,
5050
field: TRANSACTION_DURATION,
5151
id: TRANSACTION_DURATION,
52-
columnType: OPERATION_COLUMN,
5352
},
5453
{
5554
label: MEMORY_USAGE,
5655
field: METRIC_SYSTEM_MEMORY_USAGE,
5756
id: METRIC_SYSTEM_MEMORY_USAGE,
58-
columnType: OPERATION_COLUMN,
5957
},
6058
{
6159
label: CPU_USAGE,
6260
field: METRIC_SYSTEM_CPU_USAGE,
6361
id: METRIC_SYSTEM_CPU_USAGE,
64-
columnType: OPERATION_COLUMN,
6562
},
6663
],
6764
};

0 commit comments

Comments
 (0)