Skip to content

Commit cc99f03

Browse files
authored
refactor: adding filters to data source (#1372)
* refactor: adding filters and make largest auto value as default * refactor: fixing lint error * refactor: fixing test * refactor: fixing tests * refactor: addressing review comments * revert: auto interval chagnes
1 parent a06a910 commit cc99f03

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

projects/observability/src/shared/dashboard/data/graphql/trace/timeseries/trace-metric-timeseries-data-source.model.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ describe('Trace metric timeseries data source model', () => {
3232
requestType: EXPLORE_GQL_REQUEST,
3333
timeRange: new GraphQlTimeRange(testTimeRange.startTime, testTimeRange.endTime),
3434
context: ObservabilityTraceType.Api,
35+
filters: [],
3536
interval: testInterval,
3637
limit: 10000,
3738
selections: [model.specification]

projects/observability/src/shared/dashboard/data/graphql/trace/trace-series-values-data-source.model.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@ import {
1010
GraphQlExploreResult
1111
} from '../../../../graphql/request/handlers/explore/explore-query';
1212
import { GraphQlDataSourceModel } from '../graphql-data-source.model';
13+
import { GraphQlFilter } from './../../../../graphql/model/schema/filter/graphql-filter';
1314

1415
export abstract class TraceSeriesValuesDataSourceModel<TData> extends GraphQlDataSourceModel<TData> {
1516
protected abstract specification: ExploreSpecification;
1617

1718
protected fetchSpecificationData(interval: TimeDuration): Observable<GraphQlExploreResult[]> {
18-
return this.query<ExploreGraphQlQueryHandlerService>(() => this.buildRequest(interval)).pipe(
19-
map(response => response.results)
20-
);
19+
return this.query<ExploreGraphQlQueryHandlerService>(inheritedFilters =>
20+
this.buildRequest(interval, inheritedFilters)
21+
).pipe(map(response => response.results));
2122
}
2223

23-
private buildRequest(interval: TimeDuration): GraphQlExploreRequest {
24+
private buildRequest(interval: TimeDuration, inheritedFilters: GraphQlFilter[] = []): GraphQlExploreRequest {
2425
return {
2526
requestType: EXPLORE_GQL_REQUEST,
2627
timeRange: this.getTimeRangeOrThrow(),
2728
context: ObservabilityTraceType.Api,
2829
interval: interval,
30+
filters: [...inheritedFilters],
2931
limit: 10000,
3032
selections: [this.specification]
3133
};

0 commit comments

Comments
 (0)