Documentation
¶
Overview ¶
Description: This file is used to collect metrics for the service.
Index ¶
- Constants
- Variables
- func FromContext(ctx context.Context) (string, bool)
- func GetTraceID(c *gin.Context) (string, bool)
- func GetTracer() oteltrace.Tracer
- func InitTracer(ctx context.Context, cfg *config.Trace) (*sdktrace.TracerProvider, error)
- func Meter() api.Meter
- func MetricsMiddleware(cfg *config.Metrics) func(c *gin.Context)
- func SetTracer(name string)
- func TraceFilter(cfg *config.Trace) func(c *gin.Context) bool
- func TraceID() gin.HandlerFunc
Constants ¶
View Source
const ( TraceIDHeader = "X-Trace-Id" TraceParentHeader = "traceparent" GinTraceIDKey = "trace_id" )
View Source
const (
// Called, generally means that the current service is invoked by another service
Callee = "callee"
)
Variables ¶
View Source
var ( // if data type is counter, otlp will add a _total suffix to the metric name, // so we use updowncounter to avoid this suffix RequestCount api.Float64UpDownCounter ErrRequestCount api.Float64UpDownCounter RequestTime api.Float64Histogram )
Functions ¶
func FromContext ¶
FromContext retrieves trace ID from context
func GetTraceID ¶
GetTraceID retrieves trace ID from gin context
func InitTracer ¶
func MetricsMiddleware ¶
MetricsMiddleware is a middleware that collects metrics
func TraceFilter ¶
TraceFilter returns a function that filters traces based on the configuration
func TraceID ¶
func TraceID() gin.HandlerFunc
TraceID returns a middleware that handles trace ID propagation
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.