observability

package
v0.0.0-...-17fa858 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const CpuUsage = "cpu_usage"
View Source
const LatencyTime = "latency_time"
View Source
const ServiceName = "bookstore-adot"
View Source
const ThreadsActive = "threads_active"
View Source
const TimeAlive = "time_alive"

Names for metric instruments

View Source
const TotalApiRequests = "total_api_requests"
View Source
const TotalBytesSent = "total_bytes_sent"
View Source
const TotalHeapSize = "total_heap_size"

Variables

View Source
var RandomMetricCommonLabels = []attribute.KeyValue{
	attribute.String("signal", "metric"),
	attribute.String("language", ServiceName),
	attribute.String("metricType", "random"),
}
View Source
var RequestMetricCommonLabels = []attribute.KeyValue{
	attribute.String("signal", "metric"),
	attribute.String("language", ServiceName),
	attribute.String("metricType", "request"),
}

Common attributes for traces and metrics (random, request)

View Source
var TestingId = ""
View Source
var TraceCommonLabels = []attribute.KeyValue{
	attribute.String("signal", "trace"),
	attribute.String("language", ServiceName),
}
View Source
var Tracer = otel.Tracer("github.com/devopscorner/golang-adot/src/observability")

Functions

func CalcRequestDurations

func CalcRequestDurations(ctx *gin.Context, start time.Time)

func CalcRequests

func CalcRequests(ctx *gin.Context)

func EndTracingOtel

func EndTracingOtel(span trace.Span, code codes.Code, message string)

func GetTraceIDFromContext

func GetTraceIDFromContext(ctx context.Context) string

GetTraceIDFromContext returns the trace ID from the provided context

func GetTraceIDXRay

func GetTraceIDXRay(span trace.Span) string

GetXrayTraceID generates a trace ID in Xray format from the span context.

func GetTraceIDXRaySegment

func GetTraceIDXRaySegment(ctx context.Context, path string) (context.Context, *xray.Segment)

func InitMetrics

func InitMetrics(router *gin.Engine)

func InitObservability

func InitObservability(router *gin.Engine)

func InitOtel

func InitOtel(router *gin.Engine) error

func InitTracingOtel

func InitTracingOtel(router *gin.Engine)

func InitTracingXRay

func InitTracingXRay(router *gin.Engine)

func SetDuration

func SetDuration(ctx *gin.Context, start time.Time)

func SetMetrics

func SetMetrics(ctx *gin.Context)

func SetTracingOtel

func SetTracingOtel() gin.HandlerFunc

func StartTracingOtel

func StartTracingOtel(ctx context.Context, name string) (context.Context, trace.Span)

func WriteResponseXRay

func WriteResponseXRay(span trace.Span, w http.ResponseWriter)

func WriteResponseXRaySegment

func WriteResponseXRaySegment(segment *xray.Segment, w http.ResponseWriter)

func XrayMiddleware

func XrayMiddleware() gin.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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