Handle metric tag configuration destination conflicts - #669
Merged
Conversation
Signed-off-by: riyaz.shiraguppi <riyaz.shiraguppi@datadoghq.com>
Signed-off-by: riyaz.shiraguppi <riyaz.shiraguppi@datadoghq.com>
Contributor
Author
|
Update: I added the Additional scope:
Notebook investigation:
Additional validation:
|
Signed-off-by: riyaz.shiraguppi <riyaz.shiraguppi@datadoghq.com>
riyazsh
marked this pull request as ready for review
August 25, 2026 14:33
michael-richey
approved these changes
Aug 25, 2026
riyazsh
force-pushed
the
riyaz/HAMR-395-metric-tag-config-patch
branch
from
August 25, 2026 15:05
b96a791 to
d76eaf0
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.
Summary
Context
Paxos DDR sync is seeing metric_tag_configurations failures where the destination API returns 409 asking callers to use PATCH.
The surprising part is that this can happen even though the US5 DDR org has no customer traffic and managed-sync is expected to be the writer. The reason is that sync-cli's create-vs-update decision is based on its persisted destination state, not a live existence check against the Metrics API. If destination state has no metric tag configuration entry, sync-cli chooses the create path and sends POST.
That missing destination-state entry does not guarantee the destination config is absent. The destination config may already exist because an earlier partial run created it but did not persist the destination mapping, because GCS destination state is stale/incomplete/pruned, or because metric tag configuration identity is attached to the metric name rather than to a sync-owned UUID. In that state, the destination API is correct to reject POST with 409 and ask the caller to PATCH the existing config.
Refreshing destination state in managed-sync does not fix this resource path by itself: the resource handler still needs to treat the 409 as evidence that the config exists, fetch the existing destination config, seed local destination state, and retry through the normal PATCH update path.
Testing
tox -e py312 -- tests/unit/test_metric_percentiles.py tests/unit/test_metric_tag_configurations.pyenv DD_HTTP_CLIENT_RETRY_TIMEOUT=300 RECORD=false DD_DESTINATION_API_URL=https://api.us5.datadoghq.com DD_DESTINATION_API_KEY=fake DD_DESTINATION_APP_KEY=fake DD_SOURCE_API_URL=https://api.datadoghq.eu DD_SOURCE_API_KEY=fake DD_SOURCE_APP_KEY=fake MAX_WORKERS=10 .tox/py312/bin/pytest -v -m integration tests/integration/resources/test_metric_percentiles.py::TestMetricPercentilesResources.tox/py312/bin/black --line-length 120 --check datadog_sync/model/metric_percentiles.py tests/unit/test_metric_percentiles.py datadog_sync/model/metric_tag_configurations.py tests/unit/test_metric_tag_configurations.pyb96a791b