Skip to content

Commit d8f6e60

Browse files
committed
Allow disabling total size metric
For use in conjunction with 2i2c-org/jupyterhub-home-nfs#76
1 parent 2f7afce commit d8f6e60

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

prometheus_dirsize_exporter/exporter.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ def main() -> Never:
183183
"--port", help="Port for the server to listen on", type=int, default=8000
184184
)
185185

186+
argparser.add_argument(
187+
"--disable-total-size",
188+
help="Disable total size metric reporting",
189+
action="store_true"
190+
191+
)
192+
186193
args = argparser.parse_args()
187194

188195
start_http_server(args.port)
@@ -191,7 +198,8 @@ def main() -> Never:
191198
for subdir_info in walker.get_subdirs_info(args.parent_dir):
192199
if subdir_info is None:
193200
continue
194-
metrics.TOTAL_SIZE.labels(subdir_info.path).set(subdir_info.size)
201+
if not args.disable_total_size:
202+
metrics.TOTAL_SIZE.labels(subdir_info.path).set(subdir_info.size)
195203
metrics.LATEST_MTIME.labels(subdir_info.path).set(subdir_info.latest_mtime)
196204
metrics.OLDEST_MTIME.labels(subdir_info.path).set(subdir_info.oldest_mtime)
197205
metrics.ENTRIES_COUNT.labels(subdir_info.path).set(

0 commit comments

Comments
 (0)