Skip to content

Commit fbe883d

Browse files
committed
improve resolver execution
1 parent 9d5df68 commit fbe883d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

spec/spans.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ groups:
5050
**Span name** SHOULD be `GraphQL Document Parsing`.
5151
5252
This span covers the parsing phase of GraphQL request processing,
53-
where the document string is parsed into an abstract syntax tree.
53+
where the document string is parsed into an abstract syntax tree (AST).
5454
attributes:
5555
- ref: graphql.operation.type
5656
requirement_level: required
@@ -140,6 +140,27 @@ groups:
140140
This span covers the execution of an individual field resolver,
141141
including both synchronous and asynchronous resolvers.
142142
The span ends when the resolver result is available.
143+
144+
> **Warning**
145+
> Creating spans for every resolver execution can result in traces with
146+
> hundreds or thousands of spans, severely impacting performance and
147+
> trace readability. Instrumentations MUST NOT create resolver execution
148+
> spans by default for all resolvers.
149+
150+
Instrumentations SHOULD provide configuration options to control which
151+
resolvers generate spans. Recommended strategies include:
152+
153+
- **Manual selection**: Allow developers to explicitly mark specific
154+
resolvers for tracing (e.g., via annotations, decorators, or configuration)
155+
- **Asynchronous resolvers only**: Only trace resolvers that return
156+
promises or other asynchronous constructs
157+
- **Depth-based filtering**: Only trace resolvers at the top N levels
158+
of the query (e.g., top 2 levels)
159+
- **Performance-based filtering**: Only trace resolvers that exceed
160+
a certain execution time threshold
161+
162+
The selection criteria SHOULD be documented clearly for users to
163+
understand which resolvers will generate spans.
143164
attributes:
144165
- ref: graphql.selection.name
145166
requirement_level: recommended

0 commit comments

Comments
 (0)