metrics

package
v0.0.0-...-0301fe8 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 7 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

Index

Constants

This section is empty.

Variables

View Source
var (
	ReadCachePendingBatches = promauto.NewGauge(prometheus.GaugeOpts{Name: "pitot_read_cache_pending_batches", Help: "Nonempty active immutable batches across spans, logs and metrics not covered at the start of the last read-cache pass"})
	// Drill-down ranking scans uncached spans raw, so their count, not the
	// batch count, sizes that part of its cost.
	ReadCachePendingSpans = promauto.NewGauge(prometheus.GaugeOpts{Name: "pitot_read_cache_pending_spans", Help: "Spans in active immutable batches not covered at the start of the last read-cache pass"})

	// QueryCacheRequests counts panel, exemplar and trace-detail lookups in the
	// query result cache: hit (fresh), stale (served while one refresh runs),
	// miss (ran the queries) and coalesced (joined an identical run in flight).
	QueryCacheRequests = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_query_cache_requests_total",
		Help: "Query result cache lookups by result: hit, stale, miss or coalesced",
	}, []string{"result"})

	QueryCacheBytes = promauto.NewGauge(prometheus.GaugeOpts{
		Name: "pitot_query_cache_bytes",
		Help: "Estimated bytes of results held in the query result cache",
	})

	IngestBackpressureSeconds = promauto.NewCounter(prometheus.CounterOpts{
		Name: "pitot_ingest_backpressure_seconds_total", Help: "Total seconds an ingest admission rate cap was active",
	})

	CompactionPassSeconds = promauto.NewHistogram(prometheus.HistogramOpts{
		Name: "pitot_compaction_pass_seconds", Help: "Duration of a compaction pass including publication", Buckets: []float64{0.1, 0.5, 1, 2, 5, 10, 30, 60, 120, 300},
	})
	CompactionRetiredBatches = promauto.NewCounter(prometheus.CounterOpts{
		Name: "pitot_compaction_retired_batches_total", Help: "Input batches retired from the live catalog by compaction publications",
	})

	IngestThrottled = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_ingest_throttled_total", Help: "Whole exports refused by admission reason: debt, reads or budget",
	}, []string{"reason"})
	IngestAdmissionRate = promauto.NewGauge(prometheus.GaugeOpts{
		Name: "pitot_ingest_admission_rows_per_second", Help: "Current ingest admission rows per second; zero means uncapped",
	})

	// Ingest metrics
	IngestTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_ingest_rows_total",
		Help: "Total rows ingested",
	}, []string{"signal"})

	IngestQueueDepth = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "pitot_ingest_queue_depth",
		Help: "Current ingest submission queue depth",
	}, []string{"signal"})

	FlushTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_flush_total",
		Help: "Total flush operations",
	}, []string{"signal"})

	// IngestShedTotal counts requests refused because accepting them would
	// take the process past the bytes it is willing to hold in flight. A
	// non-zero value is the system protecting itself, not a fault -- but a
	// rising one means senders are being asked to retry, which is worth
	// seeing before it becomes a support question.
	IngestShedTotal = promauto.NewCounter(prometheus.CounterOpts{
		Name: "pitot_ingest_shed_total",
		Help: "Telemetry requests refused because ingest was over its in-flight byte budget",
	})

	// IngestAbandonedTotal counts requests dropped before their commit
	// started because the request had already ended: the sender timed out or
	// cancelled, or the server cut the request off while shutting down. The
	// sender resends, so storing the abandoned copy too would duplicate rows.
	IngestAbandonedTotal = promauto.NewCounter(prometheus.CounterOpts{
		Name: "pitot_ingest_abandoned_total",
		Help: "Telemetry requests dropped before commit because the request ended (sender timeout or cancel, or server shutdown)",
	})

	FlushDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "pitot_flush_duration_seconds",
		Help:    "Flush duration in seconds",
		Buckets: prometheus.DefBuckets,
	}, []string{"signal"})

	FlushErrors = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_flush_errors_total",
		Help: "Total flush write errors",
	}, []string{"signal"})

	RowsDropped = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_rows_dropped_total",
		Help: "Total rows left uncommitted after a permanent flush failure",
	}, []string{"signal"})

	WriteGateWait = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "pitot_write_gate_wait_seconds",
		Help:    "Time spent waiting to enter the Telemetry catalog write critical section",
		Buckets: []float64{.0001, .0005, .001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30, 60},
	}, []string{"operation"})

	WriteGateHold = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "pitot_write_gate_hold_seconds",
		Help:    "Time spent inside the Telemetry catalog write critical section",
		Buckets: []float64{.0001, .0005, .001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30, 60},
	}, []string{"operation"})

	// Rollup metrics
	RollupTotal = promauto.NewCounter(prometheus.CounterOpts{
		Name: "pitot_rollup_total",
		Help: "Total rollup operations",
	})

	RollupDuration = promauto.NewHistogram(prometheus.HistogramOpts{
		Name:    "pitot_rollup_duration_seconds",
		Help:    "Rollup duration in seconds",
		Buckets: []float64{.1, .5, 1, 2, 5, 10, 30, 60},
	})

	RollupRows = promauto.NewCounter(prometheus.CounterOpts{
		Name: "pitot_rollup_rows_total",
		Help: "Total rows processed by rollups",
	})

	RollupLastSuccess = promauto.NewGauge(prometheus.GaugeOpts{
		Name: "pitot_rollup_last_success_timestamp",
		Help: "Timestamp of last successful rollup",
	})

	RollupComponentTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_rollup_component_total",
		Help: "Rollup component executions by bounded outcome",
	}, []string{"rollup", "result"})

	// Duration is measured end to end and therefore includes time spent waiting
	// for the catalog write gate. That is deliberate: it is the latency an
	// operator cares about, and pitot_write_gate_wait_seconds already isolates
	// the waiting half. Timing only the held section would duplicate
	// pitot_write_gate_hold_seconds.
	RollupComponentDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "pitot_rollup_component_duration_seconds",
		Help:    "Rollup component duration in seconds, including write-gate wait",
		Buckets: []float64{.001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30, 60},
	}, []string{"rollup"})

	RollupComponentRows = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_rollup_component_rows_total",
		Help: "Rows materialized by each rollup component",
	}, []string{"rollup"})

	RollupEnabled = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "pitot_rollup_enabled",
		Help: "Whether the rollup component is enabled",
	}, []string{"rollup"})

	RollupWatermark = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "pitot_rollup_watermark_timestamp_seconds",
		Help: "Latest completed rollup watermark as a Unix timestamp",
	}, []string{"rollup"})

	RollupSourceMax = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "pitot_rollup_source_timestamp_seconds",
		Help: "Latest source ingest timestamp visible to the rollup",
	}, []string{"rollup"})

	RollupLag = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "pitot_rollup_lag_seconds",
		Help: "Source ingest time not yet covered by the completed rollup watermark",
	}, []string{"rollup"})

	RollupBacklogChunks = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "pitot_rollup_backlog_chunks",
		Help: "Estimated bounded catch-up chunks remaining for the rollup",
	}, []string{"rollup"})

	TelemetryOperationTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_telemetry_operation_total",
		Help: "Telemetry compaction and maintenance calls by bounded outcome",
	}, []string{"operation", "result"})

	TelemetryOperationDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "pitot_telemetry_operation_duration_seconds",
		Help:    "Executed telemetry compaction and maintenance duration in seconds",
		Buckets: []float64{.001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30, 60, 120, 300},
	}, []string{"operation"})

	// Storage metrics
	ParquetSize = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "pitot_parquet_size_bytes",
		Help: "Total size of telemetry Parquet files in bytes",
	}, []string{"signal"})

	ParquetFiles = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "pitot_parquet_files",
		Help: "Number of telemetry Parquet files per signal",
	}, []string{"signal"})

	// A swap is a rename and an fsync, so the ladder starts in microseconds.
	ParquetPublishHold = promauto.NewHistogram(prometheus.HistogramOpts{
		Name:    "pitot_parquet_publish_hold_seconds",
		Help:    "Time one Parquet publication took to swap a new file set into the catalog; readers never wait for it",
		Buckets: []float64{.000001, .000005, .00002, .0001, .0005, .001, .005, .025, .1, .5, 1, 2.5, 5, 10, 30, 60},
	})

	ParquetRetiringBatches = promauto.NewGauge(prometheus.GaugeOpts{
		Name: "pitot_parquet_retiring_batches",
		Help: "Batches compaction or retention replaced whose files wait for earlier readers to finish",
	})

	// The wait to enter the snapshot and the wait for a connection are both
	// measured; how long the statement itself takes was not, so a slow request
	// could be attributed to queueing or to execution only by elimination.
	// The connection is acquired before this timer starts, so the two do not
	// overlap.
	DuckDBStatement = promauto.NewHistogram(prometheus.HistogramOpts{
		Name:    "pitot_duckdb_statement_seconds",
		Help:    "Time a read statement spent executing in DuckDB, excluding any wait to start it",
		Buckets: []float64{.0005, .001, .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 30},
	})

	// DuckDB checks for interrupts only between chunks, so a costly
	// expression can run a statement long past its deadline.
	DuckDBStatementOverruns = promauto.NewCounter(prometheus.CounterOpts{
		Name: "pitot_duckdb_statement_overruns_total",
		Help: "Read statements seen running more than 25 seconds past their deadline",
	})

	// An explicit CHECKPOINT blocks new transactions for its duration, and the
	// non-FORCE form refuses while another write transaction is open — so both
	// how long it takes and how often it does not happen are worth knowing.
	DuckDBCheckpoint = promauto.NewHistogram(prometheus.HistogramOpts{
		Name:    "pitot_duckdb_checkpoint_seconds",
		Help:    "Duration of an explicit DuckDB checkpoint on the rollup cache",
		Buckets: []float64{.001, .005, .01, .05, .1, .25, .5, 1, 2.5, 5, 10, 30},
	})

	DuckDBCheckpointFailures = promauto.NewCounter(prometheus.CounterOpts{
		Name: "pitot_duckdb_checkpoint_failures_total",
		Help: "Explicit DuckDB checkpoints that returned an error",
	})

	// HTTP metrics
	HTTPRequestsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "pitot_http_requests_total",
		Help: "Total HTTP requests",
	}, []string{"method", "path", "status"})

	HTTPRequestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "pitot_http_request_duration_seconds",
		Help:    "HTTP request duration in seconds",
		Buckets: prometheus.DefBuckets,
	}, []string{"method", "path"})

	// Authentication and authorization metrics.
	BrowserSessions = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "pitot_auth_browser_sessions",
		Help: "Browser session rows by current lifecycle state",
	}, []string{"state"})

	AuthAuditWriteFailures = promauto.NewCounter(prometheus.CounterOpts{
		Name: "pitot_auth_audit_write_failures_total",
		Help: "Security audit events that could not be persisted",
	})
)

