Documentation ¶
Index ¶
- func New(options ...Option) providerconfig.SignalProcessor
- type Option
- func WithBatchProcessorOptions(options ...log.BatchProcessorOption) Option
- func WithCollectorEndpoint(url string, port int) Option
- func WithLogOptions(options ...otlploggrpc.Option) Option
- func WithMetricOptions(options ...otlpmetricgrpc.Option) Option
- func WithPeriodicReaderOptions(options ...metric.PeriodicReaderOption) Option
- func WithSimpleProcessorOptions(options ...log.SimpleProcessorOption) Option
- func WithSpanProcessorOptions(options ...trace.BatchSpanProcessorOption) Option
- func WithTraceOptions(options ...otlptracegrpc.Option) Option
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(options ...Option) providerconfig.SignalProcessor
Example ¶
package main import ( "github.com/vincentfree/opentelemetry/providerconfig" "github.com/vincentfree/opentelemetry/providerconfig/providerconfiggrpc" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/log/global" ) func main() { signalProcessor := providerconfiggrpc.New( providerconfiggrpc.WithCollectorEndpoint("0.0.0.0", 9898), ) provider := providerconfig.New(providerconfig.WithApplicationName("example-app"), providerconfig.WithApplicationVersion("0.1.0"), providerconfig.WithSignalProcessor(signalProcessor), ) // set providers otel.SetTracerProvider(provider.TraceProvider()) otel.SetMeterProvider(provider.MetricProvider()) global.SetLoggerProvider(provider.LogProvider()) // shutdown all providers provider.ShutdownAll() }
Output:
Types ¶
type Option ¶
type Option func(*grpcConfig)
func WithBatchProcessorOptions ¶
func WithBatchProcessorOptions(options ...log.BatchProcessorOption) Option
Example ¶
package main import ( "github.com/vincentfree/opentelemetry/providerconfig/providerconfiggrpc" "go.opentelemetry.io/otel/sdk/log" ) func main() { providerconfiggrpc.New( providerconfiggrpc.WithBatchProcessorOptions(log.WithExportMaxBatchSize(512)), ) }
Output:
func WithCollectorEndpoint ¶
WithCollectorEndpoint handled by providerconfig.New Has no effect when WithGRPCConn is set for any of the Options
Example ¶
package main import ( "github.com/vincentfree/opentelemetry/providerconfig/providerconfiggrpc" ) func main() { providerconfiggrpc.New( providerconfiggrpc.WithCollectorEndpoint("0.0.0.0", 9898), ) }
Output:
func WithLogOptions ¶
func WithLogOptions(options ...otlploggrpc.Option) Option
Example ¶
package main import ( "github.com/vincentfree/opentelemetry/providerconfig/providerconfiggrpc" "go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc" "time" ) func main() { providerconfiggrpc.New( providerconfiggrpc.WithLogOptions( otlploggrpc.WithCompressor("gzip"), otlploggrpc.WithTimeout(5*time.Second), ), ) }
Output:
func WithMetricOptions ¶
func WithMetricOptions(options ...otlpmetricgrpc.Option) Option
Example ¶
package main import ( "github.com/vincentfree/opentelemetry/providerconfig/providerconfiggrpc" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" ) func main() { providerconfiggrpc.New( providerconfiggrpc.WithMetricOptions(otlpmetricgrpc.WithCompressor("gzip")), ) }
Output:
func WithPeriodicReaderOptions ¶
func WithPeriodicReaderOptions(options ...metric.PeriodicReaderOption) Option
Example ¶
package main import ( "github.com/vincentfree/opentelemetry/providerconfig/providerconfiggrpc" "go.opentelemetry.io/otel/sdk/metric" "time" ) func main() { providerconfiggrpc.New( providerconfiggrpc.WithPeriodicReaderOptions(metric.WithInterval(5 * time.Second)), ) }
Output:
func WithSimpleProcessorOptions ¶
func WithSimpleProcessorOptions(options ...log.SimpleProcessorOption) Option
Example ¶
package main import ( "github.com/vincentfree/opentelemetry/providerconfig/providerconfiggrpc" ) func main() { providerconfiggrpc.New( providerconfiggrpc.WithSimpleProcessorOptions( /*currently there are no options for the simpleProcessor*/ ), ) }
Output:
func WithSpanProcessorOptions ¶
func WithSpanProcessorOptions(options ...trace.BatchSpanProcessorOption) Option
Example ¶
package main import ( "github.com/vincentfree/opentelemetry/providerconfig/providerconfiggrpc" "go.opentelemetry.io/otel/sdk/trace" ) func main() { providerconfiggrpc.New( providerconfiggrpc.WithSpanProcessorOptions(trace.WithMaxExportBatchSize(512)), ) }
Output:
func WithTraceOptions ¶
func WithTraceOptions(options ...otlptracegrpc.Option) Option
Example ¶
package main import ( "github.com/vincentfree/opentelemetry/providerconfig/providerconfiggrpc" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" ) func main() { providerconfiggrpc.New( providerconfiggrpc.WithTraceOptions(otlptracegrpc.WithCompressor("gzip")), ) }
Output:
Click to show internal directories.
Click to hide internal directories.