Skip to content

Add scheduled metrics cleanup job#2654

Open
neddp wants to merge 2 commits intocloudfoundry:mainfrom
neddp:add_scheduled_metrics_cleanup_job
Open

Add scheduled metrics cleanup job#2654
neddp wants to merge 2 commits intocloudfoundry:mainfrom
neddp:add_scheduled_metrics_cleanup_job

Conversation

@neddp
Copy link
Member

@neddp neddp commented Jan 7, 2026

What is this change about?

This change adds automatic cleanup of stale metrics files in /var/vcap/store/director/metrics to prevent disk space issues caused by accumulating Prometheus DirectFileStore binary files.

Fixes #2623

Please provide contextual information.

Background:

Implementation:

  • Added new ScheduledMetricsCleanup job that runs daily at midnight UTC
  • Configurable retention period (default: 7 days)
  • Only runs when director.metrics_server.enabled is true
  • Follows existing BOSH patterns (similar to orphaned disk/VM cleanup jobs)

What tests have you run against this PR?

  • RuboCop linting
  • Unit tests

How should this change be described in bosh release notes?

New Feature: The metrics server now automatically cleans up stale metrics files older than the configured retention period (default: 7 days). This prevents disk space issues from accumulating metric binary files. Cleanup runs daily at midnight UTC and can be configured via director.metrics_server.file_retention_days and director.metrics_server.cleanup_schedule properties.

Does this PR introduce a breaking change?

No. This is a new feature with safe defaults:

  • Only runs when metrics_server is enabled
  • Default retention is 7 days
  • Cleanup can be disabled by setting file_retention_days to 0
  • No changes to existing behavior or APIs

Tag your pair, your PM, and/or team!

@beyhan beyhan moved this from Inbox to Pending Review | Discussion in Foundational Infrastructure Working Group Jan 8, 2026
@beyhan beyhan requested review from a team, benjaminguttmann-avtq and s4heid and removed request for a team January 8, 2026 16:15
@aramprice aramprice requested a review from Ivaylogi98 February 12, 2026 16:07
@github-project-automation github-project-automation bot moved this from Pending Review | Discussion to Pending Merge | Prioritized in Foundational Infrastructure Working Group Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending Merge | Prioritized

Development

Successfully merging this pull request may close these issues.

Stale metrics-server files in /var/vcap/store/director/metrics

3 participants