Functions

func RecordDrilldownStage

func RecordDrilldownStage(stage string, seconds float64)

RecordDrilldownStage times one stage of an indexed trace drill-down.

func RecordFlush

func RecordFlush(signal string, durationSec float64)

RecordFlush records a flush event.

func RecordIngest

func RecordIngest(signal string, count int)

RecordIngest records an ingest event

func RecordIngestAbandoned

func RecordIngestAbandoned()

RecordIngestAbandoned counts one telemetry request dropped before commit.

func RecordIngestShed

func RecordIngestShed()

RecordIngestShed counts one refused telemetry request.

func RecordPanelAdmission

func RecordPanelAdmission(id, status string, seconds float64)

RecordPanelAdmission separates connection pressure from SQL execution time.

func RecordPanelQuery

func RecordPanelQuery(id, status string, seconds float64)

RecordPanelQuery admits only a fixed panel vocabulary. User-authored IDs and unknown outcomes must never become metric labels.

func RecordRollup

func RecordRollup(rows int, durationSec float64, successful bool)

RecordRollup records a complete rollup cycle. A partial failure still records throughput and duration but does not advance the last-success gauge.

func RecordRollupComponent

func RecordRollupComponent(component RollupComponent, result RollupResult, rows int64, durationSec float64)

RecordRollupComponent records one bounded rollup component outcome.

