Documentation ¶
Index ¶
- Constants
- Variables
- func CalcRequestDurations(ctx *gin.Context, start time.Time)
- func CalcRequests(ctx *gin.Context)
- func EndTracingOtel(span trace.Span, code codes.Code, message string)
- func GetTraceIDFromContext(ctx context.Context) string
- func GetTraceIDXRay(span trace.Span) string
- func GetTraceIDXRaySegment(ctx context.Context, path string) (context.Context, *xray.Segment)
- func InitMetrics(router *gin.Engine)
- func InitObservability(router *gin.Engine)
- func InitOtel(router *gin.Engine) error
- func InitTracingOtel(router *gin.Engine)
- func InitTracingXRay(router *gin.Engine)
- func SetDuration(ctx *gin.Context, start time.Time)
- func SetMetrics(ctx *gin.Context)
- func SetTracingOtel() gin.HandlerFunc
- func StartTracingOtel(ctx context.Context, name string) (context.Context, trace.Span)
- func WriteResponseXRay(span trace.Span, w http.ResponseWriter)
- func WriteResponseXRaySegment(segment *xray.Segment, w http.ResponseWriter)
- func XrayMiddleware() gin.HandlerFunc
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 CalcRequests ¶
func GetTraceIDFromContext ¶
GetTraceIDFromContext returns the trace ID from the provided context
func GetTraceIDXRay ¶
GetXrayTraceID generates a trace ID in Xray format from the span context.
func GetTraceIDXRaySegment ¶
func InitMetrics ¶
func InitObservability ¶
func InitTracingOtel ¶
func InitTracingXRay ¶
func SetMetrics ¶
func SetTracingOtel ¶
func SetTracingOtel() gin.HandlerFunc
func StartTracingOtel ¶
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.
Click to show internal directories.
Click to hide internal directories.