Documentation
¶
Overview ¶
Package telemetry 隔离运行质量遥测与内部错误观测 provider。
Index ¶
Constants ¶
const ( // DefaultFlushTimeout 是短命 Runtime 收口遥测时允许占用的最长时间。 DefaultFlushTimeout = 500 * time.Millisecond )
Variables ¶
var BuildSentryDSN = ""
BuildSentryDSN 是发布构建可通过 -ldflags 注入的 Sentry DSN。 源码和默认开发构建保持为空,避免凭据进入版本库。
Functions ¶
func IsReportableFailure ¶ added in v0.1.9
IsReportableFailure 报告稳定失败码是否经过价值评审并允许发送。
Types ¶
type Config ¶
type Config struct {
Enabled bool
Offline bool
SentryDSN string
SentryEnvironment string
SentryRelease string
FlushTimeout time.Duration
}
Config 是一次 Runtime 调用使用的遥测配置快照。
type InternalObservation ¶
type InternalObservation struct {
OperationID string
Command string
Stage string
Code string
Reason string
DiagnosticDetails map[string]any
RuntimeVersion string
ProtocolVersion int
Platform string
Panic bool
PanicFrames []StackFrame
}
InternalObservation 是允许发送到 Sentry 的失败分类。
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer 汇总多个 provider,并把关闭生命周期线性化。
func (*Observer) CaptureInternal ¶
func (o *Observer) CaptureInternal(ctx context.Context, observation InternalObservation) string
CaptureInternal 记录允许上报的失败分类;名称为既有内部接口,不携带原始错误文本。
type Recorder ¶
type Recorder interface {
CaptureInternal(context.Context, InternalObservation) string
Close(context.Context)
}
Recorder 是 CLI 消费的最小遥测接口;捕获只返回 SDK 接受的事件 ID,不返回错误或投递保证。
type StackFrame ¶
StackFrame 是允许附带到 panic 观测的最小栈帧;不包含源文件路径或局部变量。