refactor(public-api/v1alpha): derive watchman prefix from METRICS_NAMESPACE#1060
Open
skipi wants to merge 2 commits into
Open
refactor(public-api/v1alpha): derive watchman prefix from METRICS_NAMESPACE#1060skipi wants to merge 2 commits into
skipi wants to merge 2 commits into
Conversation
skipi
force-pushed
the
mk/public-api/watchman-metrics-namespace
branch
2 times, most recently
from
June 15, 2026 09:33
df0658b to
30e2ff2
Compare
…ESPACE ppl-api set its Watchman metric prefix from K8S_NAMESPACE at app start (set_watchman_prefix + restart_app), tagging its metrics with the pod's k8s namespace instead of the platform-wide METRICS_NAMESPACE every other service uses. That left the `env` graphite tag non-uniform, so the shared api.client_usage / api.org_usage series split ppl-api from the rest. Resolve the prefix from METRICS_NAMESPACE in runtime.exs, matching the convention used by projecthub/secrethub/dashboardhub/etc., and drop the now-dead app-start hack plus the Config helper module that existed only for it. Note: this relocates existing ppl-api.* series from env=<k8s-namespace> to env=<METRICS_NAMESPACE> (e.g. s2prod); any dashboard/alert keyed on the old env value needs updating. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
runtime.exs now sets the :watchman prefix unguarded, so it applies during mix test too (METRICS_NAMESPACE unset -> "ppl-api.dev"), overriding the "ppl-api.test" value here. The test.exs prefix was therefore inert and misleading. Drop it; keep host/port. Matches projecthub, which has no watchman prefix in its test.exs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
skipi
force-pushed
the
mk/public-api/watchman-metrics-namespace
branch
from
June 15, 2026 11:19
30e2ff2 to
95b6201
Compare
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.
What
ppl-api (public-api/v1alpha) set its Watchman metric prefix from
K8S_NAMESPACEat application start (set_watchman_prefix+restart_app), so its metrics were tagged with the pod's Kubernetes namespace instead of theMETRICS_NAMESPACEvalue every other service uses. That made theenvgraphite tag non-uniform — ppl-api landed under a differentenvthan the rest of the platform, so the shared per-client request counters (emitted under the same names by several API services so they can be aggregated) split ppl-api away from the others.This resolves the prefix from
METRICS_NAMESPACEinruntime.exs, matching the convention already used by projecthub, secrethub, dashboardhub, guard, and the Go services. The now-dead application-start hook and theUtil.Confighelper module that existed only for it are removed.Why runtime.exs
The prefix only depends on a runtime env var, and runtime config is applied before the
:watchmanapplication boots — so the value is correct at startup with no need to mutate config and restart the app afterwards.Note for dashboards / alerts
This relocates existing
ppl-api.*metric series fromenv=<k8s-namespace>toenv=<METRICS_NAMESPACE>. Any dashboard or alert keyed on the oldenvvalue needs updating after this ships.🤖 Generated with Claude Code