Documentation
¶
Overview ¶
Package tel carries the correlation attributes, spans and log records of the node daemon.
Index ¶
- Constants
- func Finish(span trace.Span, err error)
- func FinishTyped(span trace.Span, err error, attrs ...attribute.KeyValue)
- func Tracer() trace.Tracer
- func WithCalls(ctx context.Context, c *CallStats) context.Context
- func WithTraceparent(ctx context.Context, traceparent string) context.Context
- type CallStats
- type CallWindow
- type Correlation
- type Health
- type OpTrace
- type Telemetry
- func (t Telemetry) Log() *slog.Logger
- func (t Telemetry) LogError(ctx context.Context, msg string, err error, attrs ...any)
- func (t Telemetry) Start(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
- func (t Telemetry) StartRoot(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
Constants ¶
const ( DefaultSlowOp = 50 * time.Millisecond DefaultStatsEvery = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func FinishTyped ¶ added in v0.41.0
FinishTyped ends a span with attrs. A failed span records the Go type of the error and never its text.
Types ¶
type CallStats ¶ added in v0.17.0
type CallStats struct {
// contains filtered or unexported fields
}
CallStats counts calls by kind between two reads, and since it was made. Each call is counted, never sampled.
func NewCallStats ¶ added in v0.17.0
NewCallStats returns a recorder that reads time from clk; nil is the real clock.
func (*CallStats) Begin ¶ added in v0.17.0
Begin starts timing a call of kind. The returned function ends it. A nil receiver records nothing.
func (*CallStats) Take ¶ added in v0.17.0
func (c *CallStats) Take() []CallWindow
Take returns the windows of the kinds that had calls, sorted by kind, and resets them.
func (*CallStats) Totals ¶ added in v0.25.0
func (c *CallStats) Totals() []CallWindow
Totals returns what the calls of each kind did since the recorder was made, sorted by kind. Take does not reset them, so a caller can read them before and after one command and subtract.
type CallWindow ¶ added in v0.17.0
CallWindow is what the calls of one kind did since the last Take.
type Correlation ¶
Correlation names the workspace and the mount in every span and log record of the daemon.
func (Correlation) LogAttrs ¶
func (c Correlation) LogAttrs() []any
func (Correlation) SpanAttrs ¶
func (c Correlation) SpanAttrs() []attribute.KeyValue
type Health ¶
type Health struct {
Logger *slog.Logger
Node string
// Mounts returns the number of mounts the process serves.
Mounts func() int
// Tier2 returns the bytes in the node blob cache, and Tier2Evictions the segments and files that it removed.
Tier2 func() int64
Tier2Evictions func() int64
Every time.Duration
Clock clock.Clock
// contains filtered or unexported fields
}
Health logs the vfs.health record of the daemon process: the signal to read when the Go runtime shows up in the hot path of a mount.
type OpTrace ¶
type OpTrace struct {
// contains filtered or unexported fields
}
OpTrace collects the store calls that one FUSE operation waits on, so that a slow-operation span can link to them.
func NewOpTrace ¶
NewOpTrace returns ctx with a new OpTrace that the store calls under ctx report to.
func OpTraceFrom ¶
OpTraceFrom returns the OpTrace of ctx, or nil.
type Telemetry ¶
type Telemetry struct {
Logger *slog.Logger
Corr Correlation
// SlowOp is the latency above which a FUSE operation emits a span; zero is 50 ms.
SlowOp time.Duration
// StatsEvery is the interval of the vfs.stats record; zero is 30 s.
StatsEvery time.Duration
// Tracer starts the spans; nil is the package tracer.
Tracer trace.Tracer
}
Telemetry configures the spans and log records of one mount. The zero value logs nothing and sends spans to the global provider, which exports none unless the process installed a tracer provider.
func (Telemetry) LogError ¶
logError logs one failure with the correlation attributes. It never logs a path, a grant or file content.
func (Telemetry) Start ¶
func (t Telemetry) Start(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
start begins a span that carries the correlation attributes.
func (Telemetry) StartRoot ¶ added in v0.41.0
func (t Telemetry) StartRoot(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
StartRoot starts a span that has no parent, so that the sampling of a request that happens to run it does not drop it. It is for work that has no request and is rare and long.