Documentation
¶
Overview ¶
Package config provides the configuration for the logger and the monitoring. The package also provides the Otel convention for root labels.
Index ¶
Constants ¶
const ( SERVICE_NAME = string(semconv.ServiceNameKey) SERVICE_VERSION = string(semconv.ServiceVersionKey) SERVICE_INTANCE_ID = string(semconv.ServiceInstanceIDKey) )
attribute names for the common tags that will be applied to every trace, span and log
const ( FILE_PATH = string(semconv.CodeFilepathKey) LINE_NUMBER = string(semconv.CodeLineNumberKey) FUNCTION_NAME = string(semconv.CodeFunctionKey) FUNCTION_PACKAGE_NAME = string(semconv.CodeNamespaceKey) )
attribute names for the caller tags that will be applied to every trace, span and log
const ( LOG_MESSAGE_KEY = "message" LOG_ERROR_KEY = "error" LOG_METADATA_KEY = "metadata" )
attribute names for the logger
const (
EXPORTER_PROTOCOL = "otel.exporter.protocol"
)
exporter attributes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
LogLevelCfg string `env:"LOG_LEVEL" envDefault:"info"`
Monitoring
}
func NewLoggerConfig ¶
LoggerConfig returns the Logger configuration from the environment.
type LoggerConfig ¶
type Monitoring ¶
type Monitoring struct {
ServiceCfg string `env:"OTEL_SERVICE_NAME"`
ExporterProtocolCfg string `env:"OTEL_EXPORTER_OTLP_PROTOCOL"` // Specifies the OTLP transport protocol to be used for all telemetry data.
ExporterTraceProtocolCfg string `env:"OTEL_EXPORTER_OTLP_TRACES_PROTOCOL"` // Specifies the OTLP transport protocol to be used for trace data.
ExporterMetricsProtocolCfg string `env:"OTEL_EXPORTER_OTLP_METRICS_PROTOCOL"` // Specifies the OTLP transport protocol to be used for metric data.
TestExporterCfg bool `env:"OTEL_EXPORTER_OTLP_TEST"` // Specifies whether the OTLP exporter should be used in test mode.
}
func NewMonitoringConfig ¶
func NewMonitoringConfig(opts ...Option) Monitoring
func (Monitoring) ExporterMetricsProtocol ¶
func (d Monitoring) ExporterMetricsProtocol() string
ExporterMetricsProtocol returns the protocol used by the OTLP Metrics exporter.
func (Monitoring) ExporterTracesProtocol ¶
func (d Monitoring) ExporterTracesProtocol() string
ExporterTracesProtocol returns the protocol used by the OTLP Trace exporter.
func (Monitoring) IsTestExporter ¶
func (d Monitoring) IsTestExporter() bool
IsTestExporter returns whether the OTLP exporter should be used in test mode.
func (Monitoring) Service ¶
func (d Monitoring) Service() string
Service returns the service name for application tagging.