Filter metrics_metadata by destination-existence#617
Merged
Conversation
metrics_metadata can only attach metadata (description, unit, integration
hints) to a metric that already exists on destination. The legacy dogweb
handler returns 400 {"errors":["error updating metric metadata"]} when the
metric key is missing on destination.
Under DR replication into an org that hasn't yet received the source's
custom metric emissions, this fails constantly and adds 25-30 minutes of
wall-clock time per dispatch across 14+ batches of ~700 records.
Fix: probe destination for the metric via GET /api/v2/metrics/{name}
before the PUT. On 404, raise SkipResource so the sync framework logs it
as skipped (not a failure). Other HTTP errors from the probe (5xx, 403)
propagate to the existing retry layer unchanged.
Adds 5 unit tests covering 200/404/500/403 GET outcomes plus the
create_resource → update_resource delegation.
Ref: HAMR-392 Jul8-T20. Root-cause analysis at team-compass
HAMR-392/T-metrics-metadata/STATUS.md commit d22a7ce222.
riyazsh
force-pushed
the
riyaz/HAMR-392-metrics-metadata-dest-existence
branch
from
July 9, 2026 15:27
3b0f25e to
c06c92a
Compare
nathantournant
approved these changes
Jul 9, 2026
heyronhay
approved these changes
Jul 9, 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
Skip
metrics_metadataPUT when the metric doesn't exist on destination. The legacy dogweb handler returns 400{"errors":["error updating metric metadata"]}for missing metrics, wasting ~700 API calls / 25-30min per DR dispatch.Change
Before PUT,
GET /api/v1/metrics/{name}(same base_path):SkipResource(logged at DEBUG); PUT skipped5 unit tests cover 200/404/500/403 +
create_resourcedelegation. Mirrors thehost_tags.py404-skip pattern.Notes
/api/v1/metrics/{name}— the v2 bare-name route isn't registered in dd-source governance (only v2 list + subresources).metrics_metadatato Vault allowlist (Jul8-T19 dropped it temporarily).Ref: HAMR-392 Jul8-T20. Root cause at
team-compass HAMR-392/T-metrics-metadata/STATUS.md@d22a7ce222.