发布日期: 2025-06-30
版本号: v3.5.0-rc.0

Prometheus 3.5 是一个长期支持版本,主要更新包括多项新功能、性能改进和错误修复。新功能方面,PromQL 增加了实验性的类型和单位元数据标签以及新的时间函数;数据采集支持全局选项以采集经典直方图;OTLP 增强了元数据提升功能;并新增了 STACKIT Cloud 的服务发现。增强改进涵盖多个模块,例如 Hetzner 服务发现增加了过滤选项、UI 优化了显示和交互、以及规则解析的早期检查等。性能优化涉及 PromQL 迭代器重用、UI 渲染优化、Kubernetes 服务发现性能提升、TSDB 写入方式改进以及标签编码和采集池的并发处理。错误修复重点解决了 PromQL 中直方图函数、时间舍入、运算符优先级等问题,同时修复了 UI 显示、API 安全头、服务发现死锁、远程写入认证和采集内存损坏等多个方面的缺陷。

更新内容 (中文)

3.5将是一个长期支持(LTS)版本;请参阅发布说明 https://prometheus.io/docs/introduction/release-cycle/ 此版本包含多项新功能,且没有已知的破坏性变更。

变更内容

  • [功能] PromQL:添加实验性类型与单位元数据标签,需启用功能标志 type-and-unit-labels。#16228 #16632 #16718 #16743
  • [功能] PromQL:添加 ts_of_(min|max|last)_over_time 函数,需启用功能标志 experimental-promql-functions。#16722 #16733
  • [功能] Scraping:新增全局选项 always_scrape_classic_histograms,即使直方图以原生格式暴露时,也抓取其经典直方图数据。#16452
  • [功能] OTLP:支持通过 otlp.promote_scope_metadata 将 OTel 作用域名称/版本/架构URL/属性提升为指标标签。#16730 #16760
  • [功能] OTLP:新增配置选项 promote_all_resource_attributesignore_resource_attributes。#16426
  • [功能] Discovery:新增适用于 STACKIT Cloud 的服务发现。#16401
  • [改进] Hetzner SD:添加 label_selector 用于过滤服务器。#16512
  • [改进] PromQL:支持在聚合操作(如 quantiletopk)中使用非常量参数。#16404
  • [改进] UI:使用 keep_dropped_targets 选项时,改善目标总数的显示。#16604
  • [改进] UI:在 /rules 页面添加简单的过滤功能。#16605
  • [改进] UI:在表格查询标签页的悬停提示中显示查询统计信息。#16723
  • [改进] UI:清除 /targets 页面的搜索字段。#16567
  • [改进] Rules:在启动时更早地检查规则是否无错误解析。#16601
  • [改进] Promtool:在规则单元测试中,可选的模糊浮点数比较。#16395
  • [性能] PromQL:在可能的情况下重用 histogramStatsIterator。#16686
  • [性能] PromQL:为原生直方图的自定义桶值重用存储。#16565
  • [性能] UI:优化 /targets 页面的记忆化与搜索防抖。#16589
  • [性能] UI:修复打开状态导航菜单时的整页重渲染问题。#16590
  • [性能] Kubernetes SD:使用服务缓存索引器以实现更好的性能。#16365
  • [性能] TSDB:可选地为块写入使用直接IO。#15365
  • [性能] TSDB:获取标签值时,一旦达到限制即提前停止工作。#16158
  • [性能] Labels:更简单/更快的字符串标签编码。#16069
  • [性能] Scraping:并发重载抓取池。#16595 #16783
  • [错误修复] 顶层:在加载 TSDB 前更新 GOGC。#16491
  • [错误修复] 配置:若不存在 “runtime” 块,则遵循 GOGC 环境变量。#16558
  • [错误修复] PromQL:修复原生直方图的 last_over_time。#16744
  • [错误修复] PromQL:修复在 ParenExpr 包裹的聚合操作错误中报告的解析器位置范围。#16041 #16754
  • [错误修复] PromQL:当同一时间戳同时存在经典和原生直方图时,histogram_fractionhistogram_quantile 不应发出值。#16552
  • [错误修复] PromQL:将 [1001ms] 等错误地四舍五入为 [1s]。#16478
  • [错误修复] PromQL:修复 histogram_counthistogram_sum 不一致或有时为负的问题。#16682
  • [错误修复] PromQL:改善原生直方图中 NaN 的处理。#16724
  • [错误修复] PromQL:修复持续时间表达式中的一元运算符优先级。#16713
  • [错误修复] PromQL:提高 avg 聚合与 avg_over_time 的一致性。#16569 #16773
  • [错误修复] UI:在图形视图中添加查询警告和信息。#16753 #16759
  • [错误修复] API:在响应中添加 HTTP Vary: Origin 头,以避免缓存投毒。#16008
  • [错误修复] Discovery:通过以一致的顺序获取锁来避免死锁。#16587
  • [错误修复] Remote-write:对于 Azure AD 认证,允许空 client_id 以支持系统分配的托管标识。#16421
  • [错误修复] Scraping:修复罕见的内存损坏错误。#16623
  • [错误修复] Scraping:遇到指数直方图后,继续处理自定义桶直方图。#16720
  • [错误修复] OTLP:未设置 otlp: 块时,未遵循默认配置。#16693

