Skip to content

Commit b1093cb

Browse files
refactor: switch to string entity type argument
1 parent be12e40 commit b1093cb

File tree

8 files changed

+12
-20
lines changed

8 files changed

+12
-20
lines changed

projects/distributed-tracing/src/shared/graphql/request/builders/argument/graphql-argument-builder.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ describe('Graphql Argument Builder', () => {
6868
);
6969
});
7070

71-
test('construct arguments for entity type correctly', () => {
72-
expect(argBuilder.forTraceType('entity-type')).toEqual(
73-
expect.objectContaining({ name: 'type', value: new GraphQlEnumArgument('entity-type') })
71+
test('construct arguments for entity scope correctly', () => {
72+
expect(argBuilder.forScope('entity-type')).toEqual(
73+
expect.objectContaining({ name: 'scope', value: 'entity-type' })
7474
);
7575
});
7676

projects/distributed-tracing/src/shared/graphql/request/builders/argument/graphql-argument-builder.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { GraphQlArgument, GraphQlEnumArgument } from '@hypertrace/graphql-client';
2-
import { EntityType } from '@hypertrace/observability';
32
import { GraphQlFilter } from '../../../model/schema/filter/graphql-filter';
43
import { GraphQlSortBySpecification } from '../../../model/schema/sort/graphql-sort-by-specification';
54
import { GraphQlTimeRange } from '../../../model/schema/timerange/graphql-time-range';
@@ -75,7 +74,7 @@ export class GraphQlArgumentBuilder {
7574
};
7675
}
7776

78-
public forEntityType(type: EntityType): GraphQlArgument {
79-
return { name: 'type', value: new GraphQlEnumArgument(type) };
77+
public forScope(scope: string): GraphQlArgument {
78+
return { name: 'scope', value: scope };
8079
}
8180
}

projects/observability/src/shared/graphql/request/builders/argument/graphql-observability-argument-builder.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ import { GraphQlIntervalUnit } from '../../../model/schema/interval/graphql-inte
1313
import { convertToGraphQlIntervalUnit } from '../specification/metric/metric-interval-unit-converter';
1414

1515
export class GraphQlObservabilityArgumentBuilder extends GraphQlArgumentBuilder {
16-
public forEntityType(type: EntityType): GraphQlArgument {
17-
return {
18-
name: 'type',
19-
value: new GraphQlEnumArgument(type)
20-
};
21-
}
22-
2316
public forIncludeInactive(includeInactive?: boolean): GraphQlArgument[] {
2417
return includeInactive !== undefined ? [{ name: 'includeInactive', value: includeInactive }] : [];
2518
}

projects/observability/src/shared/graphql/request/handlers/entities/query/entities-graphql-query-builder.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class EntitiesGraphqlQueryBuilderService {
3434

3535
public buildRequestArguments(request: GraphQlEntitiesRequest): GraphQlArgument[] {
3636
return [
37-
this.argBuilder.forEntityType(request.entityType),
37+
this.argBuilder.forScope(request.entityType),
3838
this.argBuilder.forLimit(request.limit),
3939
this.argBuilder.forTimeRange(request.timeRange),
4040
...this.argBuilder.forOffset(request.offset),

projects/observability/src/shared/graphql/request/handlers/entities/query/entities-graphql-query-handler.service.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('Entities graphql query handler', () => {
7777
): GraphQlSelection => ({
7878
path: 'entities',
7979
arguments: [
80-
{ name: 'type', value: new GraphQlEnumArgument(entityType) },
80+
{ name: 'scope', value: entityType },
8181
{ name: 'limit', value: limit },
8282
{
8383
name: 'between',
@@ -201,7 +201,7 @@ describe('Entities graphql query handler', () => {
201201
expect(spectator.service.convertRequest(requestWithAvgrates)).toEqual({
202202
path: 'entities',
203203
arguments: [
204-
{ name: 'type', value: new GraphQlEnumArgument(ObservabilityEntityType.Service) },
204+
{ name: 'scope', value: ObservabilityEntityType.Service },
205205
{ name: 'limit', value: 30 },
206206
{
207207
name: 'between',
@@ -327,7 +327,7 @@ describe('Entities graphql query handler', () => {
327327
expect(spectator.service.convertRequest(requestWithAvgrates)).toEqual({
328328
path: 'entities',
329329
arguments: [
330-
{ name: 'type', value: new GraphQlEnumArgument(ObservabilityEntityType.Service) },
330+
{ name: 'scope', value: ObservabilityEntityType.Service },
331331
{ name: 'limit', value: 30 },
332332
{
333333
name: 'between',

projects/observability/src/shared/graphql/request/handlers/entities/query/interactions/interactions-graphql-query-handler.service.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('Interactions graphql query handler', () => {
7373
expect(spectator.service.convertRequest(buildRequest())).toEqual({
7474
path: 'entities',
7575
arguments: [
76-
{ name: 'type', value: new GraphQlEnumArgument(ObservabilityEntityType.Backend) },
76+
{ name: 'scope', value: ObservabilityEntityType.Backend },
7777
{ name: 'limit', value: 1 },
7878
{
7979
name: 'between',

projects/observability/src/shared/graphql/request/handlers/entities/query/topology/entity-topology-graphql-query-handler.service.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ describe('Entity topology graphql query handler', () => {
242242
expect(spectator.service.convertRequest(request)).toEqual({
243243
path: 'entities',
244244
arguments: [
245-
{ name: 'type', value: new GraphQlEnumArgument(ObservabilityEntityType.Service) },
245+
{ name: 'scope', value: ObservabilityEntityType.Service },
246246
{ name: 'limit', value: 100 },
247247
{
248248
name: 'between',

projects/observability/src/shared/graphql/request/handlers/entities/query/topology/entity-topology-graphql-query-handler.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class EntityTopologyGraphQlQueryHandlerService
3737
return {
3838
path: 'entities',
3939
arguments: [
40-
this.argBuilder.forEntityType(request.rootNodeType),
40+
this.argBuilder.forScope(request.rootNodeType),
4141
this.argBuilder.forLimit(request.rootNodeLimit),
4242
this.argBuilder.forTimeRange(request.timeRange),
4343
...this.argBuilder.forFilters(

0 commit comments

Comments
 (0)