发布日期: 2026-02-26
版本号: v3.10.0

Prometheus 现新增了 Distroless 变体 Docker 镜像,该镜像基于最小化基础镜像,使用 UID/GID 65532(非 root),并移除了 VOLUME 声明,以提供更强的安全性。默认镜像仍为 busybox 版本(标签不带后缀)以保持向后兼容,而 Distroless 版本则使用 -distroless 后缀标签。从默认镜像迁移有状态数据卷至 Distroless 版本时,可能需要调整卷的权限(例如使用 chown 命令)。此次更新还包含了多项功能新增与增强,例如在告警指标中添加 alertmanager 维度、为 PromQL 增加 fill() 系列修饰符、提供 HTTP API 的 OpenAPI 规范,以及为 AWS 服务发现添加 MSK 角色支持。此外,版本在查询性能、正则匹配、OTLP 转换和 API 计算等方面进行了优化,并修复了一系列涉及 PromQL 查询、时序数据库(TSDB)存储、用户界面和 OTLP 数据处理的 bug。

更新内容 (中文)

Prometheus 现在除默认的 busybox 镜像外,还提供了 distroless Docker 镜像变体。distroless 变体使用最小基础镜像以增强安全性,采用 UID/GID 65532(非 root 用户)替代 nobody,并移除了 VOLUME 声明。两种变体分别通过 -busybox-distroless 标签后缀提供(例如 prom/prometheus:latest-busyboxprom/prometheus:latest-distroless)。为保持向后兼容性,busybox 镜像仍作为默认选项(无后缀,例如 prom/prometheus:latest 指向 busybox 变体)。

从 busybox 镜像迁移现有命名卷至 distroless 变体的用户,可通过以下命令调整所有权:

docker run --rm -v prometheus-data:/prometheus alpine chown -R 65532:65532 /prometheus

随后可使用旧卷启动容器:

docker run -v prometheus-data:/prometheus prom/prometheus:latest-distroless

从挂载目录迁移的用户可能也需要根据配置调整权限。

  • [CHANGE] 告警:为以下指标添加 alertmanager 维度:prometheus_notifications_dropped_totalprometheus_notifications_queue_capacityprometheus_notifications_queue_length。#16355
  • [CHANGE] UI:默认隐藏展开的告警注释,以在 /alerts 页面上实现更高的信息密度。#17611
  • [FEATURE] AWS 服务发现:添加 MSK 角色。#17600
  • [FEATURE] PromQL:添加 fill() / fill_left() / fill_right() 二元操作修饰符,用于为缺失序列指定默认值。#17644
  • [FEATURE] Web:在 /api/v1/openapi.yaml 为 HTTP API 添加 OpenAPI 3.2 规范。#17825
  • [FEATURE] Dockerfile:添加使用 UID/GID 65532 且无 VOLUME 声明的 distroless 镜像变体。Busybox 镜像仍为默认。#17876
  • [FEATURE] Web:在 <URL>/debug/pprof/fgprof 添加按需墙时间性能分析。#18027
  • [ENHANCEMENT] PromQL:为直方图分位数单调性信息注释添加更多细节。#15578
  • [ENHANCEMENT] 告警:独立的 alertmanager 发送循环。#16355
  • [ENHANCEMENT] TSDB:实验性支持在内存中提前压缩过期序列,可在配置文件中设置可配置阈值 stale_series_compaction_threshold。#16929
  • [ENHANCEMENT] 服务发现:现在可通过 Go 构建标签 remove_all_sd 从 Prometheus 二进制文件中移除服务发现,并可通过构建标签 enable_<sd name>_sd 重新添加各个服务发现。用户可以构建仅包含必要服务发现的自定义 Prometheus,以减小二进制文件大小。#17736
  • [ENHANCEMENT] Promtool:支持 PromQL 语法特性 promql-duration-exprpromql-extended-range-selectors。#17926
  • [PERF] PromQL:避免在 PromQL 函数中进行不必要的标签提取。#17676
  • [PERF] PromQL:改进正则表达式匹配器(如 .*-.*-.*)的性能。#17707
  • [PERF] OTLP:为 OTLP 到 Prometheus 的转换添加标签缓存,以减少分配并改善延迟。#17860
  • [PERF] API:单次遍历计算 /api/v1/targets/relabel_steps,而非为每个前缀重新运行重标签。#17969
  • [PERF] tsdb:优化匹配器的 LabelValues 交集性能。#18069
  • [BUGFIX] PromQL:防止仅包含 UTF-8 续字节的查询字符串导致 Prometheus 崩溃。#17735
  • [BUGFIX] Web:修复 /-/ready 端点在 NotReady 状态下缺少 X-Prometheus-Stopping 头的问题。#17795
  • [BUGFIX] PromQL:修复 PromQL info() 函数在通过同时存在于输入指标和 target_info 上的标签进行过滤时返回空结果的问题。#17817
  • [BUGFIX] TSDB:修复示例缓冲区扩缩容期间可能导致示例被错误丢弃的缺陷。#17863
  • [BUGFIX] UI:修复因 Y 轴最小值编码/解码错误导致页面重新加载后图表显示破损的问题。#17869
  • [BUGFIX] TSDB:通过在返回缓冲区到池之前清除引用字段(标签、直方图指针、元数据字符串)来修复缓冲池中的内存泄漏。#17879
  • [BUGFIX] PromQL:info 函数:修复缺少识别标签的序列未被返回的问题。#17898
  • [BUGFIX] OTLP:从 OTLP 属性中过滤 __name__ 以防止标签重复。#17917
  • [BUGFIX] TSDB:修复在空头部计算过期序列比例时的除零错误。#17952
  • [BUGFIX] OTLP:修复总和指标潜在的数据静默丢失问题。#17954
  • [BUGFIX] PromQL:修复跨计数器重置的平滑插值。#17988
  • [BUGFIX] PromQL:修复在空区间上使用 @ 修饰符导致的 panic。#18020
  • [BUGFIX] PromQL:修复单个原生直方图的 avg_over_time 计算。#18058

