Skip to content

Commit 6a407ec

Browse files
committed
fix otel too
1 parent ced5c9a commit 6a407ec

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

packages/plugins/opentelemetry/tests/useOpenTelemetry.spec.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import {
5151
SpanProcessor,
5252
TraceIdRatioBasedSampler,
5353
} from '@opentelemetry/sdk-trace-base';
54+
import { usingHiveRouterQueryPlanner } from '~internal/env';
5455
import { beforeEach, describe, expect, it, MockedFunction, vi } from 'vitest';
5556
import { hive } from '../src/api';
5657
import type {
@@ -1225,7 +1226,10 @@ describe('useOpenTelemetry', () => {
12251226
[SEMATTRS_HTTP_SCHEME]: 'http:',
12261227
[SEMATTRS_NET_HOST_NAME]: 'localhost',
12271228
[SEMATTRS_HTTP_HOST]: 'localhost:4000',
1228-
[SEMATTRS_HTTP_STATUS_CODE]: 200,
1229+
[SEMATTRS_HTTP_STATUS_CODE]: usingHiveRouterQueryPlanner()
1230+
? // 500 because there wont be a data field with hive router query planner and it's a application graphql response json
1231+
500
1232+
: 200,
12291233

12301234
// Hive specific
12311235
['hive.client.name']: 'test-client-name',
@@ -1259,9 +1263,17 @@ describe('useOpenTelemetry', () => {
12591263
[SEMATTRS_HTTP_STATUS_CODE]: 500,
12601264

12611265
// Operation Attributes
1262-
[SEMATTRS_GRAPHQL_DOCUMENT]: 'query testOperation{__typename hello}',
1263-
[SEMATTRS_GRAPHQL_OPERATION_TYPE]: 'query',
1264-
[SEMATTRS_GRAPHQL_OPERATION_NAME]: 'testOperation',
1266+
...(usingHiveRouterQueryPlanner()
1267+
? {
1268+
[SEMATTRS_GRAPHQL_DOCUMENT]: '{hello}',
1269+
[SEMATTRS_GRAPHQL_OPERATION_TYPE]: 'query',
1270+
}
1271+
: {
1272+
[SEMATTRS_GRAPHQL_DOCUMENT]:
1273+
'query testOperation{__typename hello}',
1274+
[SEMATTRS_GRAPHQL_OPERATION_TYPE]: 'query',
1275+
[SEMATTRS_GRAPHQL_OPERATION_NAME]: 'testOperation',
1276+
}),
12651277

12661278
// Federation attributes
12671279
[SEMATTRS_HIVE_GATEWAY_UPSTREAM_SUBGRAPH_NAME]: 'upstream',

0 commit comments

Comments
 (0)