-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Trace:Details Add span status filters. Combine bug fixes. #10745
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1c75b3a
feat: Add span status filters to trace details
11426cf
chore: update traces integ test to use new span filter
196eb9e
made tab persistent
51c9fbd
fix: Add Copy Icon for TraceId and relocate for Span overview
6fb30be
chore: Improve SpanStatusFilter unit testing
57dae3c
fix: Trace view to have narrower resizer and tabs panel to be transpa…
8c8f8a1
fix: change span overview service identifier to operation
1acefa1
Changeset file for PR #10745 created/updated
opensearch-changeset-bot[bot] a7df8fb
Merge branch 'main' into master-pr-10_20
TackAdam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,2 @@ | ||
| feat: | ||
| - Add span status filters to trace details. Combine bug fixes. ([#10745](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/10745)) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
164 changes: 164 additions & 0 deletions
164
...n/pages/traces/trace_details/public/traces/span_detail_tables/span_status_filter.test.tsx
This file contains hidden or 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,164 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { render, screen, fireEvent } from '@testing-library/react'; | ||
| import { shallow, ShallowWrapper } from 'enzyme'; | ||
| import { EuiSelectable } from '@elastic/eui'; | ||
| import { SpanStatusFilter, SpanStatusFilterProps } from './span_status_filter'; | ||
| import { SpanFilter } from '../../../trace_view'; | ||
|
|
||
| describe('SpanStatusFilter', () => { | ||
| let component: ShallowWrapper; | ||
| let mockSetSpanFiltersWithStorage: jest.Mock; | ||
|
|
||
| beforeEach(() => { | ||
| mockSetSpanFiltersWithStorage = jest.fn(); | ||
| }); | ||
|
|
||
| const createDefaultProps = (spanFilters: SpanFilter[] = []): SpanStatusFilterProps => ({ | ||
| spanFilters, | ||
| setSpanFiltersWithStorage: mockSetSpanFiltersWithStorage, | ||
| }); | ||
|
|
||
| describe('basic rendering', () => { | ||
| it('renders filter button and opens popover with selectable options', () => { | ||
| render(<SpanStatusFilter {...createDefaultProps()} />); | ||
|
|
||
| expect(screen.getByTestId('span-status-filter-button')).toBeInTheDocument(); | ||
| expect(screen.getByText('Filter by status')).toBeInTheDocument(); | ||
| expect(screen.queryByText('0')).not.toBeInTheDocument(); | ||
|
|
||
| fireEvent.click(screen.getByTestId('span-status-filter-button')); | ||
|
|
||
| expect(screen.getByTestId('span-status-filter-popover')).toBeInTheDocument(); | ||
| expect(screen.getByTestId('status-filter-selectable')).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('options and filter count', () => { | ||
| it('displays all three status options with correct labels', () => { | ||
| component = shallow(<SpanStatusFilter {...createDefaultProps()} />); | ||
|
|
||
| const options = component.find(EuiSelectable).prop('options'); | ||
|
|
||
| expect(options).toHaveLength(3); | ||
| expect(options).toEqual([ | ||
| expect.objectContaining({ label: 'Error', key: 'error' }), | ||
| expect.objectContaining({ label: 'OK', key: 'ok' }), | ||
| expect.objectContaining({ label: 'Unset', key: 'unset' }), | ||
| ]); | ||
| }); | ||
|
|
||
| it('shows correct count badge for active status filters', () => { | ||
| // Single filter | ||
| const { rerender } = render( | ||
| <SpanStatusFilter {...createDefaultProps([{ field: 'isError', value: true }])} /> | ||
| ); | ||
| expect(screen.getByText('1')).toBeInTheDocument(); | ||
|
|
||
| // Multiple filters | ||
| rerender( | ||
| <SpanStatusFilter | ||
| {...createDefaultProps([ | ||
| { field: 'isError', value: true }, | ||
| { field: 'status.code', value: 1 }, | ||
| { field: 'status.code', value: 0 }, | ||
| ])} | ||
| /> | ||
| ); | ||
| expect(screen.getByText('3')).toBeInTheDocument(); | ||
|
|
||
| // Non-status filters ignored | ||
| rerender( | ||
| <SpanStatusFilter | ||
| {...createDefaultProps([ | ||
| { field: 'serviceName', value: 'test' }, | ||
| { field: 'isError', value: true }, | ||
| ])} | ||
| /> | ||
| ); | ||
| expect(screen.getByText('1')).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('filter selection', () => { | ||
| it('adds correct filters when options are selected', () => { | ||
| component = shallow(<SpanStatusFilter {...createDefaultProps()} />); | ||
| const onChange = component.find(EuiSelectable).prop('onChange')!; | ||
|
|
||
| // Error option | ||
| onChange([ | ||
| { label: 'Error', key: 'error', checked: 'on' }, | ||
| { label: 'OK', key: 'ok' }, | ||
| { label: 'Unset', key: 'unset' }, | ||
| ]); | ||
| expect(mockSetSpanFiltersWithStorage).toHaveBeenCalledWith([ | ||
| { field: 'isError', value: true }, | ||
| ]); | ||
|
|
||
| // OK option | ||
| onChange([ | ||
| { label: 'Error', key: 'error' }, | ||
| { label: 'OK', key: 'ok', checked: 'on' }, | ||
| { label: 'Unset', key: 'unset' }, | ||
| ]); | ||
| expect(mockSetSpanFiltersWithStorage).toHaveBeenCalledWith([ | ||
| { field: 'status.code', value: 1 }, | ||
| ]); | ||
|
|
||
| // Unset option | ||
| onChange([ | ||
| { label: 'Error', key: 'error' }, | ||
| { label: 'OK', key: 'ok' }, | ||
| { label: 'Unset', key: 'unset', checked: 'on' }, | ||
| ]); | ||
| expect(mockSetSpanFiltersWithStorage).toHaveBeenCalledWith([ | ||
| { field: 'status.code', value: 0 }, | ||
| ]); | ||
|
|
||
| // Multiple options | ||
| onChange([ | ||
| { label: 'Error', key: 'error', checked: 'on' }, | ||
| { label: 'OK', key: 'ok', checked: 'on' }, | ||
| { label: 'Unset', key: 'unset' }, | ||
| ]); | ||
| expect(mockSetSpanFiltersWithStorage).toHaveBeenCalledWith([ | ||
| { field: 'isError', value: true }, | ||
| { field: 'status.code', value: 1 }, | ||
| ]); | ||
| }); | ||
|
|
||
| it('preserves non-status filters when updating', () => { | ||
| const spanFilters = [ | ||
| { field: 'serviceName', value: 'test' }, | ||
| { field: 'isError', value: true }, | ||
| ]; | ||
| component = shallow(<SpanStatusFilter {...createDefaultProps(spanFilters)} />); | ||
| const onChange = component.find(EuiSelectable).prop('onChange')!; | ||
|
|
||
| // Deselect all | ||
| onChange([ | ||
| { label: 'Error', key: 'error' }, | ||
| { label: 'OK', key: 'ok' }, | ||
| { label: 'Unset', key: 'unset' }, | ||
| ]); | ||
| expect(mockSetSpanFiltersWithStorage).toHaveBeenCalledWith([ | ||
| { field: 'serviceName', value: 'test' }, | ||
| ]); | ||
|
|
||
| // Add new filter | ||
| onChange([ | ||
| { label: 'Error', key: 'error' }, | ||
| { label: 'OK', key: 'ok', checked: 'on' }, | ||
| { label: 'Unset', key: 'unset' }, | ||
| ]); | ||
| expect(mockSetSpanFiltersWithStorage).toHaveBeenCalledWith([ | ||
| { field: 'serviceName', value: 'test' }, | ||
| { field: 'status.code', value: 1 }, | ||
| ]); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.