Conversation
| return _id, resp["data"][0] | ||
|
|
||
| @staticmethod | ||
| def _remove_conflicting_slo_fields(resource: Dict) -> None: |
There was a problem hiding this comment.
This is only being called for the destination resources. So the source SLO will have both fields and the destination will only have sli_specification meaning diffs will show a difference and try to update it every time this is run, and will make the update call. We can't just ignore the query field like we can other fields either because some SLOs will only have query params right? Or can we just always remove the query from every SLO?
There was a problem hiding this comment.
Yeah, I was a bit confused by how this worked initially but I see now how excluded_attributes works (field is excluded from the diff as well as the outgoing destination payload)-- I updated my branch to just add query to the excluded_attributes and tested w/ and w/out the FF enabled, and everything worked as expected.
Summary
Fixes an issue where syncing metric-based SLOs would fail due to conflicting fields being sent to the Datadog API.
Problem
The Datadog SLO GET endpoint returns both sli_specification and query fields for metric SLOs. However, the CREATE and UPDATE endpoints only accept one of these fields—not both. When the sync CLI attempted to create or update a metric SLO, the API would reject the request because both fields were present.
Solution
Exclude
queryfrom both thediffand outgoing payloads to the API via theexcluded_attributesparam to avoid conflict errors.Changes
Aforementioned
excluded_attributesupdate.Consequences
Users will need the latest version of the datadog-sync-cli tool once the FF is enabled.
Conversely, if the FF is off and the tool is up to date with these changes, then the tool breaks because query will be excluded from payloads and it is a required field.
I tested this by using the datadog-sync-cli locally:
Adding query to excluded attrbitues and running against API w/ FF OFF
Running with FF on in the source org but not the destination org:
Running again with FF on, but with no change to underlying SLO
Running again with FF on, but with changes to underlying SLO sli_specification: