-
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.
[Discover][APM] Add icon to transaction name badge in summary column (#…
…213428) ## Summary Closes #211928 As part of the Traces in Discover initiative, we’ve added `transaction.name` and `span.name` badges to the summary column. Some documents can contain both, making it unclear which one represents the transaction or the span name, and that's hot helpful for the filtering experience the badges provide. This PR addresses that by adding an icon as a prefix to the transaction name, similar to the one used in the APM trace waterfall. |Before|After| |-|-| ||| We have two types of icons, the `merge` one by default or the `globe` for rum agents.  ### Boy scouting While playing around with the cell renderers, I realized that for long values, the content was floating outside of the popover container.  So I've decided to add the same behaviour we have for the actions popover in the flyout. |Table|Flyout| |-|-| ||| ### How to test Add this to your kibana.dev.yml: ``` discover.experimental.enabledProfiles: - traces-data-source-profile ````` - Go to Discover page - Select APM data view - Check your traces data
- Loading branch information
Showing
4 changed files
with
88 additions
and
0 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
55 changes: 55 additions & 0 deletions
55
...ponents/src/data_types/logs/components/summary_column/icons/transaction_name_icon.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,55 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import { AgentName } from '@kbn/elastic-agent-utils'; | ||
import { TransactionNameIcon } from './transaction_name_icon'; | ||
|
||
jest.mock('@elastic/eui', () => ({ | ||
...jest.requireActual('@elastic/eui'), | ||
useEuiTheme: jest.fn(() => ({ | ||
euiTheme: { | ||
size: { | ||
xs: '', | ||
}, | ||
}, | ||
})), | ||
})); | ||
|
||
describe('TransactionNameIcon', () => { | ||
const dataTestSub = 'discoverContextualComponentsSummaryColumnTransactionNameIcon'; | ||
|
||
it('should render the "globe" icon when agentName is a RUM agent', () => { | ||
const { getByTestId } = render(TransactionNameIcon('rum-js')); | ||
|
||
const icon = getByTestId(dataTestSub); | ||
expect(icon).toHaveAttribute('data-euiicon-type', 'globe'); | ||
}); | ||
|
||
it('should render the "merge" icon when agentName is not a RUM agent', () => { | ||
const { getByTestId } = render(TransactionNameIcon('go')); | ||
|
||
const icon = getByTestId(dataTestSub); | ||
expect(icon).toHaveAttribute('data-euiicon-type', 'merge'); | ||
}); | ||
|
||
it('should render the "merge" icon when agentName is undefined', () => { | ||
const { getByTestId } = render(TransactionNameIcon(undefined as unknown as AgentName)); | ||
|
||
const icon = getByTestId(dataTestSub); | ||
expect(icon).toHaveAttribute('data-euiicon-type', 'merge'); | ||
}); | ||
|
||
it('should render the "merge" icon when agentName is null', () => { | ||
const { getByTestId } = render(TransactionNameIcon(null as unknown as AgentName)); | ||
|
||
const icon = getByTestId(dataTestSub); | ||
expect(icon).toHaveAttribute('data-euiicon-type', 'merge'); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
...-components/src/data_types/logs/components/summary_column/icons/transaction_name_icon.tsx
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,28 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import React from 'react'; | ||
import { useEuiTheme, IconType, EuiIcon } from '@elastic/eui'; | ||
import { AgentName, isRumAgentName } from '@kbn/elastic-agent-utils'; | ||
import { css } from '@emotion/react'; | ||
|
||
export const TransactionNameIcon = (agentName: AgentName) => { | ||
const { euiTheme } = useEuiTheme(); | ||
const icon: IconType = isRumAgentName(agentName) ? 'globe' : 'merge'; | ||
return ( | ||
<EuiIcon | ||
data-test-subj="discoverContextualComponentsSummaryColumnTransactionNameIcon" | ||
type={icon} | ||
size="s" | ||
css={css` | ||
margin-right: ${euiTheme.size.xs}; | ||
`} | ||
/> | ||
); | ||
}; |
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