dtcmiddleware

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package dtcmiddleware provides a middleware for the Developer Credit Tracker.

Index

Constants

This section is empty.

Variables

View Source
var (
	// MiddlewareLatency measures the latency of the middleware operations
	MiddlewareLatency = promauto.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "telemetry_credit_tracker_middleware_latency_seconds",
			Help:    "Latency of Credit Tracker Middleware operations in seconds",
			Buckets: prometheus.DefBuckets,
		},
	)

	// DCTRequestLatency measures the latency of DCT requests
	DCTRequestLatency = promauto.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "telemetry_credit_tracker_grpc_request_latency_seconds",
			Help:    "Latency of Credit Tracker GRPC requests in seconds",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"operation"},
	)
)

Functions

func GetSubjectAndTokenID added in v0.1.21

func GetSubjectAndTokenID(ctx context.Context) (string, *big.Int, *gqlerror.Error)

GetSubjectAndTokenID gets the subject and token ID from the context.

Types

type DCT

type DCT struct {
	Tracker *credittracker.Client
}

DCT provides a GraphQL middleware for the Developer Credit Tracker.

func NewDCT

func NewDCT(tracker *credittracker.Client) *DCT

NewDCT creates a new DCT middleware with default values.

func (DCT) ExtensionName

func (DCT) ExtensionName() string

ExtensionName returns the name of this extension.

func (DCT) InterceptResponse

func (d DCT) InterceptResponse(
	ctx context.Context,
	next graphql.ResponseHandler,
) *graphql.Response

InterceptResponse intercepts GraphQL responses to handle errors from the credit tracker.

func (DCT) Validate

func (DCT) 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