File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
packages/plugins/opentelemetry/src Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @graphql-hive/plugin-opentelemetry ' : patch
3
+ ---
4
+
5
+ Fix missing attributes when a graphql operation parsing or validation fails.
Original file line number Diff line number Diff line change @@ -78,7 +78,8 @@ export class HiveTracingSpanProcessor implements SpanProcessor {
78
78
return ;
79
79
}
80
80
81
- if ( span . name . startsWith ( 'graphql.operation' ) ) {
81
+ if ( isOperationSpan ( span ) ) {
82
+ span . setAttribute ( 'hive.graphql' , true )
82
83
traceState ?. operationRoots . set ( spanId , span as SpanImpl ) ;
83
84
return ;
84
85
}
@@ -200,6 +201,14 @@ function copyAttribute(
200
201
target . attributes [ targetAttrName ] = source . attributes [ sourceAttrName ] ;
201
202
}
202
203
204
+ function isOperationSpan ( span : Span ) : boolean {
205
+ if ( ! span . name . startsWith ( 'graphql.operation' ) ) {
206
+ return false ;
207
+ }
208
+ const followingChar = span . name . at ( 17 ) ;
209
+ return ! followingChar || followingChar === ' ' ;
210
+ }
211
+
203
212
const SPANS_WITH_ERRORS = [
204
213
'graphql.parse' ,
205
214
'graphql.validate' ,
You can’t perform that action at this time.
0 commit comments