Documentation
¶
Index ¶
- func New(options ...Option) providerconfig.SignalProcessor
- type Option
- func WithBatchProcessorOptions(options ...log.BatchProcessorOption) Option
- func WithCollectorEndpoint(endpoint string) Option
- func WithInsecure() Option
- func WithLogOptions(options ...otlploghttp.Option) Option
- func WithMetricOptions(options ...otlpmetrichttp.Option) Option
- func WithPeriodicReaderOptions(options ...metric.PeriodicReaderOption) Option
- func WithSimpleProcessorOptions(options ...log.SimpleProcessorOption) Option
- func WithSpanProcessorOptions(options ...trace.BatchSpanProcessorOption) Option
- func WithTraceOptions(options ...otlptracehttp.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/providerconfighttp"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/log/global"
)
func main() {
signalProcessor := providerconfighttp.New(
providerconfighttp.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()
}
Types ¶
type Option ¶
type Option func(*httpConfig)
func WithBatchProcessorOptions ¶
func WithBatchProcessorOptions(options ...log.BatchProcessorOption) Option
Example ¶
package main
import (
"github.com/vincentfree/opentelemetry/providerconfig/providerconfighttp"
"go.opentelemetry.io/otel/sdk/log"
)
func main() {
providerconfighttp.New(
providerconfighttp.WithBatchProcessorOptions(log.WithExportMaxBatchSize(512)),
)
}
func WithCollectorEndpoint ¶
WithCollectorEndpoint handled by providerconfig.New
Example ¶
package main
import (
"github.com/vincentfree/opentelemetry/providerconfig/providerconfighttp"
)
func main() {
providerconfighttp.New(
providerconfighttp.WithCollectorEndpoint("0.0.0.0:9898"),
// or
providerconfighttp.WithCollectorEndpoint("http://0.0.0.0:9898"),
)
}
func WithInsecure ¶ added in v0.1.1
func WithInsecure() Option
WithInsecure appends the WithInsecure options for the trace, metric and log providers.
Example ¶
package main
import (
"github.com/vincentfree/opentelemetry/providerconfig/providerconfighttp"
)
func main() {
providerconfighttp.New(
providerconfighttp.WithCollectorEndpoint("0.0.0.0:9898"),
providerconfighttp.WithInsecure(),
)
}
func WithLogOptions ¶
func WithLogOptions(options ...otlploghttp.Option) Option
Example ¶
package main
import (
"github.com/vincentfree/opentelemetry/providerconfig/providerconfighttp"
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
)
func main() {
providerconfighttp.New(
providerconfighttp.WithLogOptions(otlploghttp.WithCompression(otlploghttp.GzipCompression)),
)
}
func WithMetricOptions ¶
func WithMetricOptions(options ...otlpmetrichttp.Option) Option
Example ¶
package main
import (
"github.com/vincentfree/opentelemetry/providerconfig/providerconfighttp"
"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp"
)
func main() {
providerconfighttp.New(
providerconfighttp.WithMetricOptions(otlpmetrichttp.WithCompression(otlpmetrichttp.GzipCompression)),
)
}
func WithPeriodicReaderOptions ¶
func WithPeriodicReaderOptions(options ...metric.PeriodicReaderOption) Option
Example ¶
package main
import (
"github.com/vincentfree/opentelemetry/providerconfig/providerconfighttp"
"go.opentelemetry.io/otel/sdk/metric"
"time"
)
func main() {
providerconfighttp.New(
providerconfighttp.WithPeriodicReaderOptions(metric.WithInterval(5 * time.Second)),
)
}
func WithSimpleProcessorOptions ¶
func WithSimpleProcessorOptions(options ...log.SimpleProcessorOption) Option
Example ¶
package main
import (
"github.com/vincentfree/opentelemetry/providerconfig/providerconfighttp"
)
func main() {
providerconfighttp.New(
providerconfighttp.WithSimpleProcessorOptions( /*currently there are no options for the simpleProcessor*/ ),
)
}
func WithSpanProcessorOptions ¶
func WithSpanProcessorOptions(options ...trace.BatchSpanProcessorOption) Option
Example ¶
package main
import (
"github.com/vincentfree/opentelemetry/providerconfig/providerconfighttp"
"go.opentelemetry.io/otel/sdk/trace"
)
func main() {
providerconfighttp.New(
providerconfighttp.WithSpanProcessorOptions(trace.WithMaxExportBatchSize(512)),
)
}
func WithTraceOptions ¶
func WithTraceOptions(options ...otlptracehttp.Option) Option
Example ¶
package main
import (
"github.com/vincentfree/opentelemetry/providerconfig/providerconfighttp"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp"
)
func main() {
providerconfighttp.New(
providerconfighttp.WithTraceOptions(otlptracehttp.WithCompression(otlptracehttp.GzipCompression)),
)
}
Click to show internal directories.
Click to hide internal directories.