Documentation ¶
Index ¶
Constants ¶
const ( OTLP_HTTP_MODE = "otlp/http" // HTTP mode for OTLP communication OTLP_GRPC_MODE = "otlp/grpc" // gRPC mode for OTLP communication CONSOLE_MODE = "console" // Console mode, possibly for debugging )
OTLP communication modes
Variables ¶
This section is empty.
Functions ¶
func InitMeterProvider ¶
func InitMeterProvider(config config.Config) (*sdkmetric.MeterProvider, error)
InitMeterProvider initializes and returns an OpenTelemetry MeterProvider based on the provided configuration. The function sets up a metric exporter based on the observability mode specified in the configuration and creates a MeterProvider with the specified interval for exporting metrics.
Parameters: - config: Configuration containing observability mode and application details.
Returns: - A pointer to an OpenTelemetry MeterProvider. - An error if any occurs during initialization or setting up the provider.
func InitTracerProvider ¶
func InitTracerProvider(config config.Config) (*sdktrace.TracerProvider, error)
initializeTracerProvider initializes and configures a tracer provider based on the observability mode from the configuration. It supports OTLP gRPC, OTLP HTTP, and stdout (default) exporters for trace data. Returns a tracer provider instance or an error if initialization fails.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger: A utility structure containing both a standard Go logger and a zerolog logger. It also provides methods to retrieve each logger instance and to set the log level dynamically.
func NewZeroLog ¶
NewZeroLog: Creates a new logger with tracing information extracted from the provided context.
func NewZeroLogHook ¶
func NewZeroLogHook() *Logger
NewZeroLogHook: Creates a new logger with a zerolog hook for tracing.
func (*Logger) Level ¶
Level: Sets the log level for the zerolog logger and updates the standard logger accordingly.
type TracingHook ¶
type TracingHook struct{}
TracingHook: Custom hook for zerolog that extracts tracing information from the context and adds it to the log entry.