func RecordTelemetryOperation

func RecordTelemetryOperation(operation TelemetryOperation, result TelemetryResult, durationSec float64)

RecordTelemetryOperation records an outcome for compaction or maintenance. Skipped calls have no duration sample so throttle ticks cannot distort execution p95.

func RecordWriteGate

func RecordWriteGate(operation string, waitSec, holdSec float64)

RecordWriteGate records one complete Telemetry catalog write critical section. Callers constrain operation to the fixed writegate.Operation set so this metric cannot grow with tenant or telemetry cardinality.

func SetCompactionBacklogSource

func SetCompactionBacklogSource(count func() int) func()

SetCompactionBacklogSource reads the cached exact inventory. The source must not take the catalog lock. Closing an older repository cannot clear a newer source.

func SetDuckDBMemorySource

func SetDuckDBMemorySource(interval time.Duration) (record func(map[string]int64, time.Time), release func())

SetDuckDBMemorySource installs a cache, never a scrape-time query. Record publishes a complete successful sample; failures leave the last one intact. Releasing an older Duck cannot clear a newer Duck's source.

func SetDuckDBPoolSource

func SetDuckDBPoolSource(stats func() sql.DBStats) (release func())

SetDuckDBPoolSource reads database/sql bookkeeping on each scrape without querying the engine. Releasing an older Duck cannot clear a newer source.

func UpdateParquetStats

func UpdateParquetStats(signal string, bytes int64, partitions int)

UpdateParquetStats updates open Parquet storage metrics.

func UpdateQueueDepth

func UpdateQueueDepth(signal string, depth int)

UpdateQueueDepth updates queue depth metric

func UpdateRollupProgress

func UpdateRollupProgress(component RollupComponent, enabled bool, watermarkNanos, sourceNanos int64, backlogChunks int)

UpdateRollupProgress records the committed watermark and the source tip seen by a rollup. backlogChunks is calculated by the query kernel from its bounded catch-up window.

Types

type RollupComponent

type RollupComponent string
const (
	RollupService   RollupComponent = "service"
	RollupReadCache RollupComponent = "read_cache"
	RollupEdge      RollupComponent = "edge"
	RollupVersion   RollupComponent = "version"
)

type RollupResult

type RollupResult string
const (
	RollupSuccess  RollupResult = "success"
	RollupError    RollupResult = "error"
	RollupNoop     RollupResult = "noop"
	RollupDisabled RollupResult = "disabled"
)

type TelemetryOperation

type TelemetryOperation string
const (
	TelemetryCompaction  TelemetryOperation = "compaction"
	TelemetryMaintenance TelemetryOperation = "maintenance"
)

type TelemetryResult

type TelemetryResult string
const (
	TelemetrySuccess   TelemetryResult = "success"
	TelemetryError     TelemetryResult = "error"
	TelemetryDisabled  TelemetryResult = "disabled"
	TelemetryThrottled TelemetryResult = "throttled"
	TelemetryNoop      TelemetryResult = "noop"
)

Jump to

Keyboard shortcuts

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