telemetry

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(next http.Handler, opts ...MiddlewareOption) http.Handler

Middleware is a simple OpenTelemetry HTTP middleware.

func NewGCPMeterProvider

func NewGCPMeterProvider(ctx context.Context, projectID string) (*sdkmetric.MeterProvider, error)

NewGCPMeterProvider returns a new OpenTelemetry MeterProvider with a Google Cloud Monitoring exporter.

func NewGCPTracerProvider

func NewGCPTracerProvider(ctx context.Context, projectID string, tracingRatio float64) (*sdktrace.TracerProvider, error)

NewGCPTracerProvider returns a new OpenTelemetry TracerProvider with a Google Cloud Trace exporter.

Types

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

func NewMetrics

func NewMetrics(meter *metric.Meter) *Metrics

NewMetrics returns a new Metrics instance.

func (*Metrics) IncreaseRequestCounter

func (m *Metrics) IncreaseRequestCounter(ctx context.Context, method string)

IncreaseRequestCounter increases the request counter by 1.

func (*Metrics) RecordRequestDuration

func (m *Metrics) RecordRequestDuration(ctx context.Context, method string, duration time.Duration)

RecordRequestDuration records the request duration in milliseconds.

type MiddlewareOption

type MiddlewareOption func(*middlewareOptions)

func WithExcludedPrefixes

func WithExcludedPrefixes(prefixes []string) MiddlewareOption

WithExcludedPrefixes sets the excluded paths for the middleware.

Jump to

Keyboard shortcuts

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