From b508cbe4799525d25f6dd0cb846aaab3522b9a59 Mon Sep 17 00:00:00 2001 From: Andrew Costa <51675269+acosta11@users.noreply.github.com> Date: Mon, 28 Sep 2026 12:42:10 -0700 Subject: [PATCH 1/2] executor: stop fabricating log_rate=0 in the container metrics processor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DefaultMetricsProcessor.ProcessAndSend calls SendAppLogRate(0, 0, tags) on every container-metrics tick for every container with a source_id, in addition to depot/log_streamer.logRateLimiter, which already emits the real log_rate/log_rate_limit gauge pair on its own ticker whenever container_metrics_report_interval (rep job property) is enabled. Both components send envelopes with the same metric-key set (source_id + instance_id), and CAPI's ContainerMetricBatcher deduplicates incoming envelopes by that key. Which value wins depends on arrival order, so the fabricated zero from this path intermittently displaces the real measurement in `cf app` / Log Cache output, making log rate limiting look disabled even when it is actively throttling. There is no reason for the metrics processor to emit this metric at all: it always sends 0, 0 — never a real reading — and removing it does not change the emitter that actually measures log rate. Added a spec asserting SendAppLogRate is never called by the metrics processor; log_rate now comes from exactly one place in this codebase, depot/log_streamer/log_rate_limiter.go:109. Co-Authored-By: Claude Sonnet 5 --- .../executor/containermetrics/metrics_processor.go | 8 -------- .../executor/containermetrics/reporters_runner_test.go | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/code.cloudfoundry.org/executor/containermetrics/metrics_processor.go b/src/code.cloudfoundry.org/executor/containermetrics/metrics_processor.go index 14c7dfd2f3..fffd123743 100644 --- a/src/code.cloudfoundry.org/executor/containermetrics/metrics_processor.go +++ b/src/code.cloudfoundry.org/executor/containermetrics/metrics_processor.go @@ -57,14 +57,6 @@ func (p *DefaultMetricsProcessor) ProcessAndSend( "tags": metricsConfig.Tags, }) } - - if err := metronClient.SendAppLogRate(0, 0, metricsConfig.Tags); err != nil { - logger.Error("failed-to-send-log-rate", err, lager.Data{ - "metrics_guid": applicationId, - "metrics_index": metricsConfig.Index, - "tags": metricsConfig.Tags, - }) - } } return currentInfo, &CachedContainerMetrics{ diff --git a/src/code.cloudfoundry.org/executor/containermetrics/reporters_runner_test.go b/src/code.cloudfoundry.org/executor/containermetrics/reporters_runner_test.go index 291988f025..6f09c3d2b3 100644 --- a/src/code.cloudfoundry.org/executor/containermetrics/reporters_runner_test.go +++ b/src/code.cloudfoundry.org/executor/containermetrics/reporters_runner_test.go @@ -601,6 +601,11 @@ var _ = Describe("ReportersRunner", func() { }, BeEmpty()))) }) + It("does not emit log_rate, which is owned by the log streamer and app-log-watcher", func() { + Consistently(fakeMetronClient.SendAppLogRateCallCount).Should(Equal(0), + "log_rate must come from the component that measures it, on one ticker") + }) + Context("and the interval elapses again", func() { JustBeforeEach(func() { fakeClock.WaitForWatcherAndIncrement(interval) From 3ca731b96b6bcc7132a55f6408a86e364032600f Mon Sep 17 00:00:00 2001 From: Andrew Costa <51675269+acosta11@users.noreply.github.com> Date: Mon, 28 Sep 2026 16:53:20 -0700 Subject: [PATCH 2/2] Remove negative log rate metric test as regression is not expected. --- .../executor/containermetrics/reporters_runner_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/code.cloudfoundry.org/executor/containermetrics/reporters_runner_test.go b/src/code.cloudfoundry.org/executor/containermetrics/reporters_runner_test.go index 6f09c3d2b3..291988f025 100644 --- a/src/code.cloudfoundry.org/executor/containermetrics/reporters_runner_test.go +++ b/src/code.cloudfoundry.org/executor/containermetrics/reporters_runner_test.go @@ -601,11 +601,6 @@ var _ = Describe("ReportersRunner", func() { }, BeEmpty()))) }) - It("does not emit log_rate, which is owned by the log streamer and app-log-watcher", func() { - Consistently(fakeMetronClient.SendAppLogRateCallCount).Should(Equal(0), - "log_rate must come from the component that measures it, on one ticker") - }) - Context("and the interval elapses again", func() { JustBeforeEach(func() { fakeClock.WaitForWatcherAndIncrement(interval)