Prometheus Metrics

ZeroFS can expose metrics in Prometheus format over an HTTP endpoint.

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"]

addresses defaults to 127.0.0.1:9091. An empty [prometheus] section is valid and starts the endpoint on that address. 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)

Memory (jemalloc)

Gauges that report the state of the jemalloc allocator:

MetricTypeDescription
zerofs_jemalloc_allocated_bytesgaugeBytes actively allocated by the application
zerofs_jemalloc_resident_bytesgaugeBytes in physically resident pages mapped by the allocator
zerofs_jemalloc_mapped_bytesgaugeBytes in active pages mapped by the allocator
zerofs_jemalloc_retained_bytesgaugeBytes in virtual memory mappings retained for future reuse
zerofs_jemalloc_metadata_bytesgaugeBytes dedicated to allocator metadata

zerofs_jemalloc_resident_bytes tracks the allocator's physical memory footprint. zerofs_jemalloc_retained_bytes counts virtual address space kept for reuse and does not consume physical memory, so memory alerts should key on resident, not retained or mapped.

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 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']

A background task collects all metric values every 5 seconds, and the endpoint serves the last collected values. A scrape_interval below 5 seconds does not increase resolution.

Was this page helpful?