telemetry

package
v0.92.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 10 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes deprecated

type Attributes = config.Attributes

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".Attributes instead.

type BatchLogRecordProcessor deprecated

type BatchLogRecordProcessor = config.BatchLogRecordProcessor

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".BatchLogRecordProcessor instead.

type BatchSpanProcessor deprecated

type BatchSpanProcessor = config.BatchSpanProcessor

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".BatchSpanProcessor instead.

type CommonJson deprecated

type CommonJson = config.Common

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".Common instead.

type Config

type Config struct {
	Logs    LogsConfig    `mapstructure:"logs"`
	Metrics MetricsConfig `mapstructure:"metrics"`
	Traces  TracesConfig  `mapstructure:"traces"`

	// Resource specifies user-defined attributes to include with all emitted telemetry.
	// Note that some attributes are added automatically (e.g. service.version) even
	// if they are not specified here. In order to suppress such attributes the
	// attribute must be specified in this map with null YAML value (nil string pointer).
	Resource map[string]*string `mapstructure:"resource"`
}

Config defines the configurable settings for service telemetry.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks whether the current configuration is valid

type Console deprecated

type Console = config.Console

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".Console instead.

type Headers deprecated

type Headers = config.Headers

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".Headers instead.

type LogRecordExporter deprecated

type LogRecordExporter = config.LogRecordExporter

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".LogRecordExporter instead.

type LogRecordLimits deprecated

type LogRecordLimits = config.LogRecordLimits

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".LogRecordLimits instead.

type LogRecordProcessor deprecated

type LogRecordProcessor = config.LogRecordProcessor

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".LogRecordProcessor instead.

type LoggerProviderJson deprecated

type LoggerProviderJson = config.LoggerProvider

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".LoggerProvider instead.

type LogsConfig

type LogsConfig struct {
	// Level is the minimum enabled logging level.
	// (default = "INFO")
	Level zapcore.Level `mapstructure:"level"`

	// Development puts the logger in development mode, which changes the
	// behavior of DPanicLevel and takes stacktraces more liberally.
	// (default = false)
	Development bool `mapstructure:"development"`

	// Encoding sets the logger's encoding.
	// Example values are "json", "console".
	Encoding string `mapstructure:"encoding"`

	// DisableCaller stops annotating logs with the calling function's file
	// name and line number. By default, all logs are annotated.
	// (default = false)
	DisableCaller bool `mapstructure:"disable_caller"`

	// DisableStacktrace completely disables automatic stacktrace capturing. By
	// default, stacktraces are captured for WarnLevel and above logs in
	// development and ErrorLevel and above in production.
	// (default = false)
	DisableStacktrace bool `mapstructure:"disable_stacktrace"`

	// Sampling sets a sampling policy.
	// Default:
	// 		sampling:
	//	   		enabled: true
	//	   		tick: 10s
	//	   		initial: 10
	//	   		thereafter: 100
	// Sampling can be disabled by setting 'enabled' to false
	Sampling *LogsSamplingConfig `mapstructure:"sampling"`

	// OutputPaths is a list of URLs or file paths to write logging output to.
	// The URLs could only be with "file" schema or without schema.
	// The URLs with "file" schema must be an absolute path.
	// The URLs without schema are treated as local file paths.
	// "stdout" and "stderr" are interpreted as os.Stdout and os.Stderr.
	// see details at Open in zap/writer.go.
	// (default = ["stderr"])
	OutputPaths []string `mapstructure:"output_paths"`

	// ErrorOutputPaths is a list of URLs or file paths to write zap internal logger errors to.
	// The URLs could only be with "file" schema or without schema.
	// The URLs with "file" schema must use absolute paths.
	// The URLs without schema are treated as local file paths.
	// "stdout" and "stderr" are interpreted as os.Stdout and os.Stderr.
	// see details at Open in zap/writer.go.
	//
	// Note that this setting only affects the zap internal logger errors.
	// (default = ["stderr"])
	ErrorOutputPaths []string `mapstructure:"error_output_paths"`

	// InitialFields is a collection of fields to add to the root logger.
	// Example:
	//
	// 		initial_fields:
	//	   		foo: "bar"
	//
	// By default, there is no initial field.
	InitialFields map[string]any `mapstructure:"initial_fields"`
}

LogsConfig defines the configurable settings for service telemetry logs. This MUST be compatible with zap.Config. Cannot use directly zap.Config because the collector uses mapstructure and not yaml tags.

type LogsSamplingConfig

type LogsSamplingConfig struct {
	// Enabled enable sampling logging
	Enabled bool `mapstructure:"enabled"`
	// Tick represents the interval in seconds that the logger apply each sampling.
	Tick time.Duration `mapstructure:"tick"`
	// Initial represents the first M messages logged each Tick.
	Initial int `mapstructure:"initial"`
	// Thereafter represents the sampling rate, every Nth message will be sampled after Initial messages are logged during each Tick.
	// If Thereafter is zero, the logger will drop all the messages after the Initial each Tick.
	Thereafter int `mapstructure:"thereafter"`
}

LogsSamplingConfig sets a sampling strategy for the logger. Sampling caps the global CPU and I/O load that logging puts on your process while attempting to preserve a representative subset of your logs.

type MeterProviderJson deprecated

type MeterProviderJson = config.MeterProvider

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".MeterProvider instead.

type MetricExporter deprecated

