发布日期: 2026-03-30
版本号: v3.11.0-rc.0

本次 Prometheus 更新包含多项重要变更:Hetzner SD 的 __meta_hetzner_datacenter 标签已弃用,Robot 角色需改用 __meta_hetzner_robot_datacenter,Hcloud 角色的相应标签也将在 2026 年 7 月后停止工作。Promtool 的调试输出现重定向至 stderr。新增功能包括 AWS SD 的 Elasticache 与 RDS 角色、Azure SD 的 Workload Identity 认证支持,以及用于跟踪服务发现更新的 prometheus_sd_last_update_timestamp_seconds 指标。Kubernetes SD 增强了 Pod 角色的选择器支持,并引入了与 Deployment、CronJob 和 Job 相关的 Pod 标签。PromQL 新增了用于原生直方图修剪的 </>/ 操作符,以及支持多分位数计算的实验性函数。TSDB 添加了基于百分比的数据保留配置,并引入了实验性 st-storagexor2-encoding 功能标志。性能方面优化了 PromQL 的连接操作与直方图聚合,改进了远程写入的 WAL 观察与 TSDB 标签值交集效率。多项错误得到修复,涉及 AWS SD、Agent 内存泄漏、告警状态恢复、Kubernetes SD 目标重复、OTLP 示例混合、PromQL 直方图查询、远程写入时长测量以及 UI 显示问题等。

