mirror of
https://github.com/deepseek-ai/3FS.git
synced 2026-11-05 00:47:47 +00:00
[PR #408] [CLOSED] feat(monitor): add Prometheus exporter as a metrics reporter backend #421
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/3FS#421
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/3FS/pull/408
Author: @ChaosD
Created: 4/3/2026
Status: ❌ Closed
Base:
main← Head:feature/prometheus-support📝 Commits (4)
26b39eeFeat(monitor): expose prometheus metrics33ee8e7Delete patches/prometheus-cpp-integration.patchd440efdfix: add prometheus submodules215c6e6fix: enable prometheus-cpp submodule📊 Changes
14 files changed (+251 additions, -13 deletions)
View changed files
📝
.github/workflows/build.yml(+3 -1)📝
.gitmodules(+3 -0)📝
CMakeLists.txt(+3 -0)📝
configs/monitor_collector_main.toml(+3 -0)📝
patches/apply.sh(+6 -0)➕
patches/prometheus-cpp.patch(+38 -0)📝
src/common/CMakeLists.txt(+2 -0)📝
src/common/monitor/Monitor.cc(+23 -9)📝
src/common/monitor/Monitor.h(+3 -1)➕
src/common/monitor/PromExporter.cc(+128 -0)➕
src/common/monitor/PromExporter.h(+33 -0)📝
src/monitor_collector/service/MonitorCollectorOperator.cc(+3 -0)📝
src/monitor_collector/service/MonitorCollectorService.h(+2 -2)➕
third_party/prometheus-cpp(+1 -0)📄 Description
feat(monitor): add Prometheus exporter as a metrics reporter backend
Summary:
Integrates
prometheus-cpp(via git submodule) as a new metrics reporter backend, enabling 3FS services to expose metrics directly via a Prometheus HTTP endpoint.Changes:
Build system (
CMakeLists.txt,src/common/CMakeLists.txt): Addthird_party/prometheus-cppas a subdirectory (with push and testing disabled); linkprometheus-cpp::coreandprometheus-cpp::pullinto bothcommonandhf3fs_common_sharedtargets.Patch management (
patches/apply.sh): Idempotently applyprometheus-cpp.patchfollowing the same pattern used forfolly.New reporter (
src/common/monitor/PromExporter.h/cc): Implements theReporterinterface. Oncommit(), maps 3FSSampletypes to PrometheusGaugefamilies — scalar samples as counters, distribution samples as_cnt/_mean/_sum/_min/_max/_p50/_p90/_p95/_p99gauges. Metric/label names with.are normalized to_for Prometheus compatibility.Monitor integration (
Monitor.h,Monitor.cc): AddsCONFIG_OBJ(prometheus, PromExporter::Config)toReporterConfig. BecausePromExporterbinds a TCP port, it is pre-created as a singleshared_ptrbefore the per-collector loop and shared across all collector threads (instead of one instance per collector). Reporter ownership is changed fromunique_ptr→shared_ptrto support this sharing.MonitorCollector service (
MonitorCollectorOperator.cc,MonitorCollectorService.h): Addsprometheusas a valid reporter type inconnThreadFunc. Changes the default reporter fromclickhouse→prometheusand reducesconn_threadsdefault from32→1(required since eachPromExporterinstance binds a port; only one thread should own it in this path).Config (
configs/monitor_collector_main.toml): Adds[server.monitor_collector.reporter.prometheus]section withport = '8080'.Known limitation:
In
MonitorCollectorOperator, ifconn_threadsis manually set to> 1withtype = "prometheus", each thread creates its ownPromExporterand will conflict on the port. This is only guarded by convention (defaultconn_threads = 1), not enforced in code.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.