Documentation
¶
Index ¶
- type Tracing
- func (t *Tracing) Clone() internal.Configurable
- func (t *Tracing) Disable() *Tracing
- func (t *Tracing) Enable() *Tracing
- func (t *Tracing) Get() interface{}
- func (t *Tracing) IsEnabled() bool
- func (t *Tracing) Set(data interface{})
- func (t *Tracing) Validate() error
- func (t *Tracing) WithEndpoint(endpoint string) *Tracing
- func (t *Tracing) WithExporterHeaders(headers map[string]string) *Tracing
- func (t *Tracing) WithExporterTLSInsecure(insecure bool) *Tracing
- func (t *Tracing) WithHeaders(headers []string) *Tracing
- func (t *Tracing) WithSampleRate(sampleRate float64) *Tracing
- func (t *Tracing) WithServiceName(serviceName string) *Tracing
- func (t *Tracing) WithTelemetryLogLevel(level string) *Tracing
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 (*Tracing) WithEndpoint ¶
WithEndpoint 设置追踪端点
func (*Tracing) WithExporterHeaders ¶
WithExporterHeaders 设置导出器自定义请求头
func (*Tracing) WithExporterTLSInsecure ¶
WithExporterTLSInsecure 设置导出器是否跳过 TLS 验证
func (*Tracing) WithHeaders ¶
WithHeaders 设置需要记录的头部
func (*Tracing) WithSampleRate ¶
WithSampleRate 设置采样率
func (*Tracing) WithServiceName ¶
WithServiceName 设置服务名称
func (*Tracing) WithTelemetryLogLevel ¶
WithTelemetryLogLevel 设置遥测日志级别
Click to show internal directories.
Click to hide internal directories.