# Native Histogram 查询链路 & 实验中的服务依赖图｜Greptime 月度精选 - No. 87

Source: https://greptime.cn/blogs/2026-08-31-greptimedb-monthly-report

## 内容概述

*2026 年 8 月 · 2026-08-01 – 2026-08-31*

本月主要更新：

- Prometheus native histogram 现在可以端到端使用，从 PromQL 聚合到 Prometheus HTTP 响应。
- OTLP trace 可以直接查出一张服务依赖图，在查询时推导，目前仍是实验能力。
- 累积类型的 `OTLP` 指数直方图可以写入，需要显式开启。

8 月 21 日 GreptimeDB 发布了 [v1.2.0-beta.2](https://github.com/GreptimeTeam/greptimedb/releases/tag/v1.2.0-beta.2)，这是 v1.2 的第二个 beta 版本，主要内容包括 `ALTER TABLE` 单向修改 `skip_wal`、JSON2 的扩展类型与存储布局准备、procedure 与 admin 事件的可观测性，以及 Flow 运行时可观测性。升级前建议逐项确认两处 breaking change。一是软删除与表恢复重新收回企业版（[db#8747](https://github.com/GreptimeTeam/greptimedb/pull/8747)）：beta1 漏加了 enterprise gate，这两项功能才出现在开源版本中；OSS beta2 的 metasrv 启动时会拒绝 `gc.experimental_soft_drop.enable = true`，也无法恢复或清理在 beta1 中软删的表，需要的表请先恢复。二是 native histogram 的持久化字段改为有符号类型（[db#8824](https://github.com/GreptimeTeam/greptimedb/pull/8824)），没有迁移、降级和混版兼容路径。

## 贡献者

过去一个月，共有 **20 位贡献者**合并了 **166 个 PR**。其中 **8 位社区贡献者**贡献了 **10 个 PR**。
欢迎新贡献者：**[@xhwhis](https://github.com/xhwhis)**、**[@tian1220A](https://github.com/tian1220A)**、**[@dhruvxvaishnav](https://github.com/dhruvxvaishnav)**、**[@wy471x](https://github.com/wy471x)**、**[@fzlzjerry](https://github.com/fzlzjerry)**、**[@grezzko](https://github.com/grezzko)**！

感谢本月提交代码的社区贡献者：

- **[@xhwhis](https://github.com/xhwhis)** *[db#8722](https://github.com/GreptimeTeam/greptimedb/pull/8722)* *[db#8721](https://github.com/GreptimeTeam/greptimedb/pull/8721)*
- **[@lyang24](https://github.com/lyang24)** *[db#8767](https://github.com/GreptimeTeam/greptimedb/pull/8767)* *[db#8733](https://github.com/GreptimeTeam/greptimedb/pull/8733)*
- **[@onepizzateam](https://github.com/onepizzateam)** *[db#8392](https://github.com/GreptimeTeam/greptimedb/pull/8392)*
- **[@dhruvxvaishnav](https://github.com/dhruvxvaishnav)** *[db#8935](https://github.com/GreptimeTeam/greptimedb/pull/8935)*
- **[@tian1220A](https://github.com/tian1220A)** *[db#8960](https://github.com/GreptimeTeam/greptimedb/pull/8960)*
- **[@grezzko](https://github.com/grezzko)** *[db#8659](https://github.com/GreptimeTeam/greptimedb/pull/8659)*
- **[@fzlzjerry](https://github.com/fzlzjerry)** *[db#8859](https://github.com/GreptimeTeam/greptimedb/pull/8859)*
- **[@wy471x](https://github.com/wy471x)** *[db#8923](https://github.com/GreptimeTeam/greptimedb/pull/8923)*

## PR 亮点

### [db#8850](https://github.com/GreptimeTeam/greptimedb/pull/8850) feat(servers): expose native histograms over Prometheus HTTP

Prometheus native histogram 现在可以端到端使用：通过 remote write v2 或 OTLP 写入，用 PromQL 做聚合，再经 Prometheus HTTP API 读回，`/metadata`、label 发现和查询注解都已覆盖。相比 classic 的 `le` bucket，同样精度的延迟分布不再需要为每个 bucket 单独存一条时间线；迁移也不必一步到位，[db#8874](https://github.com/GreptimeTeam/greptimedb/pull/8874) 让 `histogram_quantile` 和 `histogram_fraction` 在一次扫描里同时处理 classic、native 和混合输入。

7 月报告里标为「仍在进行中」的六个 PR 系列本月收尾：样本类型语义（[db#8758](https://github.com/GreptimeTeam/greptimedb/pull/8758)）、写入侧校验（[db#8775](https://github.com/GreptimeTeam/greptimedb/pull/8775)）、float 与 histogram 样本混合的区间（[db#8784](https://github.com/GreptimeTeam/greptimedb/pull/8784)）、vector operators（[db#8798](https://github.com/GreptimeTeam/greptimedb/pull/8798)），以及 histogram 语义的 `sum`、`avg`、`count`、`group`、`count_values`（[db#8848](https://github.com/GreptimeTeam/greptimedb/pull/8848)）。如果已经在存 native histogram，有两处变化需要注意：持久化字段的符号性（[db#8824](https://github.com/GreptimeTeam/greptimedb/pull/8824)），以及配置位置移到了 `prom_store` 下（[db#8744](https://github.com/GreptimeTeam/greptimedb/pull/8744)）。

### [db#8614](https://github.com/GreptimeTeam/greptimedb/pull/8614) feat: read-time entity relationships graph over telemetry

写入 OTLP trace 之后，服务依赖图不用另外搭。用 SQL 查 `greptime_private.semantic_entities` 和 `greptime_private.semantic_relationships` 就能看到服务之间的调用关系，每条边上带 RED metrics。推导在查询时进行，并以调用方的身份执行：每张源表单独鉴权，取消和 deadline 也跟随调用方，推导窗口由查询里的 `observed_at` 过滤条件决定，不带过滤时取最近一小时（[db#8794](https://github.com/GreptimeTeam/greptimedb/pull/8794)）。遥测数据体现不出来的依赖关系可以手工写入 `greptime_private.semantic_relationships_declared`。

这套能力仍处于实验阶段：两张表放在 `greptime_private` 下，没有文档，输出 schema 也可能继续变。只有指标、没有 trace 的服务要进图，需要打开默认关闭的 `otlp.experimental_enable_resource_info`。本月其余 PR 扩展了图能识别的范围：新增派生边类型，以及 Prometheus、Kubernetes 和 `gen_ai` 属性的内置命名约定（[db#8836](https://github.com/GreptimeTeam/greptimedb/pull/8836)、[db#8854](https://github.com/GreptimeTeam/greptimedb/pull/8854)、[db#8880](https://github.com/GreptimeTeam/greptimedb/pull/8880)、[db#8797](https://github.com/GreptimeTeam/greptimedb/pull/8797)、[db#8904](https://github.com/GreptimeTeam/greptimedb/pull/8904)、[db#8936](https://github.com/GreptimeTeam/greptimedb/pull/8936)）。

### [db#8900](https://github.com/GreptimeTeam/greptimedb/pull/8900) feat(otlp): support cumulative exponential histograms

如果 OTel 链路产出的是指数直方图，现在不必先转成固定 bucket 再写入。打开 `otlp.experimental_enable_exponential_histogram`（默认关闭），累积类型的 `ExponentialHistogram` 会按普通 native histogram 存储：存储格式相同，PromQL 相同，也没有协议特有的查询路径。

仅支持 cumulative。scale `-4..=8` 直接映射，更高精度降采样到 8；delta temporality、min/max、exemplar 和 OTel Arrow 暂未覆盖。无法写入的数据点现在会明确上报，不再静默接收；同一个请求里部分合法部分非法时返回部分成功。

### [db#8768](https://github.com/GreptimeTeam/greptimedb/pull/8768) feat: add admin function to discard unflushed data

作为最后手段的恢复操作，现在可以丢弃一个 region 尚未 flush 的内存数据，而不损失已经落盘的部分。`ADMIN discard_unflushed_data(...)` 接受 region ID，也可以传表名以覆盖该表的所有 region，已持久化的 SST 文件全部保留。

引擎侧（[db#8600](https://github.com/GreptimeTeam/greptimedb/pull/8600)）会先推进并持久化 WAL 回放位点，再替换 memtable，因此重复调用是安全的，过期的 in-flight flush 也无法让已丢弃的数据重新可见。

### [db#8734](https://github.com/GreptimeTeam/greptimedb/pull/8734) feat(event): add event context to procedure events

`greptime_private.events` 现在会记录 DDL 的来源：每条提交的 procedure 事件带一个 JSONB 结构的 `EventContext`，可以区分请求来自 SQL、gRPC、Prometheus 还是 OTLP，也能区分 `auto_create`、`auto_alter` 这类自动 schema 演进路径。一张表是人改的还是写入时自动创建的，用 SQL 就能查出来。

事件的操作者和 admin 函数执行也一并记录（[db#8849](https://github.com/GreptimeTeam/greptimedb/pull/8849)、[db#8835](https://github.com/GreptimeTeam/greptimedb/pull/8835)、[db#8856](https://github.com/GreptimeTeam/greptimedb/pull/8856)、[db#8834](https://github.com/GreptimeTeam/greptimedb/pull/8834)），这张表可以直接当审计日志查。

### 其他更新

- `/v1/` HTTP 接口现在支持 `Authorization: Bearer <token>`。服务端把 token 当作不透明字符串，校验交给 `UserProvider`，JWT 和 OIDC 的策略保持在数据库之外（[db#8719](https://github.com/GreptimeTeam/greptimedb/pull/8719)）。
- `information_schema.flow_statistics` 和 `SHOW FLOW STATUS` 可以查看 Flow 的实际运行情况；分布式 Flow 下 `start_time` 和 `uptime_seconds` 仍为 `NULL`（[db#8392](https://github.com/GreptimeTeam/greptimedb/pull/8392)）。
- 一些小改动：新增函数 `uddsketch_rank`（[db#8929](https://github.com/GreptimeTeam/greptimedb/pull/8929)）和可合并的 `stddev_pop` 状态函数（[db#8972](https://github.com/GreptimeTeam/greptimedb/pull/8972)），`greptime standalone start --daemon` 支持在 Unix 上后台运行（[db#8960](https://github.com/GreptimeTeam/greptimedb/pull/8960)），以及 riscv64 交叉编译和对应的发布产物（[db#8820](https://github.com/GreptimeTeam/greptimedb/pull/8820)）。
- 引擎侧的改动继续推进：符合条件的稀疏 metric region 现在默认走两阶段 series 扫描，其他布局回退到原有路径，可以用 `experimental_series_scan_v2` 关掉（[db#8826](https://github.com/GreptimeTeam/greptimedb/pull/8826)、[db#8703](https://github.com/GreptimeTeam/greptimedb/pull/8703)、[db#8788](https://github.com/GreptimeTeam/greptimedb/pull/8788)、[db#8926](https://github.com/GreptimeTeam/greptimedb/pull/8926)）；JSON2 补上了按列的 DDL 选项、v2 物理布局原语和 v2 布局的查询支持，但 v2 还不是默认布局（[db#8745](https://github.com/GreptimeTeam/greptimedb/pull/8745)、[db#8833](https://github.com/GreptimeTeam/greptimedb/pull/8833)、[db#8895](https://github.com/GreptimeTeam/greptimedb/pull/8895)、[db#8901](https://github.com/GreptimeTeam/greptimedb/pull/8901)、[db#8940](https://github.com/GreptimeTeam/greptimedb/pull/8940)、[db#8964](https://github.com/GreptimeTeam/greptimedb/pull/8964)）。

## 生态更新

### Grafana 插件

本月发布 2 个版本（[v3.0.1](https://github.com/GreptimeTeam/greptimedb-grafana-datasource/releases/tag/v3.0.1)、[v3.0.3](https://github.com/GreptimeTeam/greptimedb-grafana-datasource/releases/tag/v3.0.3)）。

- 查询改由 Go backend 走 `/v1/sql` 执行，面板 SQL（含时间宏）可以直接用于 Grafana 告警规则。
- 打开 **Use OTel** 可以自动填充 GreptimeDB 风格的 Logs/Traces 列。
- v3.0.3 修复了认证问题。

已有的 SQL 面板、Query Builder 配置和仪表盘继续可用，完整说明见[发布博客](/blogs/2026-08-20-greptimedb-grafana-plugin-backend-upgrade)。

### Dashboard

本月发布 4 个版本（[v0.13.14](https://github.com/GreptimeTeam/dashboard/releases/tag/v0.13.14)、[v0.13.13](https://github.com/GreptimeTeam/dashboard/releases/tag/v0.13.13)、[v0.13.12](https://github.com/GreptimeTeam/dashboard/releases/tag/v0.13.12)、[v0.13.11](https://github.com/GreptimeTeam/dashboard/releases/tag/v0.13.11)）。

- 仪表盘支持导出完整快照。
- 新增命令面板，导航和操作可以用键盘完成。
- 虚拟列表表格支持拖拽调整列宽，紧凑视图按列内容的自然宽度显示，并新增了一个宽度选项。
- 查询结果支持全屏查看。
- Perses 升级到 0.54，移除了新手引导。
- 修复了切换 host 之后连接失效的问题。

### Kubernetes Operator

本月发布 1 个版本（[v0.6.1](https://github.com/GreptimeTeam/greptimedb-operator/releases/tag/v0.6.1)）。

- CRD 支持配置审计日志，包含 frontend group。
- 支持自定义 service 端口。
- 移除了 CRD 中的 `ingress` 字段，属于 breaking change。

### MCP Server

本月发布 1 个版本（[v0.5.2](https://github.com/GreptimeTeam/greptimedb-mcp-server/releases/tag/v0.5.2)）。

- `mcp` 依赖版本锁定为 `>=1.8.0,<2`，避免全新安装时出现 `ModuleNotFoundError`。

## Good First Issues

下面两个 issue 范围清楚，适合第一次给 GreptimeDB 提 PR。想认领的在 issue 下留言即可。

### [Issue#8951](https://github.com/GreptimeTeam/greptimedb/issues/8951) Metric engine ignores ttl set on a logical table, so the OTLP metrics write hint has no effect

Metric Engine 接受逻辑表上设置的 TTL，但实际会忽略它，因此 `x-greptime-hints: ttl=180d` 这类 OTLP 写入 hint 静默失效。修复方式二选一：把 TTL 传播到物理表，或者在 `CREATE TABLE` 和 `ALTER TABLE` 时直接报错拒绝。

关键词：Table Engine, Write Protocols, SQL

难度：Medium

### [Issue#8620](https://github.com/GreptimeTeam/greptimedb/issues/8620) Support configuring region engine options through environment variables

`region_engine` 相关选项目前只能写在 TOML 里，等价的环境变量 `GREPTIMEDB_STANDALONE__REGION_ENGINE__MITO__GLOBAL_WRITE_BUFFER_REJECT_SIZE` 不会生效，而是导致启动失败。需要让 region engine 这一段配置遵循与其他配置项相同的分层映射规则。

关键词：Configuration, Standalone, Datanode

难度：Medium

## 参与社区

- 文档：https://docs.greptime.cn
- GitHub：https://github.com/GreptimeTeam/greptimedb
- X：https://x.com/Greptime

有 bug 或功能需求，欢迎提 issue，也可以到社区群里交流。
