tel

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tel carries the correlation attributes, spans and log records of the node daemon.

Index

Constants

View Source
const (
	DefaultSlowOp     = 50 * time.Millisecond
	DefaultStatsEvery = 30 * time.Second
)

Variables

This section is empty.

Functions

func Finish

func Finish(span trace.Span, err error)

finish ends a span and marks it failed when err is not nil.

func Tracer

func Tracer() trace.Tracer

Tracer is the tracer of the node daemon.

func WithCalls added in v0.17.0

func WithCalls(ctx context.Context, c *CallStats) context.Context

WithCalls returns ctx so that the store calls made under it count in c.

func WithTraceparent

func WithTraceparent(ctx context.Context, traceparent string) context.Context

WithTraceparent returns ctx with the remote span context of a W3C traceparent header value. A value that does not parse leaves ctx unchanged.

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 CallsFrom added in v0.17.0

func CallsFrom(ctx context.Context) *CallStats

CallsFrom returns the recorder that WithCalls set, or nil.

func NewCallStats added in v0.17.0

func NewCallStats(clk clock.Clock) *CallStats

NewCallStats returns a recorder that reads time from clk; nil is the real clock.

func (*CallStats) Begin added in v0.17.0

func (c *CallStats) Begin(kind string) (end func())

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

type CallWindow struct {
	Kind       string
	Count      uint64
	Total, Max time.Duration
}

CallWindow is what the calls of one kind did since the last Take.

type Correlation

type Correlation struct {
	WorkspaceID, Repo, MountID, Mode, Runtime, Node string
	Epoch                                           uint64
}

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.
	Tier2 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.

func (*Health) Run

func (h *Health) Run(ctx context.Context)

Run writes a record every Every until ctx ends.

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

func NewOpTrace(ctx context.Context) (context.Context, *OpTrace)

NewOpTrace returns ctx with a new OpTrace that the store calls under ctx report to.

func OpTraceFrom

func OpTraceFrom(ctx context.Context) *OpTrace

OpTraceFrom returns the OpTrace of ctx, or nil.

func (*OpTrace) AddStore

func (o *OpTrace) AddStore(sc trace.SpanContext, d time.Duration)

AddStore records one store call of the operation.

func (*OpTrace) Waited

func (o *OpTrace) Waited() (time.Duration, []trace.Link)

Waited returns the time that the operation spent on the store and the spans of its first calls.

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) Log

func (t Telemetry) Log() *slog.Logger

func (Telemetry) LogError

func (t Telemetry) LogError(ctx context.Context, msg string, err error, attrs ...any)

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.

Jump to

Keyboard shortcuts

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