telemetry

package
v1.0.0-beta.8 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LargeSpanQueueSize       = 16384 // 16Ki — 8x the SDK default; bounds retained snapshots per hop
	LargeSpanExportBatchSize = 2048  // drains a full queue in 8 batches; bounds per-batch references
)

Enlarged, BOUNDED BatchSpanProcessor sizes for the span hops that carry a trace toward Dagger Cloud. The OTel BSP queue is non-blocking and silently DROPS spans on overflow; the SDK default of 2048 slots is too small for a burst like a cold engine build (~15k spans, live-double-emitted into ~30k records), which is why these hops use a larger queue at all.

The queue must stay MODEST as well as bounded, because its worst case is paid per PROCESSOR, and processors multiply: every client gets one such processor for its own DB plus one per ancestor client, each with an eagerly allocated ring (16 bytes/slot) that can fill with full span snapshots whenever the store exporter falls behind. A heavily grouped CI session can hold dozens of clients, so per-processor worst case × processor count is the engine's telemetry memory ceiling. At 16Ki slots the per-processor ceiling is ~16 MiB of retained snapshots (at ~1 KiB each) plus a 256 KiB ring — 16x below the previous 256Ki sizing, which put a loaded session's aggregate worst case far past the physical memory of a typical CI runner — while still giving 8x the SDK default's burst headroom.

Kept BOUNDED — never BlockOnQueueFull — so telemetry can NEVER stall the build. If a burst still overflows, spans are dropped rather than retained: the wcprof completeness checksum (received < declared, see engine/server/wcprofcount.go) catches the loss loudly and the offline analyzer refuses the trace instead of silently ranking on partial data.

View Source
const (
	LogExportInterval     = 250 * time.Millisecond
	LogExportMaxBatchSize = 128
)

Log-record batch settings for the per-client DB log routes (engine/server).

The SDK BatchProcessor's poll loop clones its entire batchSize-long []Record buffer on EVERY export tick while the exporter is ready — even when zero records were dequeued (sdk/log batch.go: TryDequeue's write callback does buf = slices.Clone(buf), and EnqueueExport returns true for an empty slice). A Record is a large struct (~0.5 KiB inline), so the resulting allocation churn is processors × ticks/sec × batchSize × sizeof(Record), INDEPENDENT of actual log volume. The engine registers one processor per client per ancestor route, so a grouped session easily holds 100+ of them; at the previous 100ms interval and default 512 batch this produced tens of GB of allocation churn per run (measured: 22–37 GB of slices.Clone[[]sdklog.Record] in a grouped python-sdk check run).

Interval and batch size each scale that churn linearly. Crucially, OnEmit self-flushes as soon as a full batch accumulates (pollTrigger), so a longer interval delays only SPARSE log records — bursts still export immediately. 250ms/128 cuts the volume-independent churn ~10x while keeping trickle latency well below human-noticeable for log output.

View Source
const HeartbeatInterval = 30 * time.Second

Variables

This section is empty.

Functions

func MeasuringStreamClientInterceptor

func MeasuringStreamClientInterceptor() grpc.StreamClientInterceptor

func MeasuringUnaryClientInterceptor

func MeasuringUnaryClientInterceptor() grpc.UnaryClientInterceptor

func MeasuringUnaryServerInterceptor

func MeasuringUnaryServerInterceptor() grpc.UnaryServerInterceptor

func NewLargeQueueLiveSpanProcessor

func NewLargeQueueLiveSpanProcessor(exp sdktrace.SpanExporter) *telemetry.LiveSpanProcessor

NewLargeQueueLiveSpanProcessor is otel.NewLiveSpanProcessor with the enlarged bounded queue above in place of the default 2048-slot one. Used on the CLI→Cloud exporter (internal/cmd/dagger) and the engine's per-client store exporters so a big-burst trace arrives complete.

func NewLogBatchProcessor

func NewLogBatchProcessor(exp sdklog.Exporter) *sdklog.BatchProcessor

