@@ -67,6 +67,7 @@ import {
67
67
getSpanProcessors ,
68
68
getTracerProvider ,
69
69
MockLogRecordExporter ,
70
+ MockSpanExporter ,
70
71
setupOtelForTests ,
71
72
spanExporter ,
72
73
} from './utils' ;
@@ -768,7 +769,41 @@ describe('useOpenTelemetry', () => {
768
769
initSpan . expectChild ( 'http.fetch' ) ;
769
770
} ) ;
770
771
} ) ;
772
+
773
+ it ( 'should handle validation error with hive processor' , async ( ) => {
774
+ disableAll ( ) ;
775
+ const spanExporter = new MockSpanExporter ( ) ;
776
+ const traceProvider = new BasicTracerProvider ( {
777
+ spanProcessors : [
778
+ new HiveTracingSpanProcessor ( {
779
+ processor : new SimpleSpanProcessor ( spanExporter ) ,
780
+ } ) ,
781
+ ] ,
782
+ } ) ;
783
+ setupOtelForTests ( { traceProvider } ) ;
784
+ await using gateway = await buildTestGatewayForCtx ( {
785
+ plugins : ( { fetch } ) => {
786
+ return [
787
+ {
788
+ onPluginInit ( ) {
789
+ fetch ( 'http://foo.bar' , { } ) ;
790
+ } ,
791
+ } ,
792
+ ] ;
793
+ } ,
794
+ } ) ;
795
+ await gateway . query ( {
796
+ body : { query : 'query test{ unknown }' } ,
797
+ shouldReturnErrors : true ,
798
+ } ) ;
799
+
800
+ const operationSpan = spanExporter . assertRoot ( 'graphql.operation' ) ;
801
+ operationSpan . span . attributes [ 'graphql.operation.name' ] === 'test' ;
802
+ operationSpan . span . attributes [ 'graphql.operation.type' ] === 'query' ;
803
+ operationSpan . span . attributes [ 'hive.graphql.error.count' ] === 1 ;
804
+ } ) ;
771
805
} ) ;
806
+
772
807
it ( 'should allow to create custom spans without explicit context passing' , async ( ) => {
773
808
const expectedCustomSpans = {
774
809
http : { root : 'POST /graphql' , children : [ 'custom.request' ] } ,
0 commit comments