Skip to content

Commit

Permalink
feat: add resource_deployment_environment as fast filter in traces pa…
Browse files Browse the repository at this point in the history
…ge (#5864)

* feat: add resource_deployment_environment as fast filter in traces page

* chore: directly use deployment.environment, rather than converting resource_deployment_environment

* chore: make environment filter expanded by default

* chore: add deployment.environment to defaultOpenSections to pass the test

---------

Co-authored-by: Ankit Nayan <ankit@signoz.io>
  • Loading branch information
ahmadshaheer and ankitnayan authored Sep 11, 2024
1 parent 47d42e6 commit 2cc2a43
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
1 change: 1 addition & 0 deletions frontend/src/pages/TracesExplorer/Filter/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function Section(props: SectionProps): JSX.Element {
'hasError',
'durationNano',
'serviceName',
'deployment.environment',
]),
),
[selectedFilters],
Expand Down
20 changes: 15 additions & 5 deletions frontend/src/pages/TracesExplorer/Filter/filterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import {
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource } from 'types/common/queryBuilder';

export const AllTraceFilterKeyValue = {
export const AllTraceFilterKeyValue: Record<string, string> = {
durationNanoMin: 'Duration',
durationNano: 'Duration',
durationNanoMax: 'Duration',
'deployment.environment': 'Environment',
hasError: 'Status',
serviceName: 'Service Name',
name: 'Operation / Name',
Expand All @@ -22,7 +23,7 @@ export const AllTraceFilterKeyValue = {
httpRoute: 'HTTP Route',
httpUrl: 'HTTP URL',
traceID: 'Trace ID',
};
} as const;

export type AllTraceFilterKeys = keyof typeof AllTraceFilterKeyValue;

Expand Down Expand Up @@ -64,7 +65,7 @@ export const addFilter = (
| undefined
>
>,
keys?: BaseAutocompleteData,
keys: BaseAutocompleteData,
): void => {
setSelectedFilters((prevFilters) => {
const isDuration = [
Expand Down Expand Up @@ -122,7 +123,7 @@ export const removeFilter = (
| undefined
>
>,
keys?: BaseAutocompleteData,
keys: BaseAutocompleteData,
): void => {
setSelectedFilters((prevFilters) => {
if (!prevFilters || !prevFilters[filterType]?.values.length) {
Expand Down Expand Up @@ -202,6 +203,15 @@ export const traceFilterKeys: Record<
isJSON: false,
id: 'serviceName--string--tag--true',
},

'deployment.environment': {
key: 'deployment.environment',
dataType: DataTypes.String,
type: 'resource',
isColumn: false,
isJSON: false,
id: 'deployment.environment--string--resource--false',
},
name: {
key: 'name',
dataType: DataTypes.String,
Expand Down Expand Up @@ -282,7 +292,7 @@ export const traceFilterKeys: Record<
isJSON: false,
id: 'durationNanoMax--float64--tag--true',
},
};
} as const;

interface AggregateValuesProps {
value: AllTraceFilterKeys;
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/pages/TracesExplorer/__test__/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,12 @@ export function checkIfSectionIsNotOpen(
expect(section.querySelector('.ant-collapse-item-active')).toBeNull();
}

export const defaultOpenSections = ['hasError', 'durationNano', 'serviceName'];
export const defaultOpenSections = [
'hasError',
'durationNano',
'serviceName',
'deployment.environment',
];

export const defaultClosedSections = Object.keys(AllTraceFilterKeyValue).filter(
(section) =>
Expand Down

0 comments on commit 2cc2a43

Please sign in to comment.