Skip to content

Latest commit

 

History

History
699 lines (473 loc) · 24.3 KB

metrics.md

File metadata and controls

699 lines (473 loc) · 24.3 KB

TAG Metrics Reference

TAG exposes Prometheus metrics at the /metrics endpoint.

Accessing Metrics

# Local
curl http://localhost:8080/metrics

# Kubernetes (port-forward)
kubectl port-forward svc/tag 8080:8080
curl http://localhost:8080/metrics

Metrics Reference

Request Metrics

tag_requests_total

Type: Counter

Total number of requests processed by TAG.

Label Description
operation S3 operation: GetObject, PutObject, DeleteObject, HeadObject
status Result: success, error, auth_error, range_not_satisfiable
mode The process's operating mode (transparent, signing, tiered) — one constant value per instance, for fleet-wide splits
source Request-handling path: local (TAG's own store or knowledge — cache hits, revalidated-304 serves, authoritative misses, auth errors) or upstream (proxied); a degraded block response may also use an upstream suffix

Example queries:

# Request rate by operation
rate(tag_requests_total[5m])

# Error rate
sum(rate(tag_requests_total{status="error"}[5m])) / sum(rate(tag_requests_total[5m]))

# Share of requests handled by the local TAG path (per mode; not per-byte upstream avoidance)
sum(rate(tag_requests_total{source="local"}[5m])) by (mode) / sum(rate(tag_requests_total[5m])) by (mode)

# GetObject success rate
rate(tag_requests_total{operation="GetObject",status="success"}[5m]) /
rate(tag_requests_total{operation="GetObject"}[5m])

tag_request_duration_seconds

Type: Histogram

Request duration in seconds.

Label Description
operation S3 operation
mode Operating mode (constant per instance)
source local or upstream — where the response was produced

Buckets: 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 7.5, 10 (the default Prometheus buckets plus extra tail resolution at 1.5, 2, 3, 4 and 7.5 seconds)

Example queries:

# P50 latency
histogram_quantile(0.5, rate(tag_request_duration_seconds_bucket[5m]))

# P99 latency by operation
histogram_quantile(0.99, sum(rate(tag_request_duration_seconds_bucket[5m])) by (operation, le))

# Average request duration
rate(tag_request_duration_seconds_sum[5m]) / rate(tag_request_duration_seconds_count[5m])

Cache Metrics

tag_cache_hits_total

Type: Counter

Total number of requests whose cache status was committed as X-Cache: HIT, including range-from-cache hits and conditional 304 (Not Modified) responses. It is recorded in lockstep with that header. This is a request-level cache decision, not a per-byte source or successful-transfer count: a block response may append a verified upstream suffix or later finish with an error; request status is recorded separately in tag_requests_total.

tag_cache_hits_total and tag_cache_misses_total count only HIT and MISS. REVALIDATED responses (object changed on upstream) are neither — they are tracked by the tag_revalidations_* metrics — and BYPASS/DISABLED requests are not counted at all.

Example queries:

# Cache hit rate
rate(tag_cache_hits_total[5m])

# Cache hit ratio (of hit/miss decisions; excludes REVALIDATED)
rate(tag_cache_hits_total[5m]) /
(rate(tag_cache_hits_total[5m]) + rate(tag_cache_misses_total[5m]))

tag_cache_misses_total

Type: Counter

Total number of cache misses.

tag_cache_operations_total

Type: Counter

Total number of cache operations.

Label Description
operation Operation type: get, put, meta_put, delete
result Result: hit, miss, success, error, precondition_lost

meta_put denotes metadata publication outcomes. precondition_lost means an ordered metadata write was refused: in legacy coordination, no decision token was supplied (expected == 0) or a newer tombstone was observed; in CAS coordination, a PutIfVersion version mismatch occurred. With legacy coordination, an unreadable or malformed tombstone is recorded as error and the write is refused.

Example queries:

# Cache operation breakdown
sum by (operation, result) (rate(tag_cache_operations_total[5m]))

tag_range_from_cache_hits_total

Type: Counter

Number of range requests served from cached full objects.

Example queries:

# Range cache efficiency
rate(tag_range_from_cache_hits_total[5m]) /
rate(tag_requests_total{operation="GetObject"}[5m])

tag_cache_serve_locality_total

Type: Counter

Cache body reads labeled by whether this node owns the key (locality="local", served from local storage) or had to pull it from a peer over gRPC (locality="remote"). In a cluster, a high remote share is the cross-node data-plane cost — the single-owner consistent-hash ring routes most reads to the owning node, so serving a range pulls the body from a peer. In single-node mode everything is local.

Label Description
locality local (this node owns the key) or remote (pulled from a peer)

Only populated when the embedded cache client can report key ownership (cluster mode on a build whose ocache exposes it). When it cannot, the counter stays at 0 rather than guessing a locality.

Example queries:

# Remote serve ratio (fraction of cache reads pulled cross-node; lower is better).
# Aggregate with sum() so the denominator is local+remote; dividing the raw
# vectors would match locality="remote" against itself and always report 1.
sum(rate(tag_cache_serve_locality_total{locality="remote"}[5m]))
/
sum(rate(tag_cache_serve_locality_total[5m]))

# Cross-node read rate per node
sum by (pod) (rate(tag_cache_serve_locality_total{locality="remote"}[5m]))

tag_cache_size_bytes

Type: Gauge

Current logical size of this node's local cache in bytes (the sum of stored object lengths), sampled periodically from the embedded cache. Per-node — sum across nodes for a cluster-wide total.

# Cluster-wide cache size
sum(tag_cache_size_bytes)

# Fill against a configured disk cap (bytes)
tag_cache_size_bytes / <max_disk_usage_bytes>

The embedded cache also exports ocache_disk_usage_bytes{type="total"} (same logical size) and ocache_segment_size_bytes (physical on-disk segment bytes, including fragmentation and not-yet-compacted tombstones) directly at /metrics. tag_cache_size_bytes is the stable, TAG-owned name for the logical size.

Broadcast Metrics

tag_broadcast_shared_total

Type: Counter

Number of requests that joined an existing broadcast stream.

Example queries:

# Coalescing ratio (higher is better)
rate(tag_broadcast_shared_total[5m]) /
(rate(tag_broadcast_shared_total[5m]) + rate(tag_broadcast_fetches_total[5m]))

tag_broadcast_fetches_total

Type: Counter

Number of upstream fetches (broadcast initiators).

tag_broadcast_slow_consumers_total

Type: Counter

Number of listeners disconnected for being too slow.

tag_active_broadcasts

Type: Gauge

Number of currently active broadcast streams.

Example queries:

# Active broadcasts over time
tag_active_broadcasts

# Max active broadcasts
max_over_time(tag_active_broadcasts[1h])

Background Fetch Metrics

tag_background_fetches_triggered_total

Type: Counter

Number of background full-object fetches triggered by range requests.

tag_background_fetches_succeeded_total

Type: Counter

Number of background fetches that completed successfully.

tag_background_fetches_failed_total

Type: Counter

Number of background fetches that failed.

Example queries:

# Background fetch success rate
rate(tag_background_fetches_succeeded_total[5m]) /
rate(tag_background_fetches_triggered_total[5m])

tag_active_background_fetches

Type: Gauge

Number of currently active background fetches.

tag_warm_on_write_triggered_total

Type: Counter

Number of cache warms triggered by a successful write, when cache.warm_on_write is enabled. The warm's own outcome (success / failure / shed) is recorded by the tag_background_fetches_* and tag_cache_populate_skipped_total metrics; this counts how often a write initiated one.

tag_cache_write_through_total

Type: Counter

Number of objects cached by teeing the PutObject body on the write path (write-through): the body is captured as it's forwarded and the object's metadata is sourced from a lightweight HEAD (which returns the same headers a GET would, without the body), so no full-object read-back GET is needed. Applies to authenticated single PUTs within cache.size_threshold in signing mode. Compare with tag_warm_on_write_triggered_total (the read-back full GET, used for multipart completions, CopyObject, over-threshold or anonymous writes, when the populate budget is saturated, and when the tee's HEAD can't confirm the just-written version).

# Share of write-triggered cache populates served by the write-through tee (no read-back)
rate(tag_cache_write_through_total[5m]) /
(rate(tag_cache_write_through_total[5m]) + rate(tag_warm_on_write_triggered_total[5m]))

tag_cache_block_populated_total / tag_cache_block_bytes_populated_total

Type: Counter

Block-aligned caching (RFC 0001, cache.block_caching_enabled). Objects at or above cache.block_size are cached at cache.block_size granularity on read, so a range read (e.g. a Parquet footer) populates and serves only the blocks it touches. tag_cache_block_populated_total counts blocks fetched from upstream and written to cache; tag_cache_block_bytes_populated_total is the bytes those fetches pulled. Compare the bytes against tag_bytes_transferred_total{direction="out"} to gauge populate-vs-served amplification.

tag_cache_block_populate_failed_total

Type: Counter

Blocks that were fetched from upstream and validated but whose cache write failed (either the unary byte-write fast path or the streaming fallback). Flood-safe, alertable signal for populate-write failures; the per-block error is logged only at Debug. Healthy value is 0 — alert on any sustained rate.

tag_cache_block_prefetch_windows_total

Type: Counter (labeled by outcome)

Multi-block serves classified by the prefetch window they were granted from the shared staging budget (half of cache.max_populate_memory_bytes):

outcome Meaning
full The requested window was granted — the fast pipelined path
shrunk A smaller window than requested was granted
sequential Every window size was declined — the serve degraded to the unbuffered sequential path

The two non-full outcomes have different costs: shrunk serves are still pipelined, just with less read concurrency (a mild, roughly proportional latency impact), while sequential serves alone take the unbuffered slow path (one cache read in flight — the pre-pipelining latency profile). Track them separately:

# Sequential fallback share — the true slow-path traffic. Any sustained non-zero
# rate under load means tail latency is being served by the sequential path:
# the signal to raise cache.max_populate_memory_bytes.
sum(rate(tag_cache_block_prefetch_windows_total{outcome="sequential"}[5m])) /
sum(rate(tag_cache_block_prefetch_windows_total[5m]))

# Budget-pressure share — serves that could not get their full window (shrunk +
# sequential). A leading indicator: rising pressure precedes sequential fallback.
sum(rate(tag_cache_block_prefetch_windows_total{outcome!="full"}[5m])) /
sum(rate(tag_cache_block_prefetch_windows_total[5m]))

tag_cache_block_prefetched_total

Type: Counter (labeled by trigger)

Blocks fetched speculatively rather than to satisfy a request in flight. This is a volume signal — how much speculative work each trigger is doing — not a precision signal.

Judge the benefit from the block hit ratio (tag_cache_block_hits_total / tag_cache_block_misses_total), which measures the outcome directly. Rising hit ratio with modest prefetch volume is what you want; volume with no movement in hit ratio means the speculation is not landing where reads go.

There is deliberately no matching _used_total. Attributing each serve back to a prefetch required a per-block lookup on the serve path, which runs thousands of times per second, to re-derive a ratio that is ~98% by construction — a reader that has read a parquet trailer cannot do anything except read the metadata region next.

Triggers today: parquet_footer (a read reached an object's trailer) and write_warm (a parquet object was written through TAG), both from cache.parquet_optimization — see docs/parquet-optimization.md.

tag_cache_parquet_footer_bytes

Type: Histogram

Size of the parquet metadata region, read from a valid trailer while cache.parquet_optimization is on. Admitted read scans and write warms record an observation; a read trigger shed by the service-wide scan limit does not inspect the trailer and is not recorded. Under saturation, the histogram can therefore omit eligible tail reads.

The population also depends on which triggers are active. With both on, an object written and later read through the same node can be observed twice, and write-heavy deployments will weight the distribution toward recently written objects. Read it as a distribution of observations, not of distinct objects — that is what makes it useful for drift detection and what to keep in mind before comparing across deployments.

An admitted prefetch needs blocks beyond the cached tail whenever footer + 8 exceeds the remainder block (ContentLength mod block_size, averaging half a block) — not merely when the footer exceeds block_size.

Footer size scales with row groups and columns, since the footer carries per-column statistics. On a production deployment with a wide schema, footers ran ~1.25% of object size — several MB on a few-hundred-MB object — so at a 1 MiB block_size the metadata spans several blocks. A narrow schema keeps the footer inside the tail block, where an admitted prefetch has nothing to fetch.

Use the histogram to estimate that ratio for the observed population and detect drift: a schema change alters footer size, but under saturation shed read scans are absent from the sample. A distribution that collapses below the remainder-block size means the optimization has stopped earning its keep only when scan admission is not distorting the population.

# Median footer size — compare against cache.block_size.
histogram_quantile(0.5, sum(rate(tag_cache_parquet_footer_bytes_bucket[1h])) by (le))

tag_cache_parquet_footer_prefetch_shed_total

Type: Counter

Eligible read-triggered footer prefetch attempts declined because the service-wide concurrent-scan limit was full. A nonzero rate signals admission pressure, but the counter is not an exact count of distinct footer observations omitted: admission precedes per-version coalescing, so a denied attempt can be for a version another scan is already handling.

# Read-triggered footer-prefetch attempts refused by the scan limit.
rate(tag_cache_parquet_footer_prefetch_shed_total[5m])

tag_cache_block_hits_total / tag_cache_block_misses_total

Type: Counter

Per-covering-block presence when serving a request from block mode: hits were already cached, misses had to be fetched. The block cache-hit ratio is:

rate(tag_cache_block_hits_total[5m]) /
(rate(tag_cache_block_hits_total[5m]) + rate(tag_cache_block_misses_total[5m]))

tag_cache_block_range_served_total

Type: Counter (labeled by result)

Requests served from block mode, labeled full_hit (every covering block was already cached) or partial_hit (at least one covering block had to be fetched). Partial-hit rate:

rate(tag_cache_block_range_served_total{result="partial_hit"}[5m]) /
rate(tag_cache_block_range_served_total[5m])

tag_cache_populate_skipped_total

Type: Counter

Cache-populate operations skipped because the concurrent-cache-write limit (count or memory budget) was saturated — the object is still served from upstream, just not cached.

Label Description
source warm_on_write (a write-triggered warm) or read_miss (a read-triggered warm)

For a read-recently-written workload with warm_on_write on, a healthy deployment shows source="warm_on_write" near zero while source="read_miss" absorbs the shedding — warm-on-write is protected from the read-miss warm flood by the reserved populate budget (cache.warm_on_write_reserved_fraction). Sum across sources for the total.

# Warm-on-write shed rate (should be ~0 when protected)
rate(tag_cache_populate_skipped_total{source="warm_on_write"}[5m])

# Total populate shed rate
sum(rate(tag_cache_populate_skipped_total[5m]))

tag_tiered_cleanup_total

Type: Counter

Tiered mode's cross-tier cleanup deletes (issued when a small local write displaces an upstream-tier version), by outcome — exactly one per cleanup. Cleanup is best-effort: anything other than deleted / already_gone / replaced / marker_repaired leaves an orphan for the upstream bucket's own expiry — failures are Debug-logged, so this counter is the rollout-visibility signal.

Label Description
outcome deleted, already_gone (404), replaced (412 — a newer version took the key, left alone), rejected (other upstream refusal), error (request failed), no_etag (no displaced ETag to bind to; skipped), unverified_backend (skipped: non-Tigris endpoint, where If-Match enforcement on DELETE is unverified — cleanup is disabled by construction), live_marker (skipped: the key's current metadata is a live marker for this ETag — the body is authoritative again), marker_repaired (a same-ETag marker raced in during the delete; the repair removed it, converging on an authoritative miss the caller re-populates), repair_failed (the repair could not run or could not remove the raced-in marker — it may stay authoritative over a deleted body until TTL)
# Orphan-producing cleanup rate (should be ~0)
sum(rate(tag_tiered_cleanup_total{outcome=~"rejected|error|no_etag|repair_failed"}[5m]))

tag_tiered_retier_total

Type: Counter

Tiered mode's re-tier-on-read attempts: a validated GET that hits an upstream-tier marker whose size fits the local tier triggers a one-shot background move of the body into the local tier (healing objects mis-placed by, e.g., a cold-start PUT forwarded before its key was learned).

Label Description
outcome retiered (moved into the local tier), shed (populate budget refused the buffer), changed (object replaced/deleted mid-flight; its newer state wins), canceled (a concurrent write claimed the key — normal coordination), error (fetch or store failed)

A sustained retiered rate outside restart windows means writes keep landing in the wrong tier — check key learning. Per-key dedup skips are not counted.

Revalidation Metrics

tag_revalidations_triggered_total

Type: Counter

Number of cache revalidation attempts (conditional GET/HEAD to upstream). Incremented when a client sends Cache-Control: no-cache or max-age=0 and a cached entry with an ETag exists.

Example queries:

# Revalidation rate
rate(tag_revalidations_triggered_total[5m])

tag_revalidations_not_modified_total

Type: Counter

Number of revalidations where upstream returned 304 Not Modified (cached entry is still fresh).

Example queries:

# Revalidation 304 ratio (higher = better cache freshness)
rate(tag_revalidations_not_modified_total[5m]) /
rate(tag_revalidations_triggered_total[5m])

tag_revalidations_updated_total

Type: Counter

Number of revalidations where upstream returned 200 with new data (cached entry was stale).

tag_revalidations_failed_total

Type: Counter

Number of revalidations that failed due to errors or unexpected status codes.

tag_revalidations_stale_served_total

Type: Counter

Number of times stale cached data was served because the revalidation request to upstream failed.

Example queries:

# Stale serve ratio (should be low)
rate(tag_revalidations_stale_served_total[5m]) /
rate(tag_revalidations_triggered_total[5m])

Upstream Metrics

tag_upstream_request_duration_seconds

Type: Histogram

Upstream (Tigris) request duration in seconds.

Label Description
method HTTP method: GET, PUT, DELETE, HEAD

Example queries:

# Upstream P99 latency
histogram_quantile(0.99, rate(tag_upstream_request_duration_seconds_bucket[5m]))

tag_upstream_errors_total

Type: Counter

Total number of upstream errors.

Label Description
method HTTP method

Authentication Metrics

tag_auth_failures_total

Type: Counter

Total number of authentication failures.

Label Description
reason Failure reason: invalid_signature, unknown_key, expired

Transparent Proxy Metrics

tag_local_auth_validations_total

Type: Counter

Local authentication validation attempts and results in transparent proxy mode.

Label Description
result Validation result: success, missing_auth, parse_error, unknown_key, signature_mismatch, authz_expired

Example queries:

# Local auth success rate
rate(tag_local_auth_validations_total{result="success"}[5m]) /
sum(rate(tag_local_auth_validations_total[5m]))

# Auth failure breakdown
sum by (result) (rate(tag_local_auth_validations_total{result!="success"}[5m]))

tag_derived_key_store_size

Type: Gauge

Number of stored derived signing keys (learned from Tigris responses).

tag_authz_cache_size

Type: Gauge

Number of active authorization cache entries (per access-key, per bucket).

tag_proxy_signing_keys_received_total

Type: Counter

Number of signing key sets extracted from Tigris responses (used for local signature validation).

Connection Metrics

tag_active_connections

Type: Gauge

Number of active connections.

tag_bytes_transferred_total

Type: Counter

Total bytes transferred.

Label Description
direction Transfer direction: in, out

Example queries:

# Throughput (bytes/sec)
rate(tag_bytes_transferred_total[5m])

# Outbound throughput
rate(tag_bytes_transferred_total{direction="out"}[5m])

Prometheus Configuration

scrape_configs:
  - job_name: "tag"
    kubernetes_sd_configs:
      - role: pod
    relabel_configs:
      - source_labels: [__meta_kubernetes_pod_label_app]
        action: keep
        regex: tag
      - source_labels: [__meta_kubernetes_pod_container_port_number]
        action: keep
        regex: "8080"