metrics

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFieldCountRange

func GetFieldCountRange(count int) string

GetFieldCountRange returns a string representation of the field count range.

func Register

func Register()

Register registers metrics with the default Prometheus registerer.

func RegisterOn

func RegisterOn(registerer prometheus.Registerer)

RegisterOn registers metrics with the provided Prometheus registerer.

func UnRegister

func UnRegister()

UnRegister unregisters all metrics from the default Prometheus registerer.

func UnRegisterFrom

func UnRegisterFrom(registerer prometheus.Registerer)

UnRegisterFrom unregisters all metrics from the provided Prometheus registerer.

Types

type FieldCountRange

type FieldCountRange string

FieldCountRange categorizes requests by field count.

const (
	// FieldCountTiny represents requests with 0-5 fields.
	FieldCountTiny FieldCountRange = "tiny"
	// FieldCountSmall represents requests with 6-10 fields.
	FieldCountSmall FieldCountRange = "small"
	// FieldCountMedium represents requests with 11-20 fields.
	FieldCountMedium FieldCountRange = "medium"
	// FieldCountLarge represents requests with 21-40 fields.
	FieldCountLarge FieldCountRange = "large"
	// FieldCountHuge represents requests with 41+ fields.
	FieldCountHuge FieldCountRange = "huge"
)

type Tracer

type Tracer struct{}

Tracer provides a GraphQL middleware for collecting Prometheus metrics.

func (Tracer) ExtensionName

func (a Tracer) ExtensionName() string

ExtensionName returns the name of this extension.

func (Tracer) InterceptField

func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (any, error)

InterceptField intercepts GraphQL field resolution to track metrics.

func (Tracer) InterceptOperation

func (a Tracer) InterceptOperation(
	ctx context.Context,
	next graphql.OperationHandler,
) graphql.ResponseHandler

InterceptOperation intercepts GraphQL operations to track metrics.

func (Tracer) InterceptResponse

func (a Tracer) InterceptResponse(
	ctx context.Context,
	next graphql.ResponseHandler,
) *graphql.Response

InterceptResponse intercepts GraphQL responses to record metrics.

func (Tracer) Validate

func (a Tracer) Validate(schema graphql.ExecutableSchema) error

Validate validates the GraphQL schema.

Jump to

Keyboard shortcuts

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