Repository navigation
Conversation
`monitoring.WithMonitor` records a "request" measurement for every HTTP request. When the Monitor is the log monitor (no InfluxDB configured), that is one log line per request. On theplant/kakuyasu-services prod-mp it is 10.3M lines a week across 15 services, 42% of the log volume of the busiest one, carrying path, method, status code and duration that request tracing already has. Add `monitoring.WithMonitorContextOnly`, which installs the Monitor in the request context but skips the measurement, so handlers recording their own metrics keep working. `appkit/service` picks between the two on `MONITORING_DISABLE_REQUEST_METRIC`, the same env-config pattern the other middlewares in that package use. Default behaviour is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
Author
|
Closing: not the route we are taking. kakuyasu drops these lines at the log collector instead, matching how mcd already handles them in its firelens config. Leaving appkit's default behaviour alone. |
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.
Problem
monitoring.WithMonitorrecords arequestmeasurement for every HTTP request. When the Monitor is the log monitor (the fallback when no InfluxDB is configured), that measurement is one log line per request.On theplant/kakuyasu-services prod-mp that is 10.3M lines a week across 15 services. On the busiest one (
web) it is 42% of the whole log volume. The lines carry path, method, response code and duration, which request tracing already has.There was no way to turn it off short of not using
appkit/service.Change
monitoring.WithMonitorContextOnly(m): installs the Monitor in the request context but skips therequestmeasurement. Handlers that record their own metrics throughmonitoring.ForceContextkeep working.appkit/servicepicks betweenWithMonitorandWithMonitorContextOnlybased onMONITORING_DISABLE_REQUEST_METRIC, loaded with configor like the other middlewares in that package, and logs the decision at startup.Default behaviour is unchanged: without the env var set,
WithMonitorruns exactly as before.Notes
WithMonitorContextOnlyalso skips the "cannot determine response code" warning, since that comes from building the measurement's tags.WithMonitor, not recorded byWithMonitorContextOnly, and the Monitor lands in the request context either way.Test runs
go build ./...go test ./monitoring/... ./service/...— both pass.🤖 Generated with Claude Code