Documentation ¶
Index ¶
- func Attribute(key string, value interface{}) attribute.KeyValue
- func GetTextMapPropagator() propagation.TextMapPropagator
- func GlobalMeter() metric.Meter
- func GlobalTracer() trace.Tracer
- func NewMetricInOption(c *Config) (mp metric.MeterProvider, shutdown func(ctx context.Context) error, err error)
- func NewOtlpMetric(c *Config) (mp metric.MeterProvider, shutdown func(ctx context.Context) error, err error)
- func NewOtlpTracer(c *Config) (tp trace.TracerProvider, shutdown func(ctx context.Context) error, err error)
- func NewStdMetric(c *Config) (mp metric.MeterProvider, shutdown func(ctx context.Context) error, err error)
- func NewStdTracer(c *Config, opts ...stdouttrace.Option) (tp *sdktrace.TracerProvider, shutdown func(ctx context.Context) error, ...)
- func NewTraceInOption(c *Config) (tp trace.TracerProvider, shutdown func(ctx context.Context) error, err error)
- func SemVersion() string
- func SetGlobalConfig(cfg *Config)
- func Version() string
- type Config
- type Option
- func WithMeterProvider(provider metric.MeterProvider, shutdown func(ctx context.Context) error) Option
- func WithMeterProviderOptions(opts ...sdkmetric.Option) Option
- func WithPropagator(propagator propagation.TextMapPropagator) Option
- func WithResource(resource *resource.Resource) Option
- func WithResourceAttributes(attributes map[string]string) Option
- func WithTracerProvider(provider trace.TracerProvider, shutdown func(ctx context.Context) error) Option
- func WithTracerProviderOptions(opts ...sdktrace.TracerProviderOption) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTextMapPropagator ¶
func GetTextMapPropagator() propagation.TextMapPropagator
func GlobalMeter ¶
func GlobalTracer ¶
func NewMetricInOption ¶
func NewMetricInOption(c *Config) (mp metric.MeterProvider, shutdown func(ctx context.Context) error, err error)
NewMetricInOption return meter which export has been set in `metric.Option`
func NewOtlpMetric ¶
func NewOtlpTracer ¶
func NewStdMetric ¶
func NewStdMetric(c *Config) (mp metric.MeterProvider, shutdown func(ctx context.Context) error, err error)
NewStdMetric return a stdout metric provider and an error if any
func NewStdTracer ¶
func NewStdTracer(c *Config, opts ...stdouttrace.Option) ( tp *sdktrace.TracerProvider, shutdown func(ctx context.Context) error, err error)
NewStdTracer return a stdout tracer provider and an error if any
func NewTraceInOption ¶
func NewTraceInOption(c *Config) (tp trace.TracerProvider, shutdown func(ctx context.Context) error, err error)
NewTraceInOption return trace provider which export has been set in `trace.TracerProviderOption`
func SemVersion ¶
func SemVersion() string
SemVersion is the semantic version to be supplied to tracer/meter creation.
func SetGlobalConfig ¶
func SetGlobalConfig(cfg *Config)
Types ¶
type Config ¶
type Config struct { ServiceName string `json:"serviceName,omitempty" yaml:"serviceName"` ServiceNamespace string `json:"serviceNamespace,omitempty" yaml:"serviceNamespace"` ServiceVersion string `json:"serviceVersion,omitempty" yaml:"serviceVersion"` AttributesEnvKeys string `json:"attributesEnvKeys,omitempty" yaml:"attributesEnvKeys"` TraceExporterEndpoint string `json:"traceExporterEndpoint" yaml:"traceExporterEndpoint"` TraceExporterEndpointInsecure bool `json:"traceExporterEndpointInsecure" yaml:"traceExporterEndpointInsecure"` MetricExporterEndpoint string `json:"metricExporterEndpoint" yaml:"metricExporterEndpoint"` MetricExporterEndpointInsecure bool `json:"metricExporterEndpointInsecure" yaml:"metricExporterEndpointInsecure"` // the intervening time between exports for a PeriodicReader. MetricPeriodicReaderInterval time.Duration `json:"metricReportingPeriod" yaml:"metricReportingPeriod"` Resource *resource.Resource `json:"-" yaml:"-"` TracerProvider trace.TracerProvider `json:"-" yaml:"-"` Tracer trace.Tracer `json:"-" yaml:"-"` MeterProvider metric.MeterProvider `json:"-" yaml:"-"` Meter metric.Meter `json:"-" yaml:"-"` Propagator propagation.TextMapPropagator `json:"-" yaml:"-"` // contains filtered or unexported fields }
Config is the configuration for the opentelemetry instrumentation,Through it to set global tracer and meter provider.
func GlobalConfig ¶
func GlobalConfig() *Config
func (*Config) Apply ¶
func (c *Config) Apply(cnf *conf.Configuration)
Apply implement conf.Configurable interface
if ServiceName and ServiceVersion and ServiceNameSpace is set in cfg, they will override before
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option specifies instrumentation configuration options.
func WithMeterProvider ¶
func WithMeterProvider(provider metric.MeterProvider, shutdown func(ctx context.Context) error) Option
WithMeterProvider specifies a meter provider to use for creating a meter.
If none is specified, the metric.NewNoopMeterProvider is used.
func WithMeterProviderOptions ¶
WithMeterProviderOptions specifies sdk tracer provider options to use for creating a tracer.
func WithPropagator ¶
func WithPropagator(propagator propagation.TextMapPropagator) Option
WithPropagator specifies propagators to use for extracting information from the HTTP requests. If none are specified, global ones will be used.
func WithResource ¶
WithResource configures attributes on the resource
func WithResourceAttributes ¶
WithResourceAttributes configures attributes on the resource
example: zone=shanghai|app=app1|app_version=1.0.0
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider, shutdown func(ctx context.Context) error) Option
WithTracerProvider specifies a tracer provider to use for creating a tracer.
If none is specified, the global provider is used.
func WithTracerProviderOptions ¶
func WithTracerProviderOptions(opts ...sdktrace.TracerProviderOption) Option
WithTracerProviderOptions specifies sdk tracer provider options to use for creating a tracer.