You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/queries/multiplex.md
+9-11Lines changed: 9 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Some clients may send _several_ queries to the server at once (for example, [Apo
12
12
13
13
Multiplex runs have their own context, analyzers and instrumentation.
14
14
15
-
__NOTE:__ As an implementation detail, _all_ queries are run inside multiplexes. That is, a stand-alone query is executed as a "multiplex of one", so instrumentation and multiplex analyzers and instrumentation_will_ apply to standalone queries run with `MySchema.execute(...)`.
15
+
__NOTE:__ As an implementation detail, _all_ queries run inside multiplexes. That is, a stand-alone query is executed as a "multiplex of one", so instrumentation and multiplex analyzers and tracers_will_ apply to standalone queries run with `MySchema.execute(...)`.
16
16
17
17
## Concurrent Execution
18
18
@@ -84,7 +84,7 @@ end
84
84
85
85
## Validation and Error Handling
86
86
87
-
Each query is validated and {% internal_link "analyzed","/queries/ast_analysis" %} independently. The `results` array may include a mix of successful results and failed results
87
+
Each query is validated and {% internal_link "analyzed","/queries/ast_analysis" %} independently. The `results` array may include a mix of successful results and failed results.
88
88
89
89
## Multiplex-Level Context
90
90
@@ -111,31 +111,29 @@ The API is the same as {% internal_link "query analyzers","/queries/ast_analysis
111
111
112
112
Multiplex analyzers may return {{ "AnalysisError" | api_doc }} to halt execution of the whole multiplex.
113
113
114
-
## Multiplex Instrumentation
114
+
## Multiplex Tracing
115
115
116
-
You can add hooks for each multiplex run with multiplex instrumentation.
116
+
You can add hooks for each multiplex run with {% internal_link "trace modules", "/queries/tracing" %}.
117
117
118
-
An instrumenter must implement `.before_multiplex(multiplex)`and `.after_multiplex(multiplex)`. Then, it can be mounted with `instrument(:multiplex, MyMultiplexAnalyzer)`. See {{ "Execution::Multiplex" | api_doc }} for available methods.
118
+
The trace module may implement `def execute_multiplex(multiplex:)`which `yield`s to allow the multiplex to execute. See {{ "Execution::Multiplex" | api_doc }} for available methods.
119
119
120
120
For example:
121
121
122
122
```ruby
123
123
# Count how many queries are in the multiplex run:
0 commit comments