Documentation
¶
Index ¶
- type Config
- type Exporter
- type FileOpener
- type Provider
- type ProviderMock
- func (mock *ProviderMock) GetRegistry() *prometheus.Registry
- func (mock *ProviderMock) GetRegistryCalls() []struct{}
- func (mock *ProviderMock) InitTracing(ctx context.Context) error
- func (mock *ProviderMock) InitTracingCalls() []struct{ ... }
- func (mock *ProviderMock) Shutdown(ctx context.Context) error
- func (mock *ProviderMock) ShutdownCalls() []struct{ ... }
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Enabled is a flag to enable or disable the OpenTelemetry Enabled bool `yaml:"enabled" mapstructure:"enabled"` // 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"` // TLS holds the tls configuration TLS TLSConfig `yaml:"tls" mapstructure:"tls"` }
Config holds the configuration for OpenTelemetry
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 = "noop" )
func (Exporter) IsExporting ¶
IsExporting returns true if the protocol is exporting the traces
type FileOpener ¶
FileOpener is the function used to open a file
type Provider ¶
type Provider interface { // GetRegistry returns the prometheus registry instance // containing the registered prometheus collectors GetRegistry() *prometheus.Registry // InitTracing initializes the OpenTelemetry tracing InitTracing(ctx context.Context) error // Shutdown closes the metrics and tracing Shutdown(ctx context.Context) error }
type ProviderMock ¶
type ProviderMock struct { // GetRegistryFunc mocks the GetRegistry method. GetRegistryFunc func() *prometheus.Registry // InitTracingFunc mocks the InitTracing method. InitTracingFunc func(ctx context.Context) error // ShutdownFunc mocks the Shutdown method. ShutdownFunc func(ctx context.Context) error // contains filtered or unexported fields }
ProviderMock is a mock implementation of Provider.
func TestSomethingThatUsesProvider(t *testing.T) { // make and configure a mocked Provider mockedProvider := &ProviderMock{ GetRegistryFunc: func() *prometheus.Registry { panic("mock out the GetRegistry method") }, InitTracingFunc: func(ctx context.Context) error { panic("mock out the InitTracing method") }, ShutdownFunc: func(ctx context.Context) error { panic("mock out the Shutdown method") }, } // use mockedProvider in code that requires Provider // and then make assertions. }
func (*ProviderMock) GetRegistry ¶
func (mock *ProviderMock) GetRegistry() *prometheus.Registry
GetRegistry calls GetRegistryFunc.
func (*ProviderMock) GetRegistryCalls ¶
func (mock *ProviderMock) GetRegistryCalls() []struct { }
GetRegistryCalls gets all the calls that were made to GetRegistry. Check the length with:
len(mockedProvider.GetRegistryCalls())
func (*ProviderMock) InitTracing ¶
func (mock *ProviderMock) InitTracing(ctx context.Context) error
InitTracing calls InitTracingFunc.
func (*ProviderMock) InitTracingCalls ¶
func (mock *ProviderMock) InitTracingCalls() []struct { Ctx context.Context }
InitTracingCalls gets all the calls that were made to InitTracing. Check the length with:
len(mockedProvider.InitTracingCalls())
func (*ProviderMock) Shutdown ¶
func (mock *ProviderMock) Shutdown(ctx context.Context) error
Shutdown calls ShutdownFunc.
func (*ProviderMock) ShutdownCalls ¶
func (mock *ProviderMock) ShutdownCalls() []struct { Ctx context.Context }
ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:
len(mockedProvider.ShutdownCalls())
type TLSConfig ¶
type TLSConfig struct { // Enabled is a flag to enable or disable the tls Enabled bool `yaml:"enabled" mapstructure:"enabled"` // CertPath is the path to the tls certificate file. // This is only required if the otel backend uses custom TLS certificates. CertPath string `yaml:"certPath" mapstructure:"certPath"` }
Click to show internal directories.
Click to hide internal directories.