Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Context is needed for tracing to access the current span, in order to add tags to it, or create child spans. As presently defined (without a context), this cannot be done: new spans could be created, but they would not be associated with the existing request trace. OpenTracingTracer implements the new interface (it never implemented the old one). Via this 'extension interface', the tracer configured (or the default tracer) will be used as the validation tracer if: * The tracer implements the (optional) interface; and * A validation tracer isn't provided using the deprecated option What this means is that the deprecated option is _preferred_ as an override. This allows users to migrate in a non-breaking, non-behaviour changing way, until such time as they intentionally remove the use of the deprecated option. For those who are currently using the default tracer, and not supplying a validation tracer, validation will be traced immediately with no change required to configuration options.
- Loading branch information
Showing
4 changed files
with
49 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
package trace | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/graph-gophers/graphql-go/errors" | ||
) | ||
|
||
type TraceValidationFinishFunc = TraceQueryFinishFunc | ||
|
||
// Deprecated: use ValidationTracerContext. | ||
type ValidationTracer interface { | ||
TraceValidation() TraceValidationFinishFunc | ||
} | ||
|
||
type ValidationTracerContext interface { | ||
TraceValidation(ctx context.Context) TraceValidationFinishFunc | ||
} | ||
|
||
type NoopValidationTracer struct{} | ||
|
||
// Deprecated: use a Tracer which implements ValidationTracerContext. | ||
func (NoopValidationTracer) TraceValidation() TraceValidationFinishFunc { | ||
return func(errs []*errors.QueryError) {} | ||
} |