middleware

package
v0.0.0-...-ae683e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adapt

func Adapt(h http.Handler, adapters ...Adapter) http.Handler

Adapt Iterate over adapters and run them one by one

func Log

func Log(combinedId string)

Types

type Adapter

type Adapter func(http.Handler) http.Handler

func LogRequestDetails

func LogRequestDetails(tracer *aristophanes.ClientTracer, traceConfig *handlers.TraceConfig, randomizer randomizer.Random) Adapter

LogRequestDetails is a middleware function that captures and logs details of incoming requests, and initiates traces based on the configured trace probabilities for specific GraphQL operations. It reads the incoming request body to extract the operation name and query from GraphQL requests. The middleware then checks the trace configuration to determine whether to initiate a trace for the given operation. If the trace probability condition is met, a trace is started using the provided tracer's StartTrace method. The trace ID is logged, and the middleware creates a new context with the trace ID to pass it along to downstream handlers.

Parameters: - tracer: The tracer instance used to initiate traces. - traceConfig: The configuration specifying the trace probabilities for specific operations.

Returns: An Adapter that wraps an http.Handler and performs the described middleware actions.

func SetCorsHeaders

func SetCorsHeaders() Adapter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL