Skip to content

Change Policy.id from UUID struct to string#74

Merged
annacai21 merged 1 commit into
mainfrom
anna.cai/change-policy-id-type
Jul 9, 2026
Merged

Change Policy.id from UUID struct to string#74
annacai21 merged 1 commit into
mainfrom
anna.cai/change-policy-id-type

Conversation

@annacai21

Copy link
Copy Markdown
Contributor

Policy.id was a fixed 16-byte representation, split into two uint64s as a workaround for FlatBuffers' Go codegen not supporting fixed-size arrays in structs at the time.

That representation only works for real UUIDs. We want id to also carry the sentinel value "hardcoded" for built-in/hardcoded policies (as opposed to Remote Config policies, which get a real per-rule UUID), so a single field can identify the origin of any policy regardless of source.

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Jul 9, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 21.66%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a95b06c | Docs | Datadog PR Page | Give us feedback!

@natitsechanski natitsechanski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@annacai21 annacai21 merged commit d1899c3 into main Jul 9, 2026
14 checks passed
@annacai21 annacai21 deleted the anna.cai/change-policy-id-type branch July 9, 2026 20:27
@annacai21 annacai21 restored the anna.cai/change-policy-id-type branch July 9, 2026 20:43

@iamluc iamluc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure of the backward compatibility of this change?

Or maybe it's not filled by the UI? (https://github.com/DataDog/dd-go/blob/prod/remote-config/apps/rc-schema-validation/schemas/apm-policies.json#L193-L196)

@annacai21

Copy link
Copy Markdown
Contributor Author

Are you sure of the backward compatibility of this change?

Or maybe it's not filled by the UI? (https://github.com/DataDog/dd-go/blob/prod/remote-config/apps/rc-schema-validation/schemas/apm-policies.json#L193-L196)

@iamluc Good catch, I have a PR that updates id in apm-policies.json from dd_wls_UUID to string here: https://github.com/ddoghq/dd-go/pull/137. That said, this change here is safe on its own today as nothing currently populates a string id in production because the UI currently never fills it in. So every real policy currently has id simply absent, which validates fine either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants