发布日期: 2026-09-25
版本号: v3.15.0

Prometheus 本次更新涵盖多方面改进:查询与 PromQL 修复了范围查询未对齐 step 导致子查询超额采样、info() 函数多种元数据修正、正则误匹配、空结果及 panic 等一批问题;配置方面弃用 –log.level,改用 runtime.log_level 并支持热加载;新增 –auto-gomemlimit.refresh-interval 定时刷新内存限制、Unix Domain Sockets 抓取目标、OM2.0 抓取格式和 zstd 压缩抓取(feature flag)。性能上优化了 TSDB 头块初始化 CPU、XOR 块解压快速路径、AWS 服务发现的并发与缓存复用、抓取池并行关闭等。TSDB 稳定了 XOR2 浮点块编码(改用配置项启用),新增多个 head 相关指标,并修复了 GC 期间丢样本、死锁、chunk ID 溢出、WAL 损坏与重放 panic 等严重缺陷。此外修复了原生直方图 DetectReset 漏检重置、桶压缩错位、OTLP 单指标无数据点导致整批中断、多个云服务发现(AWS、IONOS、Kubernetes)因可选字段缺失引发的 panic,以及 UI、Mixin、规则管理器、promtool 等的若干问题。

更新内容 (中文)

  • [变更] PromQL:当范围查询的 end 未与 step 对齐时,其内部的子查询会计算到父查询最后一个实际步骤之后,导致查询统计中的 peakSamples 膨胀并触发 query.max-samples 限制,同时浪费存储 I/O 去读取结果中从未使用的样本。添加测试以防止 #18081 中的修复出现回归。#18598
  • [变更] PromQL:如果后续样本之间的起始时间戳没有变化,则不再注册起始时间戳重置。#19454
  • [变更] 日志:弃用 --log.level;请使用 runtime.log_level 配置来提供默认级别。#19511
  • [特性] 配置:允许在配置重载时通过 runtime.log_level 更改进程日志级别。#19511
  • [特性] Prometheus:新增 --auto-gomemlimit.refresh-interval 标志,用于定期重新检测容器或系统内存限制并在运行时更新 GOMEMLIMIT。#18843
  • [特性] 抓取:支持通过 Unix 域套接字(Unix Domain Sockets)抓取目标。#12024,#18091
  • [特性] scrape:实现 OM2.0 抓取格式。#18606
  • [增强] 降低 TSDB head 初始化时的 CPU 占用。#18001
  • [增强] Docker SD:新增标签 __meta_docker_container_image 和 __meta_docker_container_image_id。#19386
  • [增强] Mixin:在 remote-write 仪表盘中新增 p95/p99 remote-write 发送批次延迟面板。#19500
  • [增强] Mixin:remote-write 发送批次延迟面板支持原生直方图。#19522
  • [增强] PromQL/TSDB:--enable-feature=st-storage 标志现在会自动启用 XOR2 浮点块编码和支持 ST 的直方图块编码,因此不再需要同时传入 xor2-encoding 和 histograms-st-encoding。#19518
  • [增强] Remote write / Alertmanager:将 sigv4 升级到 v0.5.0,为 STS AssumeRole 会话新增 session_name 和 tags 字段。此前未记录的 service_name 字段现在也已记录在文档中。#19569
  • [增强] 抓取:支持 zstd 压缩的抓取响应,通过特性标志 zstd-scrape 启用。#19502
  • [增强] TSDB:XOR2 浮点块编码已趋于稳定。--enable-feature=xor2-encoding 已弃用;请改用 storage.tsdb.chunk_encoding.floats: xor2。启用前请确认直接读取 TSDB 的其他软件(例如 Thanos sidecar)支持 XOR2。#19461
  • [增强] TSDB:新增 prometheus_tsdb_head_appenders_created_total 指标。#19411
  • [增强] 链路追踪:为抓取、API 查询和规则评估添加更多 span。#19410
  • [增强] UI:在 Targets 和 Service Discovery 页面显示每个抓取池的有效配置。#19384
  • [增强] scrape:在抓取追加器 v2 中为 summary 的 _count 和 _sum 序列启用开始时间合成。#19323
  • [增强] scrape:并行停止所有抓取池以加快关闭速度。#19295
  • [增强] storage/remote:新增未记录的 failed_request_logging 配置字段,用于在发送出错时调试记录 remote write V2 请求。#19249
  • [增强] TSDB:为 XOR 块解压添加快速路径以加快查询速度。#18049
  • [增强] UI:改进原生直方图表格格式化,并添加表示桶计数的背景条。#19332
  • [增强] TSDB:新增 prometheus_tsdb_head_series_pending_commit_underflow_total,用于报告待提交样本预留下溢。#19470
  • [性能] AWS SD:RDS 集群标签按集群构建一次,而不是按实例构建一次。#19504
  • [性能] AWS SD:并发描述不同集群的 RDS 实例,受 request_concurrency 限制。#19506
  • [性能] AWS SD:每个 ElastiCache 资源每次刷新只描述一次,而不是两次。#19585
  • [性能] Remote read:当未配置外部标签时,避免为采样读取克隆标签。#19503
  • [性能] Remote write:在请求之间复用 OTLP 转换器的临时状态。#19388
  • [性能] scrape:从经典直方图转换为原生直方图时,仅在启用时才解析开始时间。#19446
  • [缺陷修复] PromQL:修复包含混合 @/offset 引用或无选择器向量分支的复合表达式的 info() 丰富处理,避免在无关的时间戳上评估元数据。#19387
  • [缺陷修复] PromQL:修复当输入序列使用识别标签的不同子集时 info() 的丰富处理。#19557
  • [缺陷修复] PromQL:启用延迟名称移除时,保留经过 info 函数的指标名称丢弃行为。#19413
  • [缺陷修复] TSDB:当 head 垃圾回收在序列正在追加时移除该序列,不再静默丢弃样本。#19272
  • [缺陷修复] TSDB:在选定序列和过期序列压缩期间,保留含未提交样本的序列,包括追加器重叠的情况。#19470
  • [缺陷修复] TSDB:合成起始时间戳零样本被拒绝后,不再保留 head 序列。#19470
  • [缺陷修复] TSDB:防止 WAL 重放后序列淘汰期间的查询 panic。#19664
  • [缺陷修复] TSDB:修复 mmapSeriesChunks 与 gcSeries 之间潜在的死锁。#19460
  • [缺陷修复] TSDB:修复自定义选项下的默认 block 重载间隔。#19368
  • [缺陷修复] AWS SD:在无服务器 MSK 集群或未启用 Open Monitoring 的 MSK 集群上不再崩溃。#19194
  • [缺陷修复] AWS SD:当 ElastiCache API 省略无服务器缓存或缓存集群的可选字段时不再 panic。#19435
  • [缺陷修复] AWS SD:拒绝非正数 request_concurrency,而不是让服务发现无限期挂起。#19524
  • [缺陷修复] Discovery/AWS:在发现带有自定义任务组的独立 ECS 任务时避免 panic。#19302
  • [缺陷修复] Discovery:当 AWS Lightsail 服务发现中的实例缺少可用区、蓝图、套餐、名称、状态或支持代码等可选字段时不再 panic。#19324
  • [缺陷修复] Discovery:在配置重载被移除时,删除过期的 prometheus_sd_last_update_timestamp_seconds 序列。#19131
  • [缺陷修复] HTTP:当处理程序设置 Content-Length 时,避免截断压缩响应。#19661
  • [缺陷修复] IONOS SD:当 API 响应省略服务器、NIC 或卷集合,或省略某服务器的属性时不再 panic。#19438
  • [缺陷修复] 元数据不再影响 Remote Write v2 分片的数量。#19218
  • [缺陷修复] Mixin:修复导致 PrometheusHAGroupNotIngestingSamples 和 PrometheusHAGroupCrashlooping 无法触发的标签不匹配问题。#19444
  • [缺陷修复] 原生直方图:DetectReset 不再遗漏空桶之后有值桶消失时的计数器重置,此前该问题可能使直方图 rate()/increase() 计算偏低。#19367
  • [缺陷修复] histogram_stddev 和 histogram_stdvar 函数不再跳过任何直方图桶。#19521
  • [缺陷修复] OTLP:如果某个指标没有数据点,不再中止整个 OTLP 负载的摄取。#19343
  • [缺陷修复] PromQL:修复当捕获组直接与字面量相邻时(例如 .*\|(foo)\|.*)FastRegexMatcher 误报匹配的问题。#19516
  • [缺陷修复] PromQL:修复当所选序列在查询窗口内没有样本时(例如在抓取间隙内评估的查询),使用实验性 anchored 或 smoothed 修饰符的范围选择器出现 panic 的问题。#19431
  • [缺陷修复] PromQL:修复当带 @ 的子查询作为非 step-invariant 函数的矩阵参数时返回空结果的问题(例如 quantile_over_time(scalar(x), metric[...:...] @ T))。#19187
  • [缺陷修复] PromQL:通过对两个重复标签排序,使 “found duplicate series for the match group” 多对多匹配错误消息具有确定性。#18810
  • [缺陷修复] PromQL:在 Expr.String() 往返转换中保留持续时间字面量周围的括号。#19403
  • [缺陷修复] PromQL:拒绝范围选择器之前的持续时间表达式 offset 以及 @ start() / @ end(),与现有的对字面量 offset 和 @ <timestamp> 的拒绝保持一致。#19406
  • [缺陷修复] PromQL:在 histogram_quantile 和 histogram_fraction 的原生直方图 NaN 观测注释中,报告直方图参数的位置而非标量参数的位置。#19330
  • [缺陷修复] PromQL:info() 现在在评估 info 序列时应用 @ 修饰符/offset,因此 info(v @ T) 会一致地按 T 时刻进行丰富,而不再取决于查询的开始/评估时间。#19266
  • [缺陷修复] Rules:修复未创建 logger 的规则管理器在加载包含多个 YAML 文档的规则文件时出现 panic 的问题。#19433
  • [缺陷修复] Scrape:当存储为仍暴露的序列返回新的序列引用时,不再为该序列追加过期标记。#19328
  • [缺陷修复] Scrape:JSON 日志格式化器正确格式化抓取目标 info。#19472
  • [缺陷修复] TSDB:通过将 head 块 ID 对 2^23 取模,修复有序块 ID 溢出问题,使其永不与乱序标志位冲突。#19450
  • [缺陷修复] TSDB:通过将 firstOOOChunkID 对 2^23 取模而非无限增长,修复乱序块 ID 溢出问题。#19216
  • [缺陷修复] UI:在使用 “linear” 显示模式时,移除原生直方图图表中多余的 X 轴刻度线。#19326
  • [缺陷修复] discovery/aws:当 ElastiCache ARN 缺少其资源 ID 时避免 panic。#19333
  • [缺陷修复] discovery/aws:在可选 API 字段缺失的 MSK 集群上不再 panic。#19584
  • [缺陷修复] discovery/aws:当 EC2 API 省略可选实例字段时不再 panic。#19512
  • [缺陷修复] discovery/aws:在缺少可选字段的 ECS 任务上不再 panic。#19396
  • [缺陷修复] discovery/aws:MSK 可选自定义配置字段 #19422。#19422
  • [缺陷修复] discovery/ionos:修复 IONOS API 省略可选服务器字段时的 panic。#19418
  • [缺陷修复] discovery/kubernetes:从 status.loadBalancer.ingress 填充 __meta_kubernetes_service_loadbalancer_ip,并回退到已弃用的 spec.loadBalancerIP。#19404
  • [缺陷修复] histogram:修复当同一次合并中合并多个 span 时,Compact 将桶移动到错误索引并为整数直方图产生负桶计数的问题。#19312
  • [缺陷修复] promtool:修复 tsdb dump 静默丢弃原生直方图样本的问题。#18051
  • [缺陷修复] scrape:修复 Manager.TargetsDroppedCounts 中的数据竞争,避免丢弃目标计数错误。#19304
  • [缺陷修复] scrape:修复原生直方图和经典直方图混合在同一指标族中时的空直方图问题。#19452
  • [缺陷修复] TSDB:修复 WAL 和 GC 日志消息,输出人类可读的时长字符串而非纳秒整数。#19307
  • [缺陷修复] TSDB:避免 Agent 模式下 WAL 写入失败后损坏 WAL。#19700
  • [缺陷修复] Agent:忽略未知的 WAL 记录类型,以方便用户回滚。#19814