type MetricExporter = config.MetricExporter

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".MetricExporter instead.

type MetricReader deprecated

type MetricReader = config.MetricReader

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".MetricReader instead.

type MetricsConfig

type MetricsConfig struct {
	// Level is the level of telemetry metrics, the possible values are:
	//  - "none" indicates that no telemetry data should be collected;
	//  - "basic" is the recommended and covers the basics of the service telemetry.
	//  - "normal" adds some other indicators on top of basic.
	//  - "detailed" adds dimensions and views to the previous levels.
	Level configtelemetry.Level `mapstructure:"level"`

	// Address is the [address]:port that metrics exposition should be bound to.
	Address string `mapstructure:"address"`

	// Readers allow configuration of metric readers to emit metrics to
	// any number of supported backends.
	Readers []MetricReader `mapstructure:"readers"`
}

MetricsConfig exposes the common Telemetry configuration for one component. Experimental: *NOTE* this structure is subject to change or removal in the future.

type Otlp deprecated

type Otlp = config.OTLP

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".OTLP instead.

type OtlpMetric deprecated

type OtlpMetric = config.OTLPMetric

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".OTLPMetric instead.

type PeriodicMetricReader deprecated

type PeriodicMetricReader = config.PeriodicMetricReader

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".PeriodicMetricReader instead.

type Prometheus deprecated

type Prometheus = config.Prometheus

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".Prometheus instead.

type PullMetricReader deprecated

type PullMetricReader = config.PullMetricReader

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".PullMetricReader instead.

type ResourceJson deprecated

type ResourceJson = config.Resource

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".Resource instead.

type Sampler deprecated

type Sampler = config.Sampler

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".Sampler instead.

type SamplerAlwaysOff deprecated

type SamplerAlwaysOff = config.SamplerAlwaysOff

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SamplerAlwaysOff instead.

type SamplerAlwaysOn deprecated

type SamplerAlwaysOn = config.SamplerAlwaysOn

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SamplerAlwaysOn instead.

type SamplerJaegerRemote deprecated

type SamplerJaegerRemote = config.SamplerJaegerRemote

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SamplerJaegerRemote instead.

type SamplerParentBased deprecated

type SamplerParentBased = config.SamplerParentBased

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SamplerParentBased instead.

type SamplerTraceIdRatioBased deprecated

type SamplerTraceIdRatioBased = config.SamplerTraceIDRatioBased

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SamplerTraceIDRatioBased instead.

type Settings

type Settings struct {
	ZapOptions []zap.Option
}

Settings holds configuration for building Telemetry.

type SimpleLogRecordProcessor deprecated

type SimpleLogRecordProcessor = config.SimpleLogRecordProcessor

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SimpleLogRecordProcessor instead.

type SimpleSpanProcessor deprecated

type SimpleSpanProcessor = config.SimpleSpanProcessor

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SimpleSpanProcessor instead.

type SpanExporter deprecated

type SpanExporter = config.SpanExporter

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SpanExporter instead.

type SpanLimits deprecated

type SpanLimits = config.SpanLimits

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SpanLimits instead.

type SpanProcessor deprecated

type SpanProcessor = config.SpanProcessor

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".SpanProcessor instead.

type Telemetry

type Telemetry struct {
	// contains filtered or unexported fields
}

func New

func New(_ context.Context, set Settings, cfg Config) (*Telemetry, error)

New creates a new Telemetry from Config.

func (*Telemetry) Logger

func (t *Telemetry) Logger() *zap.Logger

func (*Telemetry) Shutdown

func (t *Telemetry) Shutdown(ctx context.Context) error

func (*Telemetry) TracerProvider

func (t *Telemetry) TracerProvider() trace.TracerProvider

type TracerProviderJson deprecated

type TracerProviderJson = config.TracerProvider

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".TracerProvider instead.

type TracesConfig

type TracesConfig struct {
	// Propagators is a list of TextMapPropagators from the supported propagators list. Currently,
	// tracecontext and  b3 are supported. By default, the value is set to empty list and
	// context propagation is disabled.
	Propagators []string `mapstructure:"propagators"`
	// Processors allow configuration of span processors to emit spans to
	// any number of suported backends.
	Processors []SpanProcessor `mapstructure:"processors"`
}

TracesConfig exposes the common Telemetry configuration for collector's internal spans. Experimental: *NOTE* this structure is subject to change or removal in the future.

type View deprecated

type View = config.View

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".View instead.

type ViewSelector deprecated

type ViewSelector = config.ViewSelector

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".ViewSelector instead.

type ViewStream deprecated

type ViewStream = config.ViewStream

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".ViewStream instead.

type ViewStreamAggregation deprecated

type ViewStreamAggregation = config.ViewStreamAggregation

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".ViewStreamAggregation instead.

type ViewStreamAggregationExplicitBucketHistogram deprecated

type ViewStreamAggregationExplicitBucketHistogram = config.ViewStreamAggregationExplicitBucketHistogram

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".ViewStreamAggregationExplicitBucketHistogram instead.

type ViewStreamAggregationExponentialBucketHistogram deprecated

type ViewStreamAggregationExponentialBucketHistogram = config.ViewStreamAggregationBase2ExponentialBucketHistogram

Deprecated: [v0.90.0] Use "go.opentelemetry.io/contrib/config".ViewStreamAggregationBase2ExponentialBucketHistogram instead.

Jump to

Keyboard shortcuts

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