Documentation ¶
Overview ¶
Package metrics provides a way to initialize OpenTelemetry metrics and Prometheus collectors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collector ¶
type Collector interface { // GetRegistry returns the prometheus registry instance containing the registered prometheus collectors GetRegistry() *prometheus.Registry }
Collector is the interface that wraps the basic methods of the Prometheus collector
type Config ¶
type Config struct { // Exporter is the otlp exporter used to export the traces Exporter Exporter `yaml:"exporter" mapstructure:"exporter"` // Url is the Url of the collector to which the traces are exported Url string `yaml:"url" mapstructure:"url"` // Token is the token used to authenticate with the collector Token string `yaml:"token" mapstructure:"token"` // CertPath is the path to the tls certificate file CertPath string `yaml:"certPath" mapstructure:"certPath"` }
Config holds the configuration for OpenTelemetry
type ErrAlreadyInitialized ¶
type ErrAlreadyInitialized struct {
// contains filtered or unexported fields
}
ErrAlreadyInitialized is an error that is returned when the metrics are already initialized. This error is returned when the Initialize method is called more than once.
func (*ErrAlreadyInitialized) Error ¶
func (e *ErrAlreadyInitialized) Error() string
Error returns the error message.
func (*ErrAlreadyInitialized) Is ¶
func (e *ErrAlreadyInitialized) Is(target error) bool
Is reports whether the error is an ErrAlreadyInitialized.
type Exporter ¶
type Exporter string
Exporter is the protocol used to export the traces
const ( // HTTP is the protocol used to export the traces via HTTP/1.1 HTTP Exporter = "http" // GRPC is the protocol used to export the traces via HTTP/2 (gRPC) GRPC Exporter = "grpc" // STDOUT is the protocol used to export the traces to the standard output STDOUT Exporter = "stdout" // NOOP is the protocol used to not export the traces NOOP Exporter = "" )
func (Exporter) RegisterExporter ¶ added in v0.3.0
RegisterExporter registers the exporter with the factory function. Not safe for concurrent use.
type Tracer ¶
type Tracer interface { // Initialize initializes the OpenTelemetry metrics with the given service name and version Initialize(ctx context.Context, serviceName, serviceVersion string) error // Shutdown shuts down the OpenTelemetry tracer Shutdown(ctx context.Context) error }
Tracer is the interface that wraps the basic methods of the OpenTelemetry tracer