发布日期: 2026-09-14
版本号: v3.15.0-rc.0

本次 Prometheus 更新主要包括:修复 PromQL 中查询结束时间未按步长对齐时,子查询会越过父查询实际最后一步执行的问题;同时修复 info() 函数的多处行为异常,涉及混合使用 @ 修饰符和 offset 的表达式、不同标识标签子集、延迟移除指标名,以及区间选择器配合 @ 修饰符时结果为空;还修复了使用 anchored 或 smoothed 修饰符时,窗口内没有样本导致的崩溃,以及 FastRegexMatcher 的误匹配。现在会拒绝 duration 表达式形式的 offset 与 @ start()、@ end(),重复序列匹配错误的提示改为按排序输出以保持一致,Expr.String() 会保留时长字面量的括号,直方图相关函数会报告正确的参数位置。原生直方图的 DetectReset 不再漏判计数器重置,histogram_stddev 和 histogram_stdvar 不再跳过桶,histogram_quantile 与 histogram_fraction 的 NaN 注解也得到修正。在 TSDB 方面,修复了头部垃圾回收导致样本被静默丢弃、序列压缩期间未提交样本被移除、拒绝合成起始时间零点样本后仍保留序列,以及 WAL 重放后序列驱逐和 mmapSeriesChunks 与 gcSeries 之间的死锁问题;同时修复了块重载默认间隔、乱序与顺序块 ID 溢出环绕、WAL 与 GC 日志时间格式,以及 promtool tsdb dump 丢弃原生直方图样本的问题。配置与运行时方面,新增 runtime.log_level 配置项,允许在配置重载时修改进程日志级别,并弃用 –log.level;新增 –auto-gomemlimit.refresh-interval 标志,支持周期性重新检测内存上限,并更新 GOMEMLIMIT;–enable-feature=st-storage 现在会自动启用 XOR2 浮点块编码和 ST 直方图块编码;XOR2 浮点块编码转正,旧的启用开关被弃用,改用 storage.tsdb.chunk_encoding.floats 配置。采集侧新增通过 Unix Domain Socket 采集目标,支持 OM2.0 采集格式,并通过 zstd-scrape 特性标志支持 zstd 压缩响应;还促进了采集应用器 v2 对 summary 系列启动时间的合成、多目标池并行关闭并修复了相关数据竞争与直方图混用时的空指针,同时修复了存储返回新序列引用时误加陈旧标记的问题。远程写与读取、告警方面,升级 sigv4 至 v0.5.0 并新增会话名与标签字段,修复元数据影响远程写 v2 分片数量的问题,抽样读取时避免克隆标签,OTLP 转换器复用临时状态,单个指标无数据点不再中止整个负载摄入。服务发现方面集中修复了 AWS、ECS、MSK、ElastiCache、Lightsail、IONOS 与 Kubernetes 等多个场景下因可选字段缺失导致的崩溃,拒绝非正的请求并发数,RDS 标签按集群构建并并发描述实例,ElastiCache 每次刷新只描述一次,配置文件移除后清理陈旧的服务发现更新指标。其他改进包括:降低 TSDB 头部初始化时的 CPU 占用,为 XOR 块解压增加快速路径,新增头部追加器创建数与待提交预留下溢指标,为采集、API 查询和规则评估增加更多追踪跨度,在 Targets 与服务发现页面展示各采集池实际生效的配置,改进原生直方图表格格式并新增桶数量背景条,移除原生直方图图表在“线性”显示模式下多余的 X 轴刻度,修复压缩响应在处理器设置 Content-Length 时被截断的问题,修复规则管理器在多文档 YAML 文件且无日志器时的崩溃,修复 JSON 日志格式化器输出采集目标信息的问题,并修正 Mixin 中远程写发送批次延迟面板的标签不匹配问题。

