feat(metrics): add scheduler and git operation OTel metrics#240
Merged
feat(metrics): add scheduler and git operation OTel metrics#240
Conversation
Add OpenTelemetry metrics for operational visibility into the job scheduler and git strategy: Scheduler metrics: - cachew.scheduler.queue_depth: pending jobs gauge - cachew.scheduler.active_workers: running workers gauge - cachew.scheduler.active_clones: clone-specific concurrency gauge - cachew.scheduler.jobs_total: counter by job type and status - cachew.scheduler.job_duration_seconds: histogram by job type and status Git operation metrics: - cachew.git.operations_total: counter by operation/upstream/status - cachew.git.operation_duration_seconds: histogram for clone/fetch/snapshot - cachew.git.requests_total: HTTP request counter by type All metrics flow through the existing OTel/Prometheus pipeline and are scraped on :9102/metrics automatically. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d404e-21ec-723a-b211-c619925dd12e
ef643e8 to
eefe9f2
Compare
stuartwdouglas
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add OpenTelemetry metrics for operational visibility into the job scheduler and git strategy. These are the first custom application-level metrics in cachew — all prior OTel usage was limited to the otelhttp middleware.
Scheduler metrics
Job types: clone, fetch, snapshot, repack, other.
Git operation metrics
Context
Part of the operational hardening effort. The immediate goal is visibility into worker utilization and queue depth so we can detect saturation (e.g. clone storms from service accounts) before it impacts users.
All metrics flow through the existing OTel/Prometheus pipeline and are scraped on :9102/metrics automatically.