tracing

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracing

type Tracing struct {
	ModuleName          string            `mapstructure:"module-name" yaml:"module-name" json:"moduleName"`                              // 模块名称
	Enabled             bool              `mapstructure:"enabled" yaml:"enabled" json:"enabled"`                                         // 是否启用追踪
	ServiceName         string            `mapstructure:"service-name" yaml:"service-name" json:"serviceName"`                           // 服务名称
	ServiceVersion      string            `mapstructure:"service-version" yaml:"service-version" json:"serviceVersion"`                  // 服务版本
	Environment         string            `mapstructure:"environment" yaml:"environment" json:"environment"`                             // 环境
	Endpoint            string            `mapstructure:"endpoint" yaml:"endpoint" json:"endpoint"`                                      // 追踪端点
	ExporterType        string            `mapstructure:"exporter-type" yaml:"exporter-type" json:"exporterType"`                        // 导出器类型 (zipkin, otlp, console, noop)
	ExporterEndpoint    string            `mapstructure:"exporter-endpoint" yaml:"exporter-endpoint" json:"exporterEndpoint"`            // 导出器端点
	SampleRate          float64           `mapstructure:"sample-rate" yaml:"sample-rate" json:"sampleRate"`                              // 采样率
	SamplerType         string            `mapstructure:"sampler-type" yaml:"sampler-type" json:"samplerType"`                           // 采样器类型 (always, never, probability, parentBased)
	SamplerProbability  float64           `mapstructure:"sampler-probability" yaml:"sampler-probability" json:"samplerProbability"`      // 采样概率
	SamplerRate         float64           `mapstructure:"sampler-rate" yaml:"sampler-rate" json:"samplerRate"`                           // 采样速率
	Headers             []string          `mapstructure:"headers" yaml:"headers" json:"headers"`                                         // 需要记录的头部
	Attributes          map[string]string `mapstructure:"attributes" yaml:"attributes" json:"attributes"`                                // 自定义属性
	ExporterHeaders     map[string]string `mapstructure:"exporter-headers" yaml:"exporter-headers" json:"exporterHeaders"`               // 导出器自定义请求头 (如 Authorization、stream-name)
	ExporterTLSInsecure bool              `mapstructure:"exporter-tls-insecure" yaml:"exporter-tls-insecure" json:"exporterTLSInsecure"` // 导出器是否跳过 TLS 验证
	TelemetryLogLevel   string            `mapstructure:"telemetry-log-level" yaml:"telemetry-log-level" json:"telemetryLogLevel"`       // 遥测日志级别 (debug/info/warn/error)
}

Tracing 追踪中间件配置

func Default

func Default() *Tracing

Default 创建默认追踪配置

func (*Tracing) Clone

func (t *Tracing) Clone() internal.Configurable

Clone 返回配置的副本

func (*Tracing) Disable

func (t *Tracing) Disable() *Tracing

Disable 禁用追踪中间件

func (*Tracing) Enable

func (t *Tracing) Enable() *Tracing

Enable 启用追踪中间件

func (*Tracing) Get

func (t *Tracing) Get() interface{}

Get 返回配置接口

func (*Tracing) IsEnabled

func (t *Tracing) IsEnabled() bool

IsEnabled 检查是否启用

func (*Tracing) Set

func (t *Tracing) Set(data interface{})

Set 设置配置数据

func (*Tracing) Validate

func (t *Tracing) Validate() error

Validate 验证配置

func (*Tracing) WithEndpoint

func (t *Tracing) WithEndpoint(endpoint string) *Tracing

WithEndpoint 设置追踪端点

func (*Tracing) WithExporterHeaders

func (t *Tracing) WithExporterHeaders(headers map[string]string) *Tracing

WithExporterHeaders 设置导出器自定义请求头

func (*Tracing) WithExporterTLSInsecure

func (t *Tracing) WithExporterTLSInsecure(insecure bool) *Tracing

WithExporterTLSInsecure 设置导出器是否跳过 TLS 验证

func (*Tracing) WithHeaders

func (t *Tracing) WithHeaders(headers []string) *Tracing

WithHeaders 设置需要记录的头部

func (*Tracing) WithSampleRate

func (t *Tracing) WithSampleRate(sampleRate float64) *Tracing

WithSampleRate 设置采样率

func (*Tracing) WithServiceName

func (t *Tracing) WithServiceName(serviceName string) *Tracing

WithServiceName 设置服务名称

func (*Tracing) WithTelemetryLogLevel

func (t *Tracing) WithTelemetryLogLevel(level string) *Tracing

WithTelemetryLogLevel 设置遥测日志级别

Jump to

Keyboard shortcuts

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