Documentation ¶
Overview ¶
Package otelconfig provides helpers for initializing specific trace.TracerProviders.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Noop = noopConfiger{}
Noop is a no-op Initializer which can, for example, be used as a default during local development.
Functions ¶
This section is empty.
Types ¶
type CommonOption ¶
type CommonOption interface { GoogleCloudOption LocalOption OTLPOption }
CommonOption are options which can be used to configure any Initializer.
func Resource ¶
func Resource(r *resource.Resource) CommonOption
Resource configures the resource to be attached to each trace.
type GoogleCloudConfig ¶
GoogleCloudConfig is the config for the Google Cloud Initializer.
func (GoogleCloudConfig) Init ¶
func (cfg GoogleCloudConfig) Init() (trace.TracerProvider, error)
Init implements the Initializer interface.
type GoogleCloudOption ¶
type GoogleCloudOption interface {
ApplyGCP(*GoogleCloudConfig)
}
GoogleCloudOption are options for the Google Cloud Initializer.
func GoogleCloudProjectId ¶
func GoogleCloudProjectId(id string) GoogleCloudOption
GoogleCloudProjectId configures the Google Cloud Project ID.
type Initializer ¶
type Initializer interface {
Init() (trace.TracerProvider, error)
}
Initializer represents anything that can initialize a OTel TracerProvider.
func GoogleCloud ¶
func GoogleCloud(opts ...GoogleCloudOption) Initializer
GoogleCloud returns an Initializer for exporting traces directly to Cloud Trace.
func Local ¶
func Local(opts ...LocalOption) Initializer
Local returns an Initializer for exporting traces to STDOUT.
func OTLP ¶
func OTLP(opts ...OTLPOption) Initializer
OTLP returns an Initializer for exporting traces via OTLP.
type LocalConfig ¶
LocalConfig is the config for the Local Initializer.
func (LocalConfig) Init ¶
func (cfg LocalConfig) Init() (trace.TracerProvider, error)
Init implements Initializer interface.
type LocalOption ¶
type LocalOption interface {
ApplyLocal(*LocalConfig)
}
LocalOption are options for the Local Initializer.
type OTLPConfig ¶
type OTLPConfig struct { Common // gRPC traget string which is passed to grpc.Dial() Target string `config:"target"` TransportCredentials credentials.TransportCredentials DialOpts []grpc.DialOption Compressor string `config:"compressor"` }
OTLPConfig is the config for the OTLP Initializer.
func (OTLPConfig) Init ¶
func (cfg OTLPConfig) Init() (trace.TracerProvider, error)
Init implements Initializer interface.
type OTLPOption ¶
type OTLPOption interface {
ApplyOTLP(*OTLPConfig)
}
OTLPOption are options for the OTLP Initializer.
func OTLPCompressor ¶
func OTLPCompressor(compressor string) OTLPOption
OTLPCompressor sets the compressor for the gRPC client to use when sending requests. Supported compressor values are: "gzip".
func OTLPDialOptions ¶
func OTLPDialOptions(opts ...grpc.DialOption) OTLPOption
OTLPDialOptons sets explicit grpc.DialOptions to use when making a connection.
func OTLPTarget ¶
func OTLPTarget(target string) OTLPOption
OTLPTarget configures the gRPC target where traces will be sent to via OTLP.
func OTLPTransportCreds ¶
func OTLPTransportCreds(tc credentials.TransportCredentials) OTLPOption
OTLPTransportCreds configures the gRPC transport credentials for the OTLP target.