Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTraceLoggerObservability ¶
func NewTraceLoggerObservability(trace trace.Tracer, logger logger.LoggerInterface, counter *prometheus.CounterVec, duration *prometheus.HistogramVec) *traceLoggerObservability
NewTraceLoggerObservability creates a new traceLoggerObservability instance.
It takes context.Context, trace.Tracer, logger.LoggerInterface, prometheus.CounterVec, and prometheus.HistogramVec as input.
The returned traceLoggerObservability instance includes the input parameters and can be used to start tracing and logging, as well as recording metrics.
If the input context is canceled, the tracing and logging will be stopped.
Types ¶
type TraceLoggerObservability ¶
type TraceLoggerObservability interface {
StartTracingAndLogging(ctx context.Context, method string, attrs ...attribute.KeyValue) (
context.Context,
trace.Span,
func(string),
string,
func(string, ...zap.Field),
)
// RecordMetrics records a Prometheus metric for the given method and status.
// It increments a counter and records the duration since the provided start time.
RecordMetrics(method, status string, start time.Time)
}
TraceLoggerObservability provides tracing, logging, and request metrics.
Click to show internal directories.
Click to hide internal directories.