otelx

package
v0.0.0-...-a5c60e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Attributes

func Attributes() []attribute.KeyValue

func NewMeterProvider

func NewMeterProvider(ctx context.Context, o *MetricConfig) (metric.MeterProvider, error)

func NewResource

func NewResource(ctx context.Context, res string, attrs ...attribute.KeyValue) *resource.Resource

func NewTracerProvider

func NewTracerProvider(ctx context.Context, o *TraceConfig) (trace.TracerProvider, error)

Types

type GRPCMetricReader

type GRPCMetricReader struct {
	Endpoint               string            `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
	Insecure               bool              `mapstructure:"insecure" json:"insecure" yaml:"insecure"`
	Headers                map[string]string `mapstructure:"headers" json:"headers" yaml:"headers"`
	Compressor             string            `mapstructure:"compressor" json:"compressor" yaml:"compressor"`
	ReconnectionPeriod     time.Duration     `mapstructure:"reconnection_period" json:"reconnection_period" yaml:"reconnection_period"`
	Timeout                time.Duration     `mapstructure:"timeout" json:"timeout" yaml:"timeout"`
	ServiceConfig          string            `mapstructure:"service_config" json:"service_config" yaml:"service_config"`
	PeriodicReaderTimeout  time.Duration     `mapstructure:"periodic_reader_timeout" json:"periodic_reader_timeout" yaml:"periodic_reader_timeout"`
	PeriodicReaderInterval time.Duration     `mapstructure:"periodic_reader_interval" json:"periodic_reader_interval" yaml:"periodic_reader_interval"`
	TLSConfig              *tls.Config
	DialOptions            []grpc.DialOption
	GRPCConn               *grpc.ClientConn
	Retry                  *otlpmetricgrpc.RetryConfig
	TemporalitySelector    sdkmetric.TemporalitySelector
	AggregationSelector    sdkmetric.AggregationSelector
}

type GRPCTraceExporter

type GRPCTraceExporter struct {
	Endpoint           string            `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
	Insecure           bool              `mapstructure:"insecure" json:"insecure" yaml:"insecure"`
	Headers            map[string]string `mapstructure:"headers" json:"headers" yaml:"headers"`
	Compressor         string            `mapstructure:"compressor" json:"compressor" yaml:"compressor"`
	ReconnectionPeriod time.Duration     `mapstructure:"reconnection_period" json:"reconnection_period" yaml:"reconnection_period"`
	Timeout            time.Duration     `mapstructure:"timeout" json:"timeout" yaml:"timeout"`
	ServiceConfig      string            `mapstructure:"service_config" json:"service_config" yaml:"service_config"`
	TLSConfig          *tls.Config
	DialOptions        []grpc.DialOption
	GRPCConn           *grpc.ClientConn
	Retry              *otlptracegrpc.RetryConfig
}

type HTTPMetricReader

type HTTPMetricReader struct {
	Endpoint               string            `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
	URLPath                string            `mapstructure:"url_path" json:"url_path" yaml:"url_path"`
	Insecure               bool              `mapstructure:"insecure" json:"insecure" yaml:"insecure"`
	Headers                map[string]string `mapstructure:"headers" json:"headers" yaml:"headers"`
	Timeout                time.Duration     `mapstructure:"timeout" json:"timeout" yaml:"timeout"`
	PeriodicReaderTimeout  time.Duration     `mapstructure:"periodic_reader_timeout" json:"periodic_reader_timeout" yaml:"periodic_reader_timeout"`
	PeriodicReaderInterval time.Duration     `mapstructure:"periodic_reader_interval" json:"periodic_reader_interval" yaml:"periodic_reader_interval"`
	TLSConfig              *tls.Config
	Retry                  *otlpmetrichttp.RetryConfig
	TemporalitySelector    sdkmetric.TemporalitySelector
	AggregationSelector    sdkmetric.AggregationSelector
	Compression            otlpmetrichttp.Compression
}

type HTTPTraceExporter

type HTTPTraceExporter struct {
	Endpoint    string            `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
	Insecure    bool              `mapstructure:"insecure" json:"insecure" yaml:"insecure"`
	Headers     map[string]string `mapstructure:"headers" json:"headers" yaml:"headers"`
	Timeout     time.Duration     `mapstructure:"timeout" json:"timeout" yaml:"timeout"`
	URLPath     string            `mapstructure:"url_path" json:"url_path" yaml:"url_path"`
	TLSConfig   *tls.Config
	Compression otlptracehttp.Compression
	Retry       *otlptracehttp.RetryConfig
}