更新内容 (中文)

  • [变更] Hetzner SD: __meta_hetzner_datacenter 标签在 robot 角色中已弃用,为保持向后兼容而保留,请改用 __meta_hetzner_robot_datacenter 标签。对于 hcloud 角色,该标签已弃用,将在2026年7月1日后停止工作。 #17850
  • [变更] Hetzner SD: __meta_hetzner_hcloud_datacenter_location__meta_hetzner_hcloud_datacenter_location_network_zone 标签已弃用,请改用 __meta_hetzner_hcloud_location__meta_hetzner_hcloud_location_network_zone 标签。 #17850
  • [变更] Promtool: 将调试输出重定向到 stderr,以避免干扰基于 stdout 的工具输出。 #18346
  • [功能] AWS SD: 新增 Elasticache 角色。 #18099
  • [功能] AWS SD: 新增 RDS 角色。 #18206
  • [功能] Azure SD: 新增对 Azure 工作负载身份验证方法的支持。 #17207
  • [功能] 发现机制: 引入 prometheus_sd_last_update_timestamp_seconds 指标,用于跟踪最后一次向消费者发送服务发现更新的时间。 #18194
  • [功能] Kubernetes SD: 新增对 Pod 角色的节点角色选择器支持。 #18006
  • [功能] Kubernetes SD: 引入基于 Pod 的标签,用于 deployment、cronjob 和 job 控制器名称,分别为 __meta_kubernetes_pod_deployment_name__meta_kubernetes_pod_cronjob_name__meta_kubernetes_pod_job_name。 #17774
  • [功能] PromQL: 新增 </>/ 操作符,用于从原生直方图中修剪观测值。 #17904
  • [功能] PromQL: 新增实验性 histogram_quantiles 可变函数,用于一次计算多个分位数。 #17285
  • [功能] TSDB: 新增 storage.tsdb.retention.percentage 配置项,用于设置 TSDB 存储可用的最大磁盘百分比。 #18080
  • [功能] TSDB: 新增实验性 st-storage 功能标志。启用后,Prometheus 会将从抓取或 OTLP 接收的起始时间戳(ST,先前称为创建时间戳)存储在 TSDB 和 Agent WAL 中,并通过 Remote Write 2 暴露它们。 #18062
  • [功能] TSDB: 新增实验性 xor2-encoding 功能标志,用于一种新的 TSDB 块浮点样本块编码,该编码针对抓取数据进行了优化,并允许编码起始时间戳。 #18062
  • [增强] HTTP 客户端: 新增对 AWS sigv4 的 external_id 支持。 #17916
  • [增强] Kubernetes SD: 去重 Kubernetes API 的弃用警告日志以减少噪音。 #17829
  • [增强] TSDB: 创建检查点时移除旧的临时检查点。 #17598
  • [增强] UI: 为实验性 PromQL 函数 first_over_timets_of_first_over_time 添加自动补全支持。 #18318
  • [增强] Vultr SD: 将 govultr 库从 v2 升级到 v3,以持续获得安全补丁和维护。 #18347
  • [性能] PromQL: 提升连接(VectorBinop)/And/Or/Unless 的性能并减少堆分配。 #17159
  • [性能] PromQL: 部分解决因使用 KahanAdd 导致的原生直方图聚合性能回退问题。 #18252
  • [性能] 远程写入: 优化用于远程写入发送的 WAL 监控,以重用内部缓冲区。 #18250
  • [性能] TSDB: 优化匹配器的 LabelValues 交集性能。 #18069
  • [性能] UI: 在堆叠系列图中悬停时跳过重新堆叠。 #18230
  • [缺陷修复] AWS SD: 修复 EC2 SD 忽略已配置的 endpoint 选项的问题,这是 AWS SDK v2 迁移导致的回归问题。 #18133
  • [缺陷修复] AWS SD: 修复当 DescribeAvailabilityZones 返回 nil ZoneName 或 ZoneId 时,EC2 SD 发生 panic 的问题。 #18133
  • [缺陷修复] Agent: 修复因重复的 SeriesRefs 被加载为活动系列而导致的内存泄漏问题。 #17538
  • [缺陷修复] 告警: 修复在配置文件中增加 FOR 持续时间后,告警状态错误重置为 pending 的问题。 #18244
  • [缺陷修复] Azure SD: 修复当 client_id 为空时,系统分配的托管标识无法工作的问题。 #18323
  • [缺陷修复] Consul SD: 修复过滤器参数未应用于健康服务端点,导致 Node 和 Node.Meta 过滤器被忽略的问题。 #17349
  • [缺陷修复] Kubernetes SD: 修复由 *DualStack EndpointSlices 策略生成的重复目标问题。 #18192
  • [缺陷修复] OTLP: 修复在 PRW v2 直方图写入路径中,ErrTooOldSample 作为 HTTP 500 而非 400 返回的问题,防止客户端进入无限重试循环。 #18084
  • [缺陷修复] OTLP: 修复示例在直方图不正确部分之间混淆的问题。 #18056
  • [缺陷修复] PromQL: 修复在使用直方图修剪的查询中跳过直方图桶的问题。 #18263
  • [缺陷修复] 远程写入: 修复 prometheus_remote_storage_sent_batch_duration_seconds 在请求发送前进行测量的问题。 #18214
  • [缺陷修复] 规则: 修复当规则标签包含 Go 模板表达式时,告警状态恢复错误的问题。 #18375
  • [缺陷修复] 抓取: 修复在仅有花括号的度量表示法中解析无等号裸标签名时发生 panic 的问题。 #18229
  • [缺陷修复] TSDB: 在不支持的环境下设置 use-uncached-io 功能标志时,提前失败。 #18219
  • [缺陷修复] TSDB: 当配置文件中移除保留设置时,回退到 CLI 标志值。 #18200
  • [缺陷修复] TSDB: 通过在返回缓冲区到缓冲池之前清除引用字段,修复缓冲池中的内存泄漏。 #17895
  • [缺陷修复] TSDB: 修复 WAL 重放期间直方图块的 mmap 缺失问题。 #18306
  • [缺陷修复] TSDB: 修复 storage.tsdb.retention.time 文件中的单位不匹配问题,该问题导致保留时间比配置值长 1e6 倍。 #18200
  • [缺陷修复] 追踪: 修复启用追踪时查询日志中缺少 traceID 的问题,之前仅发出 spanID。 #18189
  • [缺陷修复] UI: 修复使用多个图表面板时,工具提示 Y 偏移漂移的问题。 #18228
  • [缺陷修复] UI: 当配置重新加载时,更新运行时信息中的保留设置显示。 #18200