更新内容 (中文)

  • [变更] 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 域套接字抓取目标的支持。#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 远程写入发送批次延迟面板。#19500
  • [增强] Mixin:远程写入发送批次延迟面板支持原生直方图。#19522
  • [增强] PromQL/TSDB:--enable-feature=st-storage 标志现在会自动启用 XOR2 浮点 chunk 编码和支持 ST 的直方图 chunk 编码,因此不再需要同时传入 xor2-encoding 和 histograms-st-encoding。#19518
  • [增强] 远程写入 / Alertmanager:将 sigv4 升级至 v0.5.0,为 STS AssumeRole 会话新增 session_name 和 tags 字段。此前未文档化的 service_name 字段现在也已文档化。#19569
  • [增强] 抓取:支持 zstd 压缩的抓取响应,通过特性标志 zstd-scrape 启用。#19502
  • [增强] TSDB:稳定 XOR2 浮点 chunk 编码。--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:在 scrape appender v2 中为 summary 的 _count 和 _sum 序列启用起始时间合成。#19323
  • [增强] scrape:并行停止所有抓取池,以加快关闭速度。#19295
  • [增强] storage/remote:新增未文档化的 failed_request_logging 配置字段,用于在发送出错时以 debug 级别记录远程写入 V2 请求。#19249
  • [增强] TSDB:为 XOR chunk 解压增加快速路径以加速查询。#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
  • [性能] 远程读取:当未配置外部标签时,避免为采样读取克隆标签。#19503
  • [性能] 远程写入:在请求之间复用 OTLP 转换器的临时状态。#19388
  • [性能] scrape:从经典直方图转换为原生直方图时,仅在启用时解析起始时间。#19446
  • [缺陷修复] PromQL:修复 info() 对具有混合 @/offset 引用或无选择器向量分支的复合表达式进行信息补充的问题,避免元数据在不相关的时间戳上被求值。#19387
  • [缺陷修复] PromQL:修复当输入序列使用不同标识标签子集时 info() 的信息补充问题。#19557
  • [缺陷修复] PromQL:在启用延迟名称移除时,保持通过 info 函数丢弃指标名称的行为。#19413
  • [缺陷修复] TSDB:当 head 垃圾回收在序列正被追加时移除该序列,不再静默丢弃样本。#19272
  • [缺陷修复] TSDB:在选中序列和过期序列压缩期间保留含未提交样本的序列,包括追加器发生重叠的情况。#19470
  • [缺陷修复] TSDB:在合成的起始时间戳零样本被拒绝后,不再保留 head 序列。#19470
  • [缺陷修复] TSDB:防止 WAL 重放后序列驱逐期间出现查询 panic。#19664
  • [缺陷修复] TSDB:修复 mmapSeriesChunks 与 gcSeries 之间可能出现的死锁。#19460
  • [缺陷修复] TSDB:修复自定义选项下默认块重载间隔的问题。#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:当实例缺少可用区、blueprint、bundle、名称、状态或支持代码等可选字段时,AWS Lightsail 服务发现不再 panic。#19324
  • [缺陷修复] Discovery:删除配置在重载时被移除后残留的 prometheus_sd_last_update_timestamp_seconds 序列。#19131
  • [缺陷修复] HTTP:避免在处理程序设置 Content-Length 时截断压缩响应。#19661
  • [缺陷修复] IONOS SD:当 API 响应省略服务器、NIC 或卷集合,或省略服务器属性时不再 panic。#19438
  • [缺陷修复] 元数据不再影响远程写入 v2 的分片数量。#19218
  • [缺陷修复] Mixins:修复标签不匹配导致 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:修复当带 @ 的子查询作为非步长不变调用的矩阵参数时(例如 quantile_over_time(scalar(x), metric[...:...] @ T))返回空结果的问题。#19187
  • [缺陷修复] PromQL:通过对两个重复标签排序,使“found duplicate series for the match group”多对多匹配错误消息具有确定性。#18810
  • [缺陷修复] PromQL:在 Expr.String() 往返中保留持续时间字面量两侧的括号。#19403
  • [缺陷修复] PromQL:在范围选择器之前拒绝持续时间表达式偏移量以及 @ start() / @ end(),与现有限制字面量偏移量和 @ <timestamp> 的行为保持一致。#19406
  • [缺陷修复] PromQL:在 histogram_quantile 和 histogram_fraction 的原生直方图 NaN 观测注解中,报告直方图参数的位置,而非标量参数的位置。#19330
  • [缺陷修复] PromQL:info() 现在在求值 info 序列时会应用 @ 修饰符/offset,因此 info(v @ T) 会一致地按 T 时刻进行信息补充,而不再依赖查询起始/求值时间。#19266
  • [缺陷修复] 规则:修复在未提供 logger 的情况下创建的规则管理器加载包含多个 YAML 文档的规则文件时发生 panic 的问题。#19433
  • [缺陷修复] 抓取:当存储为该序列返回新的序列引用时,不再为仍然暴露的序列追加过期标记。#19328
  • [缺陷修复] 抓取:JSON 日志格式化器正确格式化抓取目标信息。#19472
  • [缺陷修复] TSDB:通过对 head chunk ID 按 2^23 取模回绕,修复顺序 chunk ID 溢出,使其永远不会与乱序标志位冲突。#19450
  • [缺陷修复] TSDB:通过对 firstOOOChunkID 按 2^23 取模回绕而非无限增长,修复乱序 chunk ID 溢出。#19216
  • [缺陷修复] UI:修复在使用“linear”显示模式时原生直方图图表中出现多余 X 轴刻度线的问题。#19326
  • [缺陷修复] discovery/aws:当 ElastiCache ARN 缺少其资源 ID 时避免 panic。#19333
  • [缺陷修复] discovery/aws:当 MSK 集群缺少可选 API 字段时不再 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:修复当同一指标族中混合原生直方图和经典直方图时出现 nil 直方图的问题。#19452
  • [缺陷修复] TSDB:修复 WAL 和 GC 日志消息,使其输出人类可读的持续时间字符串,而非纳秒整数。#19307

更新内容 (原始)

  • [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

下载链接