Prometheus Metrics

ZeroFS can expose metrics in Prometheus format via an HTTP endpoint for operational monitoring and alerting.

Configuration

Add a [prometheus] section to your configuration file:

[prometheus]
addresses = ["127.0.0.1:9091"]

This starts an HTTP server on the specified address. Metrics are available at /metrics:

curl http://127.0.0.1:9091/metrics

Multiple bind addresses are supported, following the same pattern as other ZeroFS servers:

[prometheus]
addresses = ["127.0.0.1:9091", "0.0.0.0:9091"]

When the [prometheus] section is absent, no metrics endpoint is started.

Available Metrics

Filesystem Operations

Counters that track cumulative operations since server start:

MetricTypeDescription
zerofs_files_created_totalcounterFiles created
zerofs_files_deleted_totalcounterFiles deleted
zerofs_files_renamed_totalcounterFiles renamed
zerofs_directories_created_totalcounterDirectories created
zerofs_directories_deleted_totalcounterDirectories deleted
zerofs_directories_renamed_totalcounterDirectories renamed
zerofs_links_created_totalcounterLinks created
zerofs_links_deleted_totalcounterLinks deleted
zerofs_links_renamed_totalcounterLinks renamed

I/O

MetricTypeDescription
zerofs_read_operations_totalcounterTotal read operations
zerofs_write_operations_totalcounterTotal write operations
zerofs_bytes_read_totalcounterTotal bytes read
zerofs_bytes_written_totalcounterTotal bytes written
zerofs_total_operationscounterTotal operations across all types

Garbage Collection

MetricTypeDescription
zerofs_tombstones_created_totalcounterTombstones created for deleted data
zerofs_tombstones_processed_totalcounterTombstones processed by GC
zerofs_gc_chunks_deleted_totalcounterData chunks reclaimed by GC
zerofs_gc_runs_totalcounterNumber of GC cycles completed

Filesystem State

MetricTypeDescription
zerofs_used_bytesgaugeTotal bytes stored in the filesystem
zerofs_used_inodesgaugeTotal active inodes (files, directories, symlinks)

SlateDB (LSM Engine)

ZeroFS exposes internal metrics from the SlateDB storage engine. These are prefixed with slatedb_ and include compaction and storage statistics. The exact metrics depend on the SlateDB version and are dynamically discovered at runtime.

Common SlateDB metrics include:

MetricTypeDescription
slatedb_compactor_bytes_compactedcounterTotal bytes processed by compaction
slatedb_compactor_running_compactionsgaugeNumber of active compaction tasks
slatedb_compactor_total_bytes_being_compactedgaugeBytes currently being compacted

Prometheus Scrape Configuration

Add ZeroFS as a target in your prometheus.yml:

scrape_configs:
  - job_name: 'zerofs'
    scrape_interval: 15s
    static_configs:
      - targets: ['localhost:9091']

Was this page helpful?