Skip to content
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

[7.9] [UI Metrics] Support multi-colon keys (#76913) #77029

Merged
merged 1 commit into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ describe('telemetry_ui_metric', () => {
{ id: 'testAppName:testKeyName1', attributes: { count: 3 } },
{ id: 'testAppName:testKeyName2', attributes: { count: 5 } },
{ id: 'testAppName2:testKeyName3', attributes: { count: 1 } },
{
id:
'kibana-user_agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:80.0) Gecko/20100101 Firefox/80.0',
attributes: { count: 1 },
},
],
total: 3,
} as any;
Expand All @@ -86,6 +91,12 @@ describe('telemetry_ui_metric', () => {
{ key: 'testKeyName2', value: 5 },
],
testAppName2: [{ key: 'testKeyName3', value: 1 }],
'kibana-user_agent': [
{
key: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:80.0) Gecko/20100101 Firefox/80.0',
value: 1,
},
],
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ export function registerUiMetricUsageCollector(
attributes: { count },
} = rawUiMetric;

const [appName, metricType] = id.split(':');
const [appName, ...metricType] = id.split(':');

const pair = { key: metricType, value: count };
const pair = { key: metricType.join(':'), value: count };
return {
...accum,
[appName]: [...(accum[appName] || []), pair],
Expand Down