Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion prometheus_dirsize_exporter/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import time
import argparse
from typing import Callable, Never, Optional, Generator
from prometheus_client import start_http_server
from prometheus_client import REGISTRY, start_http_server
from . import metrics
from dataclasses import dataclass

Expand Down Expand Up @@ -192,6 +192,9 @@ def main() -> Never:

args = argparser.parse_args()

if not args.disable_total_size:
REGISTRY.register(metrics.TOTAL_SIZE)

start_http_server(args.port)
while True:
walker = BudgetedDirInfoWalker(args.iops_budget)
Expand Down
3 changes: 2 additions & 1 deletion prometheus_dirsize_exporter/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

TOTAL_SIZE = Gauge(
"total_size_bytes", "Total Size of the Directory (in bytes)", namespace=NAMESPACE,
labelnames=("directory",)
labelnames=("directory",),
registry=None # Don't register this metric, as it's optional
)

LATEST_MTIME = Gauge(
Expand Down