Add --json flag and ResourceOutcome model#479
Open
nathantournant wants to merge 4 commits intomainfrom
Open
Conversation
heyronhay
previously approved these changes
Mar 20, 2026
5597040 to
7ffbc4f
Compare
8ab1217 to
963da8c
Compare
…document diffs semantics - S2: Truncate reason field to 1024 chars in __post_init__ to bound raw API error bodies crossing the CLI→worker boundary - S5: Document diffs-mode semantics in docstring (outcomes describe intended actions, not completed mutations) - N1: Add flush=True to emit() for piped-stdout crash resilience - N2: Rename DD_JSON → DD_SYNC_JSON to avoid envvar namespace collision Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- M1: action_type and status fields now use Literal types for static analysis coverage over the 24 _emit call sites - M2: Replace hand-rolled to_dict() with dataclasses.asdict() - M3: Add -> None return annotation to __post_init__ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
963da8c to
43dfa47
Compare
heyronhay
approved these changes
Mar 20, 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
--jsonCLI flag (gated viaDD_JSONenvvar) to emit per-resource outcomes as JSON lines to stdoutResourceOutcomedataclass with 6 fields structurally aligned with the CLI's existingdatadog.org-sync.actionmetric tags:resource_type,id,action_type,status,action_sub_type,reasonContext
The managed-sync Go worker currently runs the CLI via
cmd.CombinedOutput()with no per-resource visibility. This PR introduces the data model and flag that enable streaming structured outcomes — the worker can forward these fields as statsd tags without translation.Stack
Test plan
_send_action_metricsinbase_resource.py🤖 Generated with Claude Code