Documentation
¶
Index ¶
- Constants
- func ContextWithOperation(ctx context.Context, operation *OperationWithInfo) context.Context
- type Client
- type Execution
- type GenerateID
- type Metadata
- type Operation
- type OperationInfo
- type OperationWithInfo
- type Report
- type SendReport
- type Tracer
- func (tracer Tracer) ExtensionName() string
- func (tracer Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (interface{}, error)
- func (tracer Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
- func (tracer Tracer) Validate(schema graphql.ExecutableSchema) error
- type TracerOption
Constants ¶
View Source
const ( CLIENT_NAME = "go-gqlhive" CLIENT_VERSION = "1.0.3" )
Variables ¶
This section is empty.
Functions ¶
func ContextWithOperation ¶
func ContextWithOperation(ctx context.Context, operation *OperationWithInfo) context.Context
Types ¶
type GenerateID ¶
type GenerateID func(operation string, operationName nullable.TrimmedString) string
GenerateID creates unique operation IDs for the report.
type Operation ¶
type Operation struct { // Operation's body // e.g. "query me { me { id name } }" Operation string `json:"operation"` // Name of the operation // e.g. "me" OperationName nullable.TrimmedString `json:"operationName,omitempty"` // Schema coordinates // e.g. ["Query", "Query.me", "User", "User.id", "User.name"] Fields []string `json:"fields"` }
type OperationInfo ¶
type OperationWithInfo ¶
type OperationWithInfo struct { Operation OperationInfo }
func OperationFromContext ¶
func OperationFromContext(ctx context.Context) (operation *OperationWithInfo, exists bool)
type Report ¶
type Report struct { // Number of operations being reported Size uint `json:"size"` // The executed operations Operations map[string]*Operation `json:"map"` // Info about each operation's execution OperationInfos []*OperationInfo `json:"operations"` }
type SendReport ¶
SendReport performs the actual report sending to GraphQL Hive.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
func NewTracer ¶
func NewTracer(token string, opts ...TracerOption) *Tracer
func (Tracer) ExtensionName ¶
func (Tracer) InterceptField ¶
func (Tracer) InterceptResponse ¶
func (tracer Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
InterceptResponse intercepts the incoming request.
type TracerOption ¶
type TracerOption interface {
// contains filtered or unexported methods
}
func WithEndpoint ¶
func WithEndpoint(endpoint string) TracerOption
WithEndpoint sets the endpoint to where the reports are sent. Defaults to "https://app.graphql-hive.com/usage".
func WithGenerateID ¶
func WithGenerateID(fn GenerateID) TracerOption
WithGenerateID sets the unique operation ID generator for the reports. Defaults to generating v4 UUIDs.
func WithSendReport ¶
func WithSendReport(fn SendReport) TracerOption
WithSendReport sets the report sender to GraphQL Hive.
func WithSendReportTimeout ¶
func WithSendReportTimeout(timeout time.Duration) TracerOption
WithSendReportTimeout sets the report sending debounce timeout. Executed operations will queue up and then be flushed/sent to GraphQL Hive after the timeout expires.
Click to show internal directories.
Click to hide internal directories.