更新内容 (原始)

  • [CHANGE] Hetzner SD: The __meta_hetzner_datacenter label is deprecated for the role robot but kept for backward compatibility, use the __meta_hetzner_robot_datacenter label instead. For the role hcloud, the label is deprecated and will stop working after the 1 July 2026. #17850
  • [CHANGE] Hetzner SD: The __meta_hetzner_hcloud_datacenter_location and __meta_hetzner_hcloud_datacenter_location_network_zone labels are deprecated, use the __meta_hetzner_hcloud_location and __meta_hetzner_hcloud_location_network_zone labels instead. #17850
  • [CHANGE] Promtool: Redirect debug output to stderr to avoid interfering with stdout-based tool output. #18346
  • [FEATURE] AWS SD: Add Elasticache Role. #18099
  • [FEATURE] AWS SD: Add RDS Role. #18206
  • [FEATURE] Azure SD: Add support for Azure Workload Identity authentication method. #17207
  • [FEATURE] Discovery: Introduce prometheus_sd_last_update_timestamp_seconds metric to track the last time a service discovery update was sent to consumers. #18194
  • [FEATURE] Kubernetes SD: Add support for node role selectors for pod roles. #18006
  • [FEATURE] Kubernetes SD: Introduce pod-based labels for deployment, cronjob, and job controller names: __meta_kubernetes_pod_deployment_name, __meta_kubernetes_pod_cronjob_name and __meta_kubernetes_pod_job_name, respectively. #17774
  • [FEATURE] PromQL: Add </ and >/ operators for trimming observations from native histograms. #17904
  • [FEATURE] PromQL: Add experimental histogram_quantiles variadic function for computing multiple quantiles at once. #17285
  • [FEATURE] TSDB: Add storage.tsdb.retention.percentage configuration to configure the maximum percent of disk usable for TSDB storage. #18080
  • [FEATURE] TSDB: Add an experimental st-storage feature flag. When enabled, Prometheus stores ingested start timestamps (ST, previously called Created Timestamp) from scrape or OTLP in the TSDB and Agent WAL, and exposes them via Remote Write 2. #18062
  • [FEATURE] TSDB: Add an experimental xor2-encoding feature flag for the new TSDB block float sample chunk encoding that is optimized for scraped data and allows encoding start timestamps. #18062
  • [ENHANCEMENT] HTTP client: Add AWS external_id support for sigv4. #17916
  • [ENHANCEMENT] Kubernetes SD: Deduplicate deprecation warning logs from the Kubernetes API to reduce noise. #17829
  • [ENHANCEMENT] TSDB: Remove old temporary checkpoints when creating a Checkpoint. #17598
  • [ENHANCEMENT] UI: Add autocomplete support for experimental first_over_time and ts_of_first_over_time PromQL functions. #18318
  • [ENHANCEMENT] Vultr SD: Upgrade govultr library from v2 to v3 for continued security patches and maintenance. #18347
  • [PERF] PromQL: Improve performance and reduce heap allocations in joins (VectorBinop)/And/Or/Unless. #17159
  • [PERF] PromQL: Partially address performance regression in native histogram aggregations due to using KahanAdd. #18252
  • [PERF] Remote write: Optimize WAL watching used for RW sending to reuse internal buffers. #18250
  • [PERF] TSDB: Optimize LabelValues intersection performance for matchers. #18069
  • [PERF] UI: Skip restacking on hover in stacked series charts. #18230
  • [BUGFIX] AWS SD: Fix EC2 SD ignoring the configured endpoint option, a regression from the AWS SDK v2 migration. #18133
  • [BUGFIX] AWS SD: Fix panic in EC2 SD when DescribeAvailabilityZones returns nil ZoneName or ZoneId. #18133
  • [BUGFIX] Agent: Fix memory leak caused by duplicate SeriesRefs being loaded as active series. #17538
  • [BUGFIX] Alerting: Fix alert state incorrectly resetting to pending when the FOR period is increased in the config file. #18244
  • [BUGFIX] Azure SD: Fix system-assigned managed identity not working when client_id is empty. #18323
  • [BUGFIX] Consul SD: Fix filter parameter not being applied to health service endpoint, causing Node and Node.Meta filters to be ignored. #17349
  • [BUGFIX] Kubernetes SD: Fix duplicate targets generated by *DualStack EndpointSlices policies. #18192
  • [BUGFIX] OTLP: Fix ErrTooOldSample being returned as HTTP 500 instead of 400 in PRW v2 histogram write paths, preventing infinite client retry loops. #18084
  • [BUGFIX] OTLP: Fix exemplars getting mixed between incorrect parts of a histogram. #18056
  • [BUGFIX] PromQL: Do not skip histogram buckets in queries where histogram trimming is used. #18263
  • [BUGFIX] Remote write: Fix prometheus_remote_storage_sent_batch_duration_seconds measuring before the request was sent. #18214
  • [BUGFIX] Rules: Fix alert state restoration when rule labels contain Go template expressions. #18375
  • [BUGFIX] Scrape: Fix panic when parsing bare label names without an equal sign in brace-only metric notation. #18229
  • [BUGFIX] TSDB: Fail early when use-uncached-io feature flag is set on unsupported environments. #18219
  • [BUGFIX] TSDB: Fall back to CLI flag values when retention is removed from config file. #18200
  • [BUGFIX] TSDB: Fix memory leaks in buffer pools by clearing reference fields before returning buffers to pools. #17895
  • [BUGFIX] TSDB: Fix missing mmap of histogram chunks during WAL replay. #18306
  • [BUGFIX] TSDB: Fix storage.tsdb.retention.time unit mismatch in file causing retention to be 1e6 times longer than configured. #18200
  • [BUGFIX] Tracing: Fix missing traceID in query log when tracing is enabled, previously only spanID was emitted. #18189
  • [BUGFIX] UI: Fix tooltip Y-offset drift when using multiple graph panels. #18228
  • [BUGFIX] UI: Update retention display in runtime info when config is reloaded. #18200

下载链接