diff --git a/projects/observability/src/pages/explorer/explorer.component.test.ts b/projects/observability/src/pages/explorer/explorer.component.test.ts index ccb26e240..9e558a241 100644 --- a/projects/observability/src/pages/explorer/explorer.component.test.ts +++ b/projects/observability/src/pages/explorer/explorer.component.test.ts @@ -37,7 +37,7 @@ import { ExploreQueryEditorComponent } from '../../shared/components/explore-que import { ObservabilityTraceType } from '../../shared/graphql/model/schema/observability-traces'; import { ExploreSpecificationBuilder } from '../../shared/graphql/request/builders/specification/explore/explore-specification-builder'; import { EntitiesGraphqlQueryBuilderService } from '../../shared/graphql/request/handlers/entities/query/entities-graphql-query-builder.service'; -import { EXPLORE_GQL_REQUEST } from '../../shared/graphql/request/handlers/explore/explore-graphql-query-handler.service'; +import { EXPLORE_GQL_REQUEST } from '../../shared/graphql/request/handlers/explore/explore-query'; import { ExplorerDashboardBuilder } from './explorer-dashboard-builder'; import { ExplorerComponent } from './explorer.component'; import { ExplorerModule } from './explorer.module'; diff --git a/projects/observability/src/public-api.ts b/projects/observability/src/public-api.ts index 8f9400f26..122e27979 100644 --- a/projects/observability/src/public-api.ts +++ b/projects/observability/src/public-api.ts @@ -25,6 +25,8 @@ export * from './shared/graphql/request/handlers/entities/query/entity/entity-gr export * from './shared/graphql/request/handlers/entities/query/interactions/interactions-graphql-query-handler.service'; export * from './shared/graphql/request/handlers/entities/query/topology/entity-topology-graphql-query-handler.service'; export * from './shared/graphql/request/handlers/explore/explore-graphql-query-handler.service'; +export * from './shared/graphql/request/handlers/explore/explore-graphql-query-builder.service'; +export * from './shared/graphql/request/handlers/explore/explore-query'; // Services export * from './shared/services/entity/entity-icon-lookup.service'; diff --git a/projects/observability/src/shared/components/explore-query-editor/explore-visualization-builder.ts b/projects/observability/src/shared/components/explore-query-editor/explore-visualization-builder.ts index 2844e2bbb..7c894a2c5 100644 --- a/projects/observability/src/shared/components/explore-query-editor/explore-visualization-builder.ts +++ b/projects/observability/src/shared/components/explore-query-editor/explore-visualization-builder.ts @@ -22,10 +22,7 @@ import { GraphQlGroupBy } from '../../graphql/model/schema/groupby/graphql-group import { ObservabilityTraceType } from '../../graphql/model/schema/observability-traces'; import { ExploreSpecification } from '../../graphql/model/schema/specifications/explore-specification'; import { ExploreSpecificationBuilder } from '../../graphql/request/builders/specification/explore/explore-specification-builder'; -import { - EXPLORE_GQL_REQUEST, - GraphQlExploreRequest -} from '../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +import { EXPLORE_GQL_REQUEST, GraphQlExploreRequest } from '../../graphql/request/handlers/explore/explore-query'; import { CartesianSeriesVisualizationType } from '../cartesian/chart'; @Injectable() diff --git a/projects/observability/src/shared/dashboard/data/graphql/api-calls-count/api-calls-count-data-source-model.ts b/projects/observability/src/shared/dashboard/data/graphql/api-calls-count/api-calls-count-data-source-model.ts index fe74663c3..ec014c18d 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/api-calls-count/api-calls-count-data-source-model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/api-calls-count/api-calls-count-data-source-model.ts @@ -9,11 +9,11 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ExploreSpecification } from '../../../../graphql/model/schema/specifications/explore-specification'; import { ExploreSpecificationBuilder } from '../../../../graphql/request/builders/specification/explore/explore-specification-builder'; +import { ExploreGraphQlQueryHandlerService } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; import { - ExploreGraphQlQueryHandlerService, EXPLORE_GQL_REQUEST, GraphQlExploreResponse -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; @Model({ type: 'api-calls-count-data-source' diff --git a/projects/observability/src/shared/dashboard/data/graphql/api-calls-count/api-calls-count-data-source.model.test.ts b/projects/observability/src/shared/dashboard/data/graphql/api-calls-count/api-calls-count-data-source.model.test.ts index c990c823d..ab02abbaf 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/api-calls-count/api-calls-count-data-source.model.test.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/api-calls-count/api-calls-count-data-source.model.test.ts @@ -3,11 +3,11 @@ import { AttributeMetadataType, MetricAggregationType, ObservedGraphQlRequest } import { ModelApi } from '@hypertrace/hyperdash'; import { runFakeRxjs } from '@hypertrace/test-utils'; import { ExploreSpecificationBuilder } from '../../../../graphql/request/builders/specification/explore/explore-specification-builder'; +import { ExploreGraphQlQueryHandlerService } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; import { - ExploreGraphQlQueryHandlerService, EXPLORE_GQL_REQUEST, GraphQlExploreResponse -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; import { ApiCallsCountDataSourceModel } from './api-calls-count-data-source-model'; describe('API call count data source model', () => { diff --git a/projects/observability/src/shared/dashboard/data/graphql/explore/explore-cartesian-data-source.model.test.ts b/projects/observability/src/shared/dashboard/data/graphql/explore/explore-cartesian-data-source.model.test.ts index 0dcdf1b1c..4183890d3 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/explore/explore-cartesian-data-source.model.test.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/explore/explore-cartesian-data-source.model.test.ts @@ -21,7 +21,7 @@ import { ExploreSpecificationBuilder } from '../../../../graphql/request/builder import { GQL_EXPLORE_RESULT_INTERVAL_KEY, GraphQlExploreResponse -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; import { CartesianResult } from '../../../widgets/charts/cartesian-widget/cartesian-widget.model'; import { GraphQlGroupBy } from './../../../../graphql/model/schema/groupby/graphql-group-by'; import { ExploreCartesianDataSourceModel, ExplorerData } from './explore-cartesian-data-source.model'; diff --git a/projects/observability/src/shared/dashboard/data/graphql/explore/explore-cartesian-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/explore/explore-cartesian-data-source.model.ts index cb81ef0c2..68eb120ac 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/explore/explore-cartesian-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/explore/explore-cartesian-data-source.model.ts @@ -13,12 +13,12 @@ import { Series } from '../../../../components/cartesian/chart'; import { ExploreRequestState } from '../../../../components/explore-query-editor/explore-visualization-builder'; import { MetricTimeseriesInterval } from '../../../../graphql/model/metric/metric-timeseries'; import { ExploreSpecification } from '../../../../graphql/model/schema/specifications/explore-specification'; +import { ExploreGraphQlQueryHandlerService } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; import { - ExploreGraphQlQueryHandlerService, EXPLORE_GQL_REQUEST, GraphQlExploreRequest, GraphQlExploreResponse -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; import { CartesianDataFetcher, CartesianResult } from '../../../widgets/charts/cartesian-widget/cartesian-widget.model'; import { ExploreResult } from './explore-result'; diff --git a/projects/observability/src/shared/dashboard/data/graphql/explore/explore-result.test.ts b/projects/observability/src/shared/dashboard/data/graphql/explore/explore-result.test.ts index e4b3f66df..1ae75aef8 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/explore/explore-result.test.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/explore/explore-result.test.ts @@ -1,5 +1,5 @@ import { AttributeMetadataType, MetricAggregationType } from '@hypertrace/distributed-tracing'; -import { GQL_EXPLORE_RESULT_INTERVAL_KEY } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +import { GQL_EXPLORE_RESULT_INTERVAL_KEY } from '../../../../graphql/request/handlers/explore/explore-query'; import { ExploreResult } from './explore-result'; describe('Explore result', () => { diff --git a/projects/observability/src/shared/dashboard/data/graphql/explore/explore-result.ts b/projects/observability/src/shared/dashboard/data/graphql/explore/explore-result.ts index 247394685..afb063b51 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/explore/explore-result.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/explore/explore-result.ts @@ -8,7 +8,7 @@ import { GQL_EXPLORE_RESULT_INTERVAL_KEY, GraphQlExploreResponse, GraphQlExploreResult -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; export class ExploreResult { private static readonly OTHER_SERVER_GROUP_NAME: string = '__Other'; diff --git a/projects/observability/src/shared/dashboard/data/graphql/explorer-visualization/explorer-visualization-cartesian-data-source.model.test.ts b/projects/observability/src/shared/dashboard/data/graphql/explorer-visualization/explorer-visualization-cartesian-data-source.model.test.ts index 9ca630f37..3ee0b4e5a 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/explorer-visualization/explorer-visualization-cartesian-data-source.model.test.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/explorer-visualization/explorer-visualization-cartesian-data-source.model.test.ts @@ -19,7 +19,7 @@ import { EXPLORE_GQL_REQUEST, GQL_EXPLORE_RESULT_INTERVAL_KEY, GraphQlExploreResponse -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; import { CartesianResult } from '../../../widgets/charts/cartesian-widget/cartesian-widget.model'; import { ExplorerData } from '../explore/explore-cartesian-data-source.model'; import { ExplorerVisualizationCartesianDataSourceModel } from './explorer-visualization-cartesian-data-source.model'; diff --git a/projects/observability/src/shared/dashboard/data/graphql/explorer-visualization/explorer-visualization-cartesian-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/explorer-visualization/explorer-visualization-cartesian-data-source.model.ts index 907ef0621..061a2a2f2 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/explorer-visualization/explorer-visualization-cartesian-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/explorer-visualization/explorer-visualization-cartesian-data-source.model.ts @@ -7,10 +7,8 @@ import { ExploreRequestState, ExploreVisualizationRequest } from '../../../../components/explore-query-editor/explore-visualization-builder'; -import { - ExploreGraphQlQueryHandlerService, - GraphQlExploreRequest -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +import { ExploreGraphQlQueryHandlerService } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +import { GraphQlExploreRequest } from '../../../../graphql/request/handlers/explore/explore-query'; import { CartesianResult } from '../../../widgets/charts/cartesian-widget/cartesian-widget.model'; import { ExploreCartesianDataSourceModel, ExplorerData } from '../explore/explore-cartesian-data-source.model'; @Model({ diff --git a/projects/observability/src/shared/dashboard/data/graphql/metric-aggregation/metric-aggregation-data-source.model.test.ts b/projects/observability/src/shared/dashboard/data/graphql/metric-aggregation/metric-aggregation-data-source.model.test.ts index 4ebe48d66..8c8b7603e 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/metric-aggregation/metric-aggregation-data-source.model.test.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/metric-aggregation/metric-aggregation-data-source.model.test.ts @@ -9,11 +9,11 @@ import { import { ModelApi } from '@hypertrace/hyperdash'; import { runFakeRxjs } from '@hypertrace/test-utils'; import { ExploreSpecificationBuilder } from '../../../../graphql/request/builders/specification/explore/explore-specification-builder'; +import { ExploreGraphQlQueryHandlerService } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; import { - ExploreGraphQlQueryHandlerService, EXPLORE_GQL_REQUEST, GraphQlExploreResponse -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; import { ExploreSelectionSpecificationModel } from '../specifiers/explore-selection-specification.model'; import { MetricAggregationDataSourceModel } from './metric-aggregation-data-source.model'; diff --git a/projects/observability/src/shared/dashboard/data/graphql/metric-aggregation/metric-aggregation-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/metric-aggregation/metric-aggregation-data-source.model.ts index eb2dad904..854b90303 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/metric-aggregation/metric-aggregation-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/metric-aggregation/metric-aggregation-data-source.model.ts @@ -9,11 +9,11 @@ import { import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ExploreSpecificationBuilder } from '../../../../graphql/request/builders/specification/explore/explore-specification-builder'; +import { ExploreGraphQlQueryHandlerService } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; import { - ExploreGraphQlQueryHandlerService, EXPLORE_GQL_REQUEST, GraphQlExploreResponse -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; import { ExploreSelectionSpecificationModel } from '../specifiers/explore-selection-specification.model'; @Model({ diff --git a/projects/observability/src/shared/dashboard/data/graphql/table/explore/explore-table-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/table/explore/explore-table-data-source.model.ts index 32e104a67..40f6fa3d2 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/table/explore/explore-table-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/table/explore/explore-table-data-source.model.ts @@ -20,7 +20,7 @@ import { EXPLORE_GQL_REQUEST, GraphQlExploreRequest, GraphQlExploreResponse -} from './../../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from './../../../../../graphql/request/handlers/explore/explore-query'; @Model({ type: 'explore-table-data-source' diff --git a/projects/observability/src/shared/dashboard/data/graphql/trace/aggregation/trace-metric-aggregation-data-source.model.test.ts b/projects/observability/src/shared/dashboard/data/graphql/trace/aggregation/trace-metric-aggregation-data-source.model.test.ts index 612c5a1a9..de619da84 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/trace/aggregation/trace-metric-aggregation-data-source.model.test.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/trace/aggregation/trace-metric-aggregation-data-source.model.test.ts @@ -2,7 +2,7 @@ import { GraphQlFilter, GraphQlTimeRange, MetricAggregationType } from '@hypertr import { ModelApi } from '@hypertrace/hyperdash'; import { ObservabilityTraceType } from '../../../../../graphql/model/schema/observability-traces'; import { ExploreSpecificationBuilder } from '../../../../../graphql/request/builders/specification/explore/explore-specification-builder'; -import { EXPLORE_GQL_REQUEST } from '../../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +import { EXPLORE_GQL_REQUEST } from '../../../../../graphql/request/handlers/explore/explore-query'; import { TraceMetricAggregationDataSourceModel } from './trace-metric-aggregation-data-source.model'; describe('Trace metric aggregation data source model', () => { diff --git a/projects/observability/src/shared/dashboard/data/graphql/trace/donut/trace-donut-data-source.model.test.ts b/projects/observability/src/shared/dashboard/data/graphql/trace/donut/trace-donut-data-source.model.test.ts index 115fd3047..01be4b708 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/trace/donut/trace-donut-data-source.model.test.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/trace/donut/trace-donut-data-source.model.test.ts @@ -15,7 +15,7 @@ import { ObservabilitySpecificationBuilder } from '../../../../../graphql/reques import { EXPLORE_GQL_REQUEST, GraphQlExploreResponse -} from '../../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../../graphql/request/handlers/explore/explore-query'; import { TraceDonutDataSourceModel } from './trace-donut-data-source.model'; describe('Donut data source model', () => { diff --git a/projects/observability/src/shared/dashboard/data/graphql/trace/donut/trace-donut-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/trace/donut/trace-donut-data-source.model.ts index 0bdc5c6f0..eab70b3eb 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/trace/donut/trace-donut-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/trace/donut/trace-donut-data-source.model.ts @@ -12,11 +12,11 @@ import { DonutSeries, DonutSeriesResults } from '../../../../../components/donut import { ObservabilityTraceType } from '../../../../../graphql/model/schema/observability-traces'; import { MetricAggregationSpecification } from '../../../../../graphql/model/schema/specifications/metric-aggregation-specification'; import { ExploreSpecificationBuilder } from '../../../../../graphql/request/builders/specification/explore/explore-specification-builder'; +import { ExploreGraphQlQueryHandlerService } from '../../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; import { - ExploreGraphQlQueryHandlerService, EXPLORE_GQL_REQUEST, GraphQlExploreResponse -} from '../../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../../graphql/request/handlers/explore/explore-query'; import { ExploreResult } from '../../explore/explore-result'; import { MetricAggregationSpecificationModel } from '../../specifiers/metric-aggregation-specification.model'; diff --git a/projects/observability/src/shared/dashboard/data/graphql/trace/timeseries/trace-metric-timeseries-data-source.model.test.ts b/projects/observability/src/shared/dashboard/data/graphql/trace/timeseries/trace-metric-timeseries-data-source.model.test.ts index 8847597a7..7d6b815e1 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/trace/timeseries/trace-metric-timeseries-data-source.model.test.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/trace/timeseries/trace-metric-timeseries-data-source.model.test.ts @@ -3,7 +3,7 @@ import { GraphQlFilter, GraphQlTimeRange, MetricAggregationType } from '@hypertr import { ModelApi } from '@hypertrace/hyperdash'; import { ObservabilityTraceType } from '../../../../../graphql/model/schema/observability-traces'; import { ExploreSpecificationBuilder } from '../../../../../graphql/request/builders/specification/explore/explore-specification-builder'; -import { EXPLORE_GQL_REQUEST } from '../../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +import { EXPLORE_GQL_REQUEST } from '../../../../../graphql/request/handlers/explore/explore-query'; import { TraceMetricTimeseriesDataSourceModel } from './trace-metric-timeseries-data-source.model'; describe('Trace metric timeseries data source model', () => { diff --git a/projects/observability/src/shared/dashboard/data/graphql/trace/timeseries/trace-metric-timeseries-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/trace/timeseries/trace-metric-timeseries-data-source.model.ts index 6faa21694..28d335393 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/trace/timeseries/trace-metric-timeseries-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/trace/timeseries/trace-metric-timeseries-data-source.model.ts @@ -10,7 +10,7 @@ import { ExploreSpecification } from '../../../../../graphql/model/schema/specif import { GQL_EXPLORE_RESULT_INTERVAL_KEY, GraphQlExploreResult -} from '../../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../../graphql/request/handlers/explore/explore-query'; import { MetricSeries, MetricSeriesDataFetcher } from '../../../../widgets/charts/cartesian-widget/series.model'; import { ExploreSelectionSpecificationModel } from '../../specifiers/explore-selection-specification.model'; import { TraceSeriesValuesDataSourceModel } from '../trace-series-values-data-source.model'; diff --git a/projects/observability/src/shared/dashboard/data/graphql/trace/trace-series-values-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/trace/trace-series-values-data-source.model.ts index 732030ae3..110c40245 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/trace/trace-series-values-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/trace/trace-series-values-data-source.model.ts @@ -4,12 +4,12 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ObservabilityTraceType } from '../../../../graphql/model/schema/observability-traces'; import { ExploreSpecification } from '../../../../graphql/model/schema/specifications/explore-specification'; +import { ExploreGraphQlQueryHandlerService } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; import { - ExploreGraphQlQueryHandlerService, EXPLORE_GQL_REQUEST, GraphQlExploreRequest, GraphQlExploreResult -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; export abstract class TraceSeriesValuesDataSourceModel extends GraphQlDataSourceModel { protected abstract specification: ExploreSpecification; diff --git a/projects/observability/src/shared/dashboard/data/graphql/trace/trace-value-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/trace/trace-value-data-source.model.ts index f7a4f7950..68c87d77b 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/trace/trace-value-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/trace/trace-value-data-source.model.ts @@ -3,12 +3,12 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ObservabilityTraceType } from '../../../../graphql/model/schema/observability-traces'; import { ExploreSpecification } from '../../../../graphql/model/schema/specifications/explore-specification'; +import { ExploreGraphQlQueryHandlerService } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; import { - ExploreGraphQlQueryHandlerService, EXPLORE_GQL_REQUEST, GraphQlExploreRequest, GraphQlExploreResultValue -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; export abstract class TraceValueDataSourceModel extends GraphQlDataSourceModel { protected abstract specification: ExploreSpecification; diff --git a/projects/observability/src/shared/dashboard/widgets/top-n/data/top-n-data-source.model.test.ts b/projects/observability/src/shared/dashboard/widgets/top-n/data/top-n-data-source.model.test.ts index afe6ac450..85d005ff8 100644 --- a/projects/observability/src/shared/dashboard/widgets/top-n/data/top-n-data-source.model.test.ts +++ b/projects/observability/src/shared/dashboard/widgets/top-n/data/top-n-data-source.model.test.ts @@ -4,10 +4,7 @@ import { ModelApi } from '@hypertrace/hyperdash'; import { mergeMap } from 'rxjs/operators'; import { ObservabilityEntityType } from '../../../../graphql/model/schema/entity'; import { ExploreSpecificationBuilder } from '../../../../graphql/request/builders/specification/explore/explore-specification-builder'; -import { - EXPLORE_GQL_REQUEST, - GraphQlExploreRequest -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +import { EXPLORE_GQL_REQUEST, GraphQlExploreRequest } from '../../../../graphql/request/handlers/explore/explore-query'; import { TopNDataSourceModel } from './top-n-data-source.model'; import { TopNExploreSelectionSpecificationModel } from './top-n-explore-selection-specification.model'; diff --git a/projects/observability/src/shared/dashboard/widgets/top-n/data/top-n-data-source.model.ts b/projects/observability/src/shared/dashboard/widgets/top-n/data/top-n-data-source.model.ts index 45649a9ca..b95eafcaa 100644 --- a/projects/observability/src/shared/dashboard/widgets/top-n/data/top-n-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/widgets/top-n/data/top-n-data-source.model.ts @@ -7,11 +7,11 @@ import { map } from 'rxjs/operators'; import { Entity, entityIdKey, entityTypeKey, ObservabilityEntityType } from '../../../../graphql/model/schema/entity'; import { ExploreSpecification } from '../../../../graphql/model/schema/specifications/explore-specification'; import { ExploreSpecificationBuilder } from '../../../../graphql/request/builders/specification/explore/explore-specification-builder'; +import { ExploreGraphQlQueryHandlerService } from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; import { - ExploreGraphQlQueryHandlerService, EXPLORE_GQL_REQUEST, GraphQlExploreResponse -} from '../../../../graphql/request/handlers/explore/explore-graphql-query-handler.service'; +} from '../../../../graphql/request/handlers/explore/explore-query'; import { TopNExploreSelectionSpecificationModel } from './top-n-explore-selection-specification.model'; @Model({ diff --git a/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-builder.service.ts b/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-builder.service.ts new file mode 100644 index 000000000..8ca1d7e6a --- /dev/null +++ b/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-builder.service.ts @@ -0,0 +1,106 @@ +import { Injectable } from '@angular/core'; +import { DateCoercer, Dictionary } from '@hypertrace/common'; +import { GlobalGraphQlFilterService, GraphQlSelectionBuilder } from '@hypertrace/distributed-tracing'; +import { GraphQlArgument, GraphQlEnumArgument, GraphQlSelection } from '@hypertrace/graphql-client'; +import { INTERVAL_START_QUERY_KEY } from '../../../model/schema/explore'; +import { GraphQlGroupBy } from '../../../model/schema/groupby/graphql-group-by'; +import { ExploreSpecification } from '../../../model/schema/specifications/explore-specification'; +import { GraphQlObservabilityArgumentBuilder } from '../../builders/argument/graphql-observability-argument-builder'; +import { ExploreSpecificationBuilder } from '../../builders/specification/explore/explore-specification-builder'; +import { + GQL_EXPLORE_RESULT_INTERVAL_KEY, + GraphQlExploreRequest, + GraphQlExploreResponse, + GraphQlExploreResult, + GraphQlExploreResultValue, + GraphQlExploreServerResponse, + GraphQlExploreServerResult +} from './explore-query'; + +@Injectable({ providedIn: 'root' }) +export class ExploreGraphqlQueryBuilderService { + private readonly argBuilder: GraphQlObservabilityArgumentBuilder = new GraphQlObservabilityArgumentBuilder(); + private readonly selectionBuilder: GraphQlSelectionBuilder = new GraphQlSelectionBuilder(); + private readonly specBuilder: ExploreSpecificationBuilder = new ExploreSpecificationBuilder(); + private readonly dateCoercer: DateCoercer = new DateCoercer(); + + public constructor(private readonly globalGraphQlFilterService: GlobalGraphQlFilterService) {} + + public buildRequestArguments(request: GraphQlExploreRequest): GraphQlArgument[] { + return [ + { + name: 'context', + value: new GraphQlEnumArgument(request.context) + }, + this.argBuilder.forLimit(request.limit), + this.argBuilder.forTimeRange(request.timeRange), + ...this.argBuilder.forOffset(request.offset), + ...this.argBuilder.forInterval(request.interval), + ...this.buildFilters(request), + ...this.argBuilder.forGroupBy(request.groupBy), + ...this.argBuilder.forOrderBys(request.orderBy) + ]; + } + + protected buildFilters(request: GraphQlExploreRequest): GraphQlArgument[] { + return this.argBuilder.forFilters( + this.globalGraphQlFilterService.mergeGlobalFilters(request.context, request.filters) + ); + } + + public buildRequestSpecifications(request: GraphQlExploreRequest): GraphQlSelection[] { + return [ + ...this.getAnyIntervalSelections(request), + ...this.selectionBuilder.fromSpecifications(this.groupByAsSpecifications(request.groupBy)), + ...this.selectionBuilder.fromSpecifications(request.selections) + ]; + } + + public buildResponse(response: GraphQlExploreServerResponse, request: GraphQlExploreRequest): GraphQlExploreResponse { + return { + total: response.total, + results: response.results.map(result => this.convertResultRow(result, request)) + }; + } + + private convertResultRow(row: GraphQlExploreServerResult, request: GraphQlExploreRequest): GraphQlExploreResult { + return { + ...this.getIntervalResultFragment(row, request), + ...this.getSelectionResultFragment(row, this.groupByAsSpecifications(request.groupBy)), + ...this.getSelectionResultFragment(row, request.selections) + }; + } + + private getIntervalResultFragment( + row: GraphQlExploreServerResult, + request: GraphQlExploreRequest + ): Pick { + if (request.interval) { + return { + [GQL_EXPLORE_RESULT_INTERVAL_KEY]: this.dateCoercer.coerce(row[INTERVAL_START_QUERY_KEY]) + }; + } + + return {}; + } + + private getSelectionResultFragment( + row: GraphQlExploreServerResult, + specifications: ExploreSpecification[] + ): Pick { + return Object.assign( + {}, + ...specifications.map(specification => ({ + [specification.resultAlias()]: specification.extractFromServerData(row as Dictionary) + })) + ); + } + + private getAnyIntervalSelections(request: GraphQlExploreRequest): GraphQlSelection[] { + return request.interval ? [{ path: 'intervalStart', alias: INTERVAL_START_QUERY_KEY }] : []; + } + + private groupByAsSpecifications(groupBy?: GraphQlGroupBy): ExploreSpecification[] { + return (groupBy?.keys ?? []).map(key => this.specBuilder.exploreSpecificationForKey(key)); + } +} diff --git a/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-handler.service.test.ts b/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-handler.service.test.ts index ad34630c0..9eae3b3f1 100644 --- a/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-handler.service.test.ts +++ b/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-handler.service.test.ts @@ -16,12 +16,8 @@ import { ObservabilityEntityType } from '../../../model/schema/entity'; import { GraphQlIntervalUnit } from '../../../model/schema/interval/graphql-interval-unit'; import { ObservabilityTraceType } from '../../../model/schema/observability-traces'; import { ExploreSpecificationBuilder } from '../../builders/specification/explore/explore-specification-builder'; -import { - ExploreGraphQlQueryHandlerService, - EXPLORE_GQL_REQUEST, - GQL_EXPLORE_RESULT_INTERVAL_KEY, - GraphQlExploreRequest -} from './explore-graphql-query-handler.service'; +import { ExploreGraphQlQueryHandlerService } from './explore-graphql-query-handler.service'; +import { EXPLORE_GQL_REQUEST, GQL_EXPLORE_RESULT_INTERVAL_KEY, GraphQlExploreRequest } from './explore-query'; describe('Explore graphql query handler', () => { const createService = createServiceFactory({ diff --git a/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-handler.service.ts b/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-handler.service.ts index 05ed9bc69..1864a072f 100644 --- a/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-handler.service.ts +++ b/projects/observability/src/shared/graphql/request/handlers/explore/explore-graphql-query-handler.service.ts @@ -1,36 +1,19 @@ import { Injectable } from '@angular/core'; -import { DateCoercer, Dictionary, TimeDuration } from '@hypertrace/common'; +import { GraphQlHandlerType, GraphQlQueryHandler, GraphQlSelection } from '@hypertrace/graphql-client'; +import { ExploreGraphqlQueryBuilderService } from './explore-graphql-query-builder.service'; import { - GlobalGraphQlFilterService, - GraphQlFilter, - GraphQlSelectionBuilder, - GraphQlSortBySpecification, - GraphQlTimeRange -} from '@hypertrace/distributed-tracing'; -import { - GraphQlEnumArgument, - GraphQlHandlerType, - GraphQlQueryHandler, - GraphQlSelection -} from '@hypertrace/graphql-client'; -import { INTERVAL_START_QUERY_KEY } from '../../../model/schema/explore'; -import { GraphQlGroupBy } from '../../../model/schema/groupby/graphql-group-by'; -import { ExploreSpecification, ExploreValue } from '../../../model/schema/specifications/explore-specification'; -import { GraphQlObservabilityArgumentBuilder } from '../../builders/argument/graphql-observability-argument-builder'; -import { ExploreSpecificationBuilder } from '../../builders/specification/explore/explore-specification-builder'; + EXPLORE_GQL_REQUEST, + GraphQlExploreRequest, + GraphQlExploreResponse, + GraphQlExploreServerResponse +} from './explore-query'; -export const GQL_EXPLORE_RESULT_INTERVAL_KEY = Symbol('Interval Start'); @Injectable({ providedIn: 'root' }) export class ExploreGraphQlQueryHandlerService implements GraphQlQueryHandler { public readonly type: GraphQlHandlerType.Query = GraphQlHandlerType.Query; - private readonly argBuilder: GraphQlObservabilityArgumentBuilder = new GraphQlObservabilityArgumentBuilder(); - private readonly selectionBuilder: GraphQlSelectionBuilder = new GraphQlSelectionBuilder(); - private readonly specBuilder: ExploreSpecificationBuilder = new ExploreSpecificationBuilder(); - private readonly dateCoercer: DateCoercer = new DateCoercer(); - - public constructor(private readonly globalGraphQlFilterService: GlobalGraphQlFilterService) {} + public constructor(private readonly exploreGraphQlQueryBuilderService: ExploreGraphqlQueryBuilderService) {} public matchesRequest(request: unknown): request is GraphQlExploreRequest { return ( @@ -45,29 +28,11 @@ export class ExploreGraphQlQueryHandlerService return { path: 'explore', - arguments: [ - { - name: 'context', - value: new GraphQlEnumArgument(request.context) - }, - this.argBuilder.forLimit(request.limit), - this.argBuilder.forTimeRange(request.timeRange), - ...this.argBuilder.forOffset(request.offset), - ...this.argBuilder.forInterval(request.interval), - ...this.argBuilder.forFilters( - this.globalGraphQlFilterService.mergeGlobalFilters(request.context, request.filters) - ), - ...this.argBuilder.forGroupBy(request.groupBy), - ...this.argBuilder.forOrderBys(request.orderBy) - ], + arguments: this.exploreGraphQlQueryBuilderService.buildRequestArguments(request), children: [ { path: 'results', - children: [ - ...this.getAnyIntervalSelections(request), - ...this.selectionBuilder.fromSpecifications(this.groupByAsSpecifications(request.groupBy)), - ...this.selectionBuilder.fromSpecifications(request.selections) - ] + children: this.exploreGraphQlQueryBuilderService.buildRequestSpecifications(request) }, ...totalSelection ] @@ -78,94 +43,6 @@ export class ExploreGraphQlQueryHandlerService response: GraphQlExploreServerResponse, request: GraphQlExploreRequest ): GraphQlExploreResponse { - return { - total: response.total, - results: response.results.map(result => this.convertResultRow(result, request)) - }; - } - - private convertResultRow(row: GraphQlExploreServerResult, request: GraphQlExploreRequest): GraphQlExploreResult { - return { - ...this.getIntervalResultFragment(row, request), - ...this.getSelectionResultFragment(row, this.groupByAsSpecifications(request.groupBy)), - ...this.getSelectionResultFragment(row, request.selections) - }; - } - - private getIntervalResultFragment( - row: GraphQlExploreServerResult, - request: GraphQlExploreRequest - ): Pick { - if (request.interval) { - return { - [GQL_EXPLORE_RESULT_INTERVAL_KEY]: this.dateCoercer.coerce(row[INTERVAL_START_QUERY_KEY]) - }; - } - - return {}; - } - - private getSelectionResultFragment( - row: GraphQlExploreServerResult, - specifications: ExploreSpecification[] - ): Pick { - return Object.assign( - {}, - ...specifications.map(specification => ({ - [specification.resultAlias()]: specification.extractFromServerData(row as Dictionary) - })) - ); - } - - private getAnyIntervalSelections(request: GraphQlExploreRequest): GraphQlSelection[] { - return request.interval ? [{ path: 'intervalStart', alias: INTERVAL_START_QUERY_KEY }] : []; + return this.exploreGraphQlQueryBuilderService.buildResponse(response, request); } - - private groupByAsSpecifications(groupBy?: GraphQlGroupBy): ExploreSpecification[] { - return (groupBy?.keys ?? []).map(key => this.specBuilder.exploreSpecificationForKey(key)); - } -} - -export const EXPLORE_GQL_REQUEST = Symbol('GraphQL Query Request'); - -export interface GraphQlExploreRequest { - requestType: typeof EXPLORE_GQL_REQUEST; - selections: ExploreSpecification[]; - context: string; // Scope of Request. Example: Trace, Span - limit: number; - timeRange: GraphQlTimeRange; - offset?: number; - includeTotal?: boolean; - interval?: TimeDuration; - orderBy?: GraphQlSortBySpecification[]; - filters?: GraphQlFilter[]; - groupBy?: GraphQlGroupBy; -} - -export interface GraphQlExploreResponse { - total?: number; - results: GraphQlExploreResult[]; -} - -export interface GraphQlExploreResult { - [GQL_EXPLORE_RESULT_INTERVAL_KEY]?: Date; - - [key: string]: GraphQlExploreResultValue; -} - -type GraphQlExploreValueType = number | string | boolean | undefined; - -export interface GraphQlExploreResultValue extends ExploreValue { - units?: string; -} - -interface GraphQlExploreServerResponse { - total?: number; - results: GraphQlExploreServerResult[]; -} - -interface GraphQlExploreServerResult { - [INTERVAL_START_QUERY_KEY]?: string; - - [key: string]: GraphQlExploreResultValue | string | undefined; } diff --git a/projects/observability/src/shared/graphql/request/handlers/explore/explore-query.ts b/projects/observability/src/shared/graphql/request/handlers/explore/explore-query.ts new file mode 100644 index 000000000..0f99810b1 --- /dev/null +++ b/projects/observability/src/shared/graphql/request/handlers/explore/explore-query.ts @@ -0,0 +1,49 @@ +import { TimeDuration } from '@hypertrace/common'; +import { GraphQlFilter, GraphQlSortBySpecification, GraphQlTimeRange } from '@hypertrace/distributed-tracing'; +import { INTERVAL_START_QUERY_KEY } from '../../../model/schema/explore'; +import { GraphQlGroupBy } from '../../../model/schema/groupby/graphql-group-by'; +import { ExploreSpecification, ExploreValue } from '../../../model/schema/specifications/explore-specification'; + +export const EXPLORE_GQL_REQUEST = Symbol('GraphQL Query Request'); + +export const GQL_EXPLORE_RESULT_INTERVAL_KEY = Symbol('Interval Start'); + +export interface GraphQlExploreRequest { + requestType: typeof EXPLORE_GQL_REQUEST; + selections: ExploreSpecification[]; + context: string; // Scope of Request. Example: Trace, Span + limit: number; + timeRange: GraphQlTimeRange; + offset?: number; + includeTotal?: boolean; + interval?: TimeDuration; + orderBy?: GraphQlSortBySpecification[]; + filters?: GraphQlFilter[]; + groupBy?: GraphQlGroupBy; +} + +export interface GraphQlExploreResponse { + total?: number; + results: GraphQlExploreResult[]; +} + +export interface GraphQlExploreResult { + [GQL_EXPLORE_RESULT_INTERVAL_KEY]?: Date; + [key: string]: GraphQlExploreResultValue; +} + +type GraphQlExploreValueType = number | string | boolean | undefined; + +export interface GraphQlExploreResultValue extends ExploreValue { + units?: string; +} + +export interface GraphQlExploreServerResponse { + total?: number; + results: GraphQlExploreServerResult[]; +} + +export interface GraphQlExploreServerResult { + [INTERVAL_START_QUERY_KEY]?: string; + [key: string]: GraphQlExploreResultValue | string | undefined; +}