更新内容 (原始)

  • [CHANGE] PromQL: A range query whose end was not aligned to step caused subqueries inside it to evaluate past the parent’s last actual step, inflating peakSamples in the query stats and against the query.max-samples limit, and wasting storage I/O reading samples that were never used in the result. Add tests to prevent regression of the fix made in #18081. #18598
  • [CHANGE] PromQL: Do not register a start timestamp reset if the start timestamp hasn’t changed between subsequent samples. #19454
  • [CHANGE] Logging: Deprecate --log.level; use runtime.log_level configuration to supply the default level. #19511
  • [FEATURE] Configuration: Allow changing the process log level through runtime.log_level on configuration reload. #19511
  • [FEATURE] Prometheus: Add --auto-gomemlimit.refresh-interval flag to periodically re-detect the container or system memory limit and update GOMEMLIMIT at runtime. #18843
  • [FEATURE] Scraping: Add support for scraping targets via Unix Domain Sockets. #12024. #18091
  • [FEATURE] scrape: Implement OM2.0 scrape format. #18606
  • [ENHANCEMENT] Reduce TSDB head CPU utilization when initializing. #18001
  • [ENHANCEMENT] Docker SD: Add labels __meta_docker_container_image and __meta_docker_container_image_id. #19386
  • [ENHANCEMENT] Mixin: Add a p95/p99 remote-write send-batch latency panel to the remote-write dashboard. #19500
  • [ENHANCEMENT] Mixin: Support native histograms in the remote-write send-batch latency panel. #19522
  • [ENHANCEMENT] PromQL/TSDB: The --enable-feature=st-storage flag now automatically enables XOR2 float chunk encoding and ST-capable histogram chunk encoding, so you no longer need to pass xor2-encoding and histograms-st-encoding alongside it. #19518
  • [ENHANCEMENT] Remote write / Alertmanager: upgrade sigv4 to v0.5.0, adding session_name and tags fields for STS AssumeRole sessions. The previously undocumented service_name field is now also documented. #19569
  • [ENHANCEMENT] Scraping: Support zstd-compressed scrape responses, enabled via feature flag zstd-scrape. #19502
  • [ENHANCEMENT] TSDB: Stabilize the XOR2 float chunk encoding. --enable-feature=xor2-encoding is deprecated; use storage.tsdb.chunk_encoding.floats: xor2 instead. Check that other software reading the TSDB directly (e.g. Thanos sidecar) supports XOR2 before enabling. #19461
  • [ENHANCEMENT] TSDB: add prometheus_tsdb_head_appenders_created_total metric. #19411
  • [ENHANCEMENT] Tracing: add more spans to scrapes, API queries and rule evaluations. #19410
  • [ENHANCEMENT] UI: Show the effective configuration for each scrape pool on the Targets and Service Discovery pages. #19384
  • [ENHANCEMENT] scrape: Enable start time synthesis for summary _count and _sum series in scrape appender v2. #19323
  • [ENHANCEMENT] scrape: stop all pools in parallel for faster shutdowns. #19295
  • [ENHANCEMENT] storage/remote: Add undocumented failed_request_logging config field to debug log remote write V2 requests on send errors. #19249
  • [ENHANCEMENT] TSDB: Add fast path for XOR chunk decompression to speed up queries. #18049
  • [ENHANCEMENT] UI: Improve native histogram table formatting and add a background bar indicating the bucket count. #19332
  • [ENHANCEMENT] TSDB: Add prometheus_tsdb_head_series_pending_commit_underflow_total to report pending-sample reservation underflows. #19470
  • [PERF] AWS SD: Build RDS cluster labels once per cluster instead of once per instance. #19504
  • [PERF] AWS SD: Describe RDS instances of different clusters concurrently, bounded by request_concurrency. #19506
  • [PERF] AWS SD: Describe each ElastiCache resource once per refresh instead of twice. #19585
  • [PERF] Remote read: Avoid cloning labels for sampled reads when no external labels are configured. #19503
  • [PERF] Remote write: Reuse OTLP converter scratch state between requests. #19388
  • [PERF] scrape: conversion from classic to native histograms should only parse start times when enabled. #19446
  • [BUGFIX] PromQL: Fix info() enrichment for composite expressions with mixed @/offset references or selector-free vector branches, preventing metadata from being evaluated at an unrelated timestamp. #19387
  • [BUGFIX] PromQL: Fix info() enrichment when input series use different subsets of identifying labels. #19557
  • [BUGFIX] PromQL: Preserve metric-name dropping through the info function when delayed name removal is enabled. #19413
  • [BUGFIX] TSDB: Don’t silently drop samples when head garbage collection removes a series while it is being appended to. #19272
  • [BUGFIX] TSDB: Keep series with uncommitted samples during selected- and stale-series compaction, including when appenders overlap. #19470
  • [BUGFIX] TSDB: Do not retain head series after a synthetic start-timestamp zero sample is rejected. #19470
  • [BUGFIX] TSDB: Prevent query panics during series eviction after WAL replay. #19664
  • [BUGFIX] TSDB: fix potential deadlock between mmapSeriesChunks and gcSeries. #19460
  • [BUGFIX] TSDB: fix default block reload interval for custom options. #19368
  • [BUGFIX] AWS SD: Do not crash on serverless MSK clusters or MSK clusters without Open Monitoring. #19194
  • [BUGFIX] AWS SD: Do not panic when the ElastiCache API omits optional fields of a serverless cache or cache cluster. #19435
  • [BUGFIX] AWS SD: Reject non-positive request_concurrency instead of hanging service discovery indefinitely. #19524
  • [BUGFIX] Discovery/AWS: Avoid a panic when discovering standalone ECS tasks with custom task groups. #19302
  • [BUGFIX] Discovery: Do not panic in AWS Lightsail service discovery when an instance is missing optional fields such as availability zone, blueprint, bundle, name, state or support code. #19324
  • [BUGFIX] Discovery: delete the stale prometheus_sd_last_update_timestamp_seconds series for a config that is removed on reload. #19131
  • [BUGFIX] HTTP: Avoid truncating compressed responses when handlers set Content-Length. #19661
  • [BUGFIX] IONOS SD: Do not panic when the API response omits the server, NIC or volume collections, or a server’s properties. #19438
  • [BUGFIX] Metadata will not affect the number of Remote Write v2 shards. #19218
  • [BUGFIX] Mixins: Fix label mismatches that prevented PrometheusHAGroupNotIngestingSamples and PrometheusHAGroupCrashlooping from firing. #19444
  • [BUGFIX] Native histograms: DetectReset no longer misses a counter reset when a populated bucket behind an empty one disappears, which could make histogram rate()/increase() undercount. #19367
  • [BUGFIX] Never skip histogram buckets for histogram_stddev and histogram_stdvar functions. #19521
  • [BUGFIX] OTLP: Do not abort an entire OTLP payload ingestion if one metric has no datapoints. #19343
  • [BUGFIX] PromQL: Fix FastRegexMatcher false-positive match when a capturing group is directly adjacent to a literal (e.g. .*\|(foo)\|.*). #19516
  • [BUGFIX] PromQL: Fix a panic in range selectors using the experimental anchored or smoothed modifier when the selected series has no samples inside the query window, for example a query evaluated inside a scrape gap. #19431
  • [BUGFIX] PromQL: Fix empty results when a subquery with @ is used as the matrix argument of a call that is not step-invariant (for example quantile_over_time(scalar(x), metric[...:...] @ T)). #19187
  • [BUGFIX] PromQL: Make the “found duplicate series for the match group” many-to-many matching error message deterministic by sorting the two duplicate labels. #18810
  • [BUGFIX] PromQL: Preserve parentheses around duration literals on Expr.String() round-trip. #19403
  • [BUGFIX] PromQL: Reject duration-expression offsets and @ start() / @ end() before range selectors, matching the existing rejection of literal offsets and @ <timestamp>. #19406
  • [BUGFIX] PromQL: Report the position of the histogram argument rather than of a scalar argument in the native histogram NaN observation annotations of histogram_quantile and histogram_fraction. #19330
  • [BUGFIX] PromQL: info() now applies the @ modifier/offset when evaluating the info series, so info(v @ T) enriches as of T consistently instead of depending on the query start/eval time. #19266
  • [BUGFIX] Rules: Fix a panic when a rule manager created without a logger loads a rule file containing multiple YAML documents. #19433
  • [BUGFIX] Scrape: Do not append a stale marker for a series that is still exposed when the storage returns a new series reference for it. #19328
  • [BUGFIX] Scrape: JSON log formatter correctly format scrape target info. #19472
  • [BUGFIX] TSDB: Fix in-order chunk ID overflow by wrapping head chunk IDs modulo 2^23 so they never collide with the out-of-order flag bit. #19450
  • [BUGFIX] TSDB: Fix out-of-order chunk ID overflow by wrapping firstOOOChunkID modulo 2^23 instead of growing unbounded. #19216
  • [BUGFIX] UI: Remove an extraneous X-axis tick mark in the native histogram chart when using the “linear” display mode. #19326
  • [BUGFIX] discovery/aws: Avoid a panic when an ElastiCache ARN is missing its resource ID. #19333
  • [BUGFIX] discovery/aws: Do not panic on MSK clusters whose optional API fields are absent. #19584
  • [BUGFIX] discovery/aws: Do not panic when the EC2 API omits optional instance fields. #19512
  • [BUGFIX] discovery/aws: Don’t panic on ECS tasks with absent optional fields. #19396
  • [BUGFIX] discovery/aws: MSK Optional Custom Configuration Fields #19422. #19422
  • [BUGFIX] discovery/ionos: Fix panic when the IONOS API omits optional server fields. #19418
  • [BUGFIX] discovery/kubernetes: Populate __meta_kubernetes_service_loadbalancer_ip from status.loadBalancer.ingress, falling back to deprecated spec.loadBalancerIP. #19404
  • [BUGFIX] histogram: Fix Compact moving buckets to wrong indices, and producing negative bucket counts for integer histograms, when more than one span is merged in the same pass. #19312
  • [BUGFIX] promtool: Fixed tsdb dump silently dropping native histogram samples. #18051
  • [BUGFIX] scrape: fix data race in Manager.TargetsDroppedCounts to avoid miscounting dropped targets. #19304
  • [BUGFIX] scrape: fix nil histogram when native and classic histograms are mixed in one metric family. #19452
  • [BUGFIX] TSDB: Fix WAL and GC log messages to emit human-readable duration strings instead of nanosecond integers. #19307
  • [BUGFIX] TSDB: Avoid WAL corruption after a failed WAL write in Agent mode. #19700
  • [BUGFIX] Agent: Ignore unknown WAL record types, to help users rolling back. #19814

下载链接