更新内容 (原始)

Prometheus now offers a distroless Docker image variant alongside the default busybox image. The distroless variant provides enhanced security with a minimal base image, uses UID/GID 65532 (nonroot) instead of nobody, and removes the VOLUME declaration. Both variants are available with -busybox and -distroless tag suffixes (e.g., prom/prometheus:latest-busybox, prom/prometheus:latest-distroless). The busybox image remains the default with no suffix for backwards compatibility (e.g., prom/prometheus:latest points to the busybox variant).

For users migrating existing named volumes from the busybox image to the distroless variant, the ownership can be adjusted with:

docker run --rm -v prometheus-data:/prometheus alpine chown -R 65532:65532 /prometheus

Then, the container can be started with the old volume with:

docker run -v prometheus-data:/prometheus prom/prometheus:latest-distroless

User migrating from bind mounts might need to ajust permissions too, depending on their setup.

  • [CHANGE] Alerting: Add alertmanager dimension to following metrics: prometheus_notifications_dropped_total, prometheus_notifications_queue_capacity, prometheus_notifications_queue_length. #16355
  • [CHANGE] UI: Hide expanded alert annotations by default, enabling more information density on the /alerts page. #17611
  • [FEATURE] AWS SD: Add MSK Role. #17600
  • [FEATURE] PromQL: Add fill() / fill_left() / fill_right() binop modifiers for specifying default values for missing series. #17644
  • [FEATURE] Web: Add OpenAPI 3.2 specification for the HTTP API at /api/v1/openapi.yaml. #17825
  • [FEATURE] Dockerfile: Add distroless image variant using UID/GID 65532 and no VOLUME declaration. Busybox image remains default. #17876
  • [FEATURE] Web: Add on-demand wall time profiling under <URL>/debug/pprof/fgprof. #18027
  • [ENHANCEMENT] PromQL: Add more detail to histogram quantile monotonicity info annotations. #15578
  • [ENHANCEMENT] Alerting: Independent alertmanager sendloops. #16355
  • [ENHANCEMENT] TSDB: Experimental support for early compaction of stale series in the memory with configurable threshold stale_series_compaction_threshold in the config file. #16929
  • [ENHANCEMENT] Service Discovery: Service discoveries are now removable from the Prometheus binary through the Go build tag remove_all_sd and individual service discoveries can be re-added with the build tags enable_<sd name>_sd. Users can build a custom Prometheus with only the necessary SDs for a smaller binary size. #17736
  • [ENHANCEMENT] Promtool: Support promql syntax features promql-duration-expr and promql-extended-range-selectors. #17926
  • [PERF] PromQL: Avoid unnecessary label extraction in PromQL functions. #17676
  • [PERF] PromQL: Improve performance of regex matchers like .*-.*-.*. #17707
  • [PERF] OTLP: Add label caching for OTLP-to-Prometheus conversion to reduce allocations and improve latency. #17860
  • [PERF] API: Compute /api/v1/targets/relabel_steps in a single pass instead of re-running relabeling for each prefix. #17969
  • [PERF] tsdb: Optimize LabelValues intersection performance for matchers. #18069
  • [BUGFIX] PromQL: Prevent query strings containing only UTF-8 continuation bytes from crashing Prometheus. #17735
  • [BUGFIX] Web: Fix missing X-Prometheus-Stopping header for /-/ready endpoint in NotReady state. #17795
  • [BUGFIX] PromQL: Fix PromQL info() function returning empty results when filtering by a label that exists on both the input metric and target_info. #17817
  • [BUGFIX] TSDB: Fix a bug during exemplar buffer grow/shrink that could cause exemplars to be incorrectly discarded. #17863
  • [BUGFIX] UI: Fix broken graph display after page reload, due to broken Y axis min encoding/decoding. #17869
  • [BUGFIX] TSDB: Fix memory leaks in buffer pools by clearing reference fields (Labels, Histogram pointers, metadata strings) before returning buffers to pools. #17879
  • [BUGFIX] PromQL: info function: fix series without identifying labels not being returned. #17898
  • [BUGFIX] OTLP: Filter __name__ from OTLP attributes to prevent duplicate labels. #17917
  • [BUGFIX] TSDB: Fix division by zero when computing stale series ratio with empty head. #17952
  • [BUGFIX] OTLP: Fix potential silent data loss for sum metrics. #17954
  • [BUGFIX] PromQL: Fix smoothed interpolation across counter resets. #17988
  • [BUGFIX] PromQL: Fix panic with @ modifier on empty ranges. #18020
  • [BUGFIX] PromQL: Fix avg_over_time for a single native histogram. #18058

下载链接