prometheus/storage/remote
Arve Knudsen 4afa76d083
OTLP: label caching for OTLP-to-Prometheus conversion to reduce allocations and improve latency (#17860)
* otlptranslator: add label caching for OTLP-to-Prometheus conversion

Add per-request caching to reduce redundant computation and allocations
during OTLP metric conversion:

1. Per-request label sanitization cache: Cache sanitized label names
   within a request to avoid repeated string allocations for commonly
   repeated labels like __name__, job, instance.

2. Resource-level label caching: Precompute and cache job, instance,
   promoted resource attributes, and external labels once per
   ResourceMetrics boundary instead of for each datapoint.

3. Scope-level label caching: Precompute and cache scope metadata labels
   (otel_scope_name, otel_scope_version, etc.) once per ScopeMetrics
   boundary.

4. LabelNamer instance caching: Reuse the LabelNamer struct across
   datapoints within the same resource context.

These optimizations significantly reduce allocations and improve latency
for OTLP ingestion workloads with many datapoints per resource/scope.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
2026-01-16 10:30:05 +00:00
..
azuread Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
googleiam Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
otlptranslator/prometheusremotewrite OTLP: label caching for OTLP-to-Prometheus conversion to reduce allocations and improve latency (#17860) 2026-01-16 10:30:05 +00:00
chunked.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
chunked_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
client.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
client_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
codec.go feat(tsdb): new AppenderV2 and AtST interface for chunks 2026-01-14 13:15:09 +01:00
codec_test.go feat(tsdb): new AppenderV2 and AtST interface for chunks 2026-01-14 13:15:09 +01:00
dial_context.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
dial_context_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
ewma.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
intern.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
intern_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
max_timestamp.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
metadata_watcher.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
metadata_watcher_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
queue_manager.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
queue_manager_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
read.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
read_handler.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
read_handler_test.go fix(remote_read): NHCB not returned over remote read samples (#17794) 2026-01-07 08:44:57 +01:00
read_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
stats.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
storage.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
storage_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
write.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
write_handler.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
write_handler_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00
write_test.go Remove copyright date from headers (#17785) 2026-01-05 13:46:21 +01:00