更新内容 (原始)

3.5 will be a Long Term Support (LTS) release; see release https://prometheus.io/docs/introduction/release-cycle/ There are a number of new features, and no known breaking changes in this release.

What’s Changed

  • [FEATURE] PromQL: Add experimental type and unit metadata labels, behind feature flag type-and-unit-labels. #16228 #16632 #16718 #16743
  • [FEATURE] PromQL: Add ts_of_(min|max|last)_over_time, behind feature flag experimental-promql-functions. #16722 #16733
  • [FEATURE] Scraping: Add global option always_scrape_classic_histograms to scrape a classic histogram even if it is also exposed as native. #16452
  • [FEATURE] OTLP: Support promoting OTel scope name/version/schema URL/attributes as metric labels, via otlp.promote_scope_metadata. #16730 #16760
  • [FEATURE] OTLP: New config options promote_all_resource_attributes and ignore_resource_attributes. #16426
  • [FEATURE] Discovery: New service discovery for STACKIT Cloud. #16401
  • [ENHANCEMENT] Hetzner SD: Add label_selector to filter servers. #16512
  • [ENHANCEMENT] PromQL: support non-constant parameter in aggregations like quantile and topk. #16404
  • [ENHANCEMENT] UI: Better total target count display when using keep_dropped_targets option. #16604
  • [ENHANCEMENT] UI: Add simple filtering on the /rules page. #16605
  • [ENHANCEMENT] UI: Display query stats in hover tooltip over table query tab. #16723
  • [ENHANCEMENT] UI: Clear search field on /targets page. #16567
  • [ENHANCEMENT] Rules: Check that rules parse without error earlier at startup. #16601
  • [ENHANCEMENT] Promtool: Optional fuzzy float64 comparison in rules unittests. #16395
  • [PERF] PromQL: Reuse histogramStatsIterator where possible. #16686
  • [PERF] PromQL: Reuse storage for custom bucket values for native histograms. #16565
  • [PERF] UI: Optimize memoization and search debouncing on /targets page. #16589
  • [PERF] UI: Fix full-page re-rendering when opening status nav menu. #16590
  • [PERF] Kubernetes SD: use service cache.Indexer to achieve better performance. #16365
  • [PERF] TSDB: Optionally use Direct IO for chunks writing. #15365
  • [PERF] TSDB: When fetching label values, stop work earlier if the limit is reached. #16158
  • [PERF] Labels: Simpler/faster stringlabels encoding. #16069
  • [PERF] Scraping: Reload scrape pools concurrently. #16595 #16783
  • [BUGFIX] Top-level: Update GOGC before loading TSDB. #16491
  • [BUGFIX] Config: Respect GOGC environment variable if no “runtime” block exists. #16558
  • [BUGFIX] PromQL: Fix native histogram last_over_time. #16744
  • [BUGFIX] PromQL: Fix reported parser position range in errors for aggregations wrapped in ParenExpr #16041 #16754
  • [BUGFIX] PromQL: Don’t emit a value from histogram_fraction or histogram_quantile if classic and native histograms are present at the same timestamp. #16552
  • [BUGFIX] PromQL: Incorrect rounding of [1001ms] to [1s] and similar. #16478
  • [BUGFIX] PromQL: Fix inconsistent / sometimes negative histogram_count and histogram_sum. #16682
  • [BUGFIX] PromQL: Improve handling of NaNs in native histograms. #16724
  • [BUGFIX] PromQL: Fix unary operator precedence in duration expressions. #16713
  • [BUGFIX] PromQL: Improve consistency of avg aggregation and avg_over_time. #16569 #16773
  • [BUGFIX] UI: Add query warnings and info to graph view. #16753 #16759
  • [BUGFIX] API: Add HTTP Vary: Origin header to responses to avoid cache poisoning. #16008
  • [BUGFIX] Discovery: Avoid deadlocks by taking locks in consistent order. #16587
  • [BUGFIX] Remote-write: For Azure AD auth, allow empty client_id to suppport system assigned managed identity. #16421
  • [BUGFIX] Scraping: Fix rare memory corruption bug. #16623
  • [BUGFIX] Scraping: continue handling custom-bucket histograms after an exponential histogram is encountered. #16720
  • [BUGFIX] OTLP: Default config not respected when otlp: block is unset. #16693

下载链接