NewLogBatchProcessor is the log analog of NewLargeQueueLiveSpanProcessor: the batch processor for every per-client DB log route, with the bounded churn settings above in place of the SDK defaults.

func ReexportMetricsFromPB added in v0.13.6

func ReexportMetricsFromPB(ctx context.Context, exps []sdkmetric.Exporter, req *colmetricspb.ExportMetricsServiceRequest) error

func Task

func Task(ctx context.Context, name string, fn func(context.Context) error) (rerr error)

func TaskRet

func TaskRet[T any](ctx context.Context, name string, fn func(context.Context) (T, error)) (ret T, rerr error)

func URLForTrace

func URLForTrace(ctx context.Context) (url string, msg string, ok bool)

Types

type EnvGetter added in v0.19.7

type EnvGetter interface {
	Getenv(key string) string
}

type LabelFlag

type LabelFlag struct {
	Labels
}

func NewLabelFlag

func NewLabelFlag() LabelFlag

func (LabelFlag) Set

func (flag LabelFlag) Set(s string) error

func (LabelFlag) String

func (flag LabelFlag) String() string

func (LabelFlag) Type

func (flag LabelFlag) Type() string

type Labels

type Labels struct {
	// contains filtered or unexported fields
}

func LoadDefaultLabels

func LoadDefaultLabels(workdir, clientEngineVersion string) Labels

func NewLabels added in v0.19.7

func NewLabels(labels map[string]string, eg EnvGetter, ghEventPayload []byte) Labels

func (Labels) AsMap added in v0.19.7

func (labels Labels) AsMap() map[string]string

AsMap returns a reference to the internal labels map. It's not intended to be moodified by the caller.

func (Labels) Get added in v0.19.7

func (labels Labels) Get(key string) (string, bool)

func (*Labels) UnmarshalJSON

func (labels *Labels) UnmarshalJSON(dt []byte) error

func (Labels) UserAgent

func (labels Labels) UserAgent() string

func (Labels) WithCILabels

func (labels Labels) WithCILabels() Labels

func (Labels) WithCircleCILabels

func (labels Labels) WithCircleCILabels() Labels

func (Labels) WithClientLabels

func (labels Labels) WithClientLabels(engineVersion string) Labels

func (Labels) WithEngineLabel

func (labels Labels) WithEngineLabel(engineName string) Labels

func (Labels) WithGitHubLabels

func (labels Labels) WithGitHubLabels() Labels

func (Labels) WithGitLabLabels

func (labels Labels) WithGitLabLabels() Labels

func (Labels) WithGitLabels

func (labels Labels) WithGitLabels(workdir string) Labels

func (Labels) WithHarnessLabels added in v0.14.0

func (labels Labels) WithHarnessLabels() Labels

func (Labels) WithJenkinsLabels added in v0.12.0

func (labels Labels) WithJenkinsLabels() Labels

func (Labels) WithServerLabels

func (labels Labels) WithServerLabels(engineVersion, os, arch string, cacheEnabled bool) Labels

func (Labels) WithVCSLabels

func (labels Labels) WithVCSLabels(workdir string) Labels

type OSEnvGetter added in v0.19.7

type OSEnvGetter struct{}

func (OSEnvGetter) Getenv added in v0.19.7

func (e OSEnvGetter) Getenv(key string) string

type SpanHeartbeater

type SpanHeartbeater struct {
	sdktrace.SpanExporter
	// contains filtered or unexported fields
}

SpanHeartbeater is a SpanExporter that keeps track of live spans and re-exports them periodically to the underlying SpanExporter to indicate that they are indeed still live.

func NewSpanHeartbeater

func NewSpanHeartbeater(exp sdktrace.SpanExporter) *SpanHeartbeater

func (*SpanHeartbeater) ExportSpans

func (p *SpanHeartbeater) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

func (*SpanHeartbeater) Shutdown

func (p *SpanHeartbeater) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

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