type JaegerTraceExporter

type JaegerTraceExporter struct {
	Endpoint string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
	Username string `mapstructure:"username" json:"username" yaml:"username"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
}

type MetricConfig

type MetricConfig struct {
	// PrometheusOptions
	PrometheusOptions *PrometheusMetricReader `mapstructure:"prometheus_options" json:"prometheus_options" yaml:"prometheus_options"`
	// HTTPOptions
	HTTPOptions *HTTPMetricReader `mapstructure:"http_options" json:"http_options" yaml:"http_options"`
	// GRPCOptions
	GRPCOptions *GRPCMetricReader `mapstructure:"grpc_options" json:"grpc_options" yaml:"grpc_options"`
	// WriterOptions
	WriterOptions *WriterMetricReader `mapstructure:"writer_options" json:"writer_options" yaml:"writer_options"`
	// Resources
	ResourceFlag string `mapstructure:"resource_flag" json:"resource_flag" yaml:"resource_flag"`
	// Attributes
	Attributes []attribute.KeyValue
	// ViewOptions
	ViewOptions []ViewOption
}

type PrometheusMetricReader

type PrometheusMetricReader struct {
	WithoutUnits      bool `mapstructure:"without_units" json:"without_units" yaml:"without_units"`
	WithoutTargetInfo bool `mapstructure:"without_target_info" json:"without_target_info" yaml:"without_target_info"`
	WithoutScopeInfo  bool `mapstructure:"without_scope_info" json:"without_scope_info" yaml:"without_scope_info"`
	Registerer        prome.Registerer
	Aggregation       sdkmetric.AggregationSelector
}

type TraceConfig

type TraceConfig struct {
	// SamplingRate 采样率
	SamplingRate float64 `mapstructure:"sampling_rate" json:"sampling_rate" yaml:"sampling_rate"`
	// ZipkinOptions
	ZipkinOptions *ZipkinTraceExporter `mapstructure:"zipkin_options" json:"zipkin_options" yaml:"zipkin_options"`
	// WriterOptions
	WriterOptions *WriterTraceExporter `mapstructure:"writer_options" json:"writer_options" yaml:"writer_options"`
	// GRPCOptions
	GRPCOptions *GRPCTraceExporter `mapstructure:"grpc_options" json:"grpc_options" yaml:"grpc_options"`
	// HTTPOptions
	HTTPOptions *HTTPTraceExporter `mapstructure:"http_options" json:"http_options" yaml:"http_options"`
	// ResourceFlag 资源
	ResourceFlag string `mapstructure:"resource_flag" json:"resource_flag" yaml:"resource_flag"`
	// Sampler 自定义Sampler
	Sampler sdktrace.Sampler
	// IDGenerator 自定义id生成器
	IDGenerator sdktrace.IDGenerator
	// SpanProcessor 自定义span处理器
	SpanProcessor sdktrace.SpanProcessor
	// RawSpanLimits
	RawSpanLimits *sdktrace.SpanLimits
	// Attributes trace需要一些额外的信息
	Attributes  []attribute.KeyValue
	Propagators []propagation.TextMapPropagator
}

type ViewOption

type ViewOption struct {
	Criteria sdkmetric.Instrument
	Mask     sdkmetric.Stream
}

type WriterMetricReader

type WriterMetricReader struct {
	// Writer 标准输入或者文件
	Writer                 io.Writer
	NewEncoder             func(writer io.Writer) stdoutmetric.Encoder
	TemporalitySelector    sdkmetric.TemporalitySelector
	AggregationSelector    sdkmetric.AggregationSelector
	PeriodicReaderTimeout  time.Duration `mapstructure:"periodic_reader_timeout" json:"periodic_reader_timeout" yaml:"periodic_reader_timeout"`
	PeriodicReaderInterval time.Duration `mapstructure:"periodic_reader_interval" json:"periodic_reader_interval" yaml:"periodic_reader_interval"`
}

type WriterTraceExporter

type WriterTraceExporter struct {
	// Writer 标准输入或者文件
	Writer            io.Writer
	PrettyPrint       bool `mapstructure:"pretty_print" json:"pretty_print" yaml:"pretty_print"`
	WithoutTimestamps bool `mapstructure:"without_timestamps" json:"without_timestamps" yaml:"without_timestamps"`
}

type ZipkinTraceExporter

type ZipkinTraceExporter struct {
	URL string `mapstructure:"url" json:"url" yaml:"url"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL