mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[8.18] [APM][OTel] Service inventory icons should be visible if the agentName
is returned (#216220) (#216466)
# Backport This will backport the following commits from `main` to `8.18`: - [[APM][OTel] Service inventory icons should be visible if the `agentName` is returned (#216220)](https://github.com/elastic/kibana/pull/216220) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"jennypavlova","email":"dzheni.pavlova@elastic.co"},"sourceCommit":{"committedDate":"2025-03-31T13:07:17Z","message":"[APM][OTel] Service inventory icons should be visible if the `agentName` is returned (#216220)\n\nCloses #214562 \n\n## Summary\n\nThis PR fixes the issue with the service icons overridden by the merge\nof the service stats\n\n## Testing\nAs this is a bit tricky to test - it needs a bit of refreshing /\nchanging the time range, etc. to reproduce\nThe way to verify the fix is to check the service overview - every\nservice that has an icon there should have an icon in the service\ninventory:\n\n\nhttps://github.com/user-attachments/assets/e401554b-6a39-440b-a52b-a126e42eacd5","sha":"cd8f18eed82722bfee3c27829ba233b381aea0cc","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","backport:prev-major","Team:obs-ux-infra_services","v9.1.0"],"title":"[APM][OTel] Service inventory icons should be visible if the `agentName` is returned","number":216220,"url":"https://github.com/elastic/kibana/pull/216220","mergeCommit":{"message":"[APM][OTel] Service inventory icons should be visible if the `agentName` is returned (#216220)\n\nCloses #214562 \n\n## Summary\n\nThis PR fixes the issue with the service icons overridden by the merge\nof the service stats\n\n## Testing\nAs this is a bit tricky to test - it needs a bit of refreshing /\nchanging the time range, etc. to reproduce\nThe way to verify the fix is to check the service overview - every\nservice that has an icon there should have an icon in the service\ninventory:\n\n\nhttps://github.com/user-attachments/assets/e401554b-6a39-440b-a52b-a126e42eacd5","sha":"cd8f18eed82722bfee3c27829ba233b381aea0cc"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216220","number":216220,"mergeCommit":{"message":"[APM][OTel] Service inventory icons should be visible if the `agentName` is returned (#216220)\n\nCloses #214562 \n\n## Summary\n\nThis PR fixes the issue with the service icons overridden by the merge\nof the service stats\n\n## Testing\nAs this is a bit tricky to test - it needs a bit of refreshing /\nchanging the time range, etc. to reproduce\nThe way to verify the fix is to check the service overview - every\nservice that has an icon there should have an icon in the service\ninventory:\n\n\nhttps://github.com/user-attachments/assets/e401554b-6a39-440b-a52b-a126e42eacd5","sha":"cd8f18eed82722bfee3c27829ba233b381aea0cc"}}]}] BACKPORT--> Co-authored-by: jennypavlova <dzheni.pavlova@elastic.co>
This commit is contained in:
parent
09be537547
commit
b1c52174e5
2 changed files with 70 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import type { AgentName } from '@kbn/elastic-agent-utils';
|
||||
import { ServiceHealthStatus } from '../../../../common/service_health_status';
|
||||
import type { getServiceTransactionStats } from './get_service_transaction_stats';
|
||||
import { mergeServiceStats } from './merge_service_stats';
|
||||
|
@ -201,4 +202,70 @@ describe('mergeServiceStats', () => {
|
|||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('shows services with agentName from the first object if it is null in the last object', () => {
|
||||
expect(
|
||||
mergeServiceStats({
|
||||
serviceStats: [
|
||||
stat({
|
||||
serviceName: 'opbeans-java',
|
||||
environments: ['staging'],
|
||||
agentName: 'java',
|
||||
}),
|
||||
],
|
||||
servicesWithoutTransactions: [
|
||||
{
|
||||
environments: ['production'],
|
||||
serviceName: 'opbeans-java',
|
||||
agentName: null as unknown as AgentName, // agentName is null here
|
||||
},
|
||||
],
|
||||
healthStatuses: [],
|
||||
alertCounts: [],
|
||||
})
|
||||
).toEqual([
|
||||
{
|
||||
agentName: 'java',
|
||||
environments: ['staging', 'production'],
|
||||
serviceName: 'opbeans-java',
|
||||
latency: 1,
|
||||
throughput: 2,
|
||||
transactionErrorRate: 3,
|
||||
transactionType: 'request',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('shows services with agentName from the last object if it is undefined in the first object', () => {
|
||||
expect(
|
||||
mergeServiceStats({
|
||||
serviceStats: [
|
||||
stat({
|
||||
serviceName: 'opbeans-java',
|
||||
environments: ['staging'],
|
||||
agentName: undefined,
|
||||
}),
|
||||
],
|
||||
servicesWithoutTransactions: [
|
||||
{
|
||||
environments: ['production'],
|
||||
serviceName: 'opbeans-java',
|
||||
agentName: 'java',
|
||||
},
|
||||
],
|
||||
healthStatuses: [],
|
||||
alertCounts: [],
|
||||
})
|
||||
).toEqual([
|
||||
{
|
||||
agentName: 'java', // agentName from servicesWithoutTransactions
|
||||
environments: ['staging', 'production'],
|
||||
serviceName: 'opbeans-java',
|
||||
latency: 1,
|
||||
throughput: 2,
|
||||
transactionErrorRate: 3,
|
||||
transactionType: 'request',
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -64,10 +64,12 @@ export function mergeServiceStats({
|
|||
function merge(a, b) {
|
||||
const aEnvs = 'environments' in a ? a.environments : [];
|
||||
const bEnvs = 'environments' in b ? b.environments : [];
|
||||
|
||||
const agentNameA = 'agentName' in a ? a?.agentName : undefined;
|
||||
const agentNameB = 'agentName' in b ? b?.agentName : undefined;
|
||||
return {
|
||||
...a,
|
||||
...b,
|
||||
...{ agentName: agentNameA || agentNameB },
|
||||
environments: uniq(aEnvs.concat(bEnvs)),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue