Add dd-autoinstrumentation CLI with LLM-native structured output#8313
Add dd-autoinstrumentation CLI with LLM-native structured output#8313
Conversation
78661d7 to
fc5fd18
Compare
BenchmarksBenchmark execution time: 2026-03-16 20:19:01 Comparing candidate commit fc5fd18 in PR branch Found 5 performance improvements and 6 performance regressions! Performance is the same for 168 metrics, 13 unstable metrics. scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0
scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0
scenario:Benchmarks.Trace.HttpClientBenchmark.SendAsync netcoreapp3.1
scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0
scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1
scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8313) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8313) - mean (76ms) : 74, 78
master - mean (72ms) : 70, 74
section Bailout
This PR (8313) - mean (80ms) : 78, 82
master - mean (76ms) : 75, 77
section CallTarget+Inlining+NGEN
This PR (8313) - mean (1,096ms) : 1062, 1130
master - mean (1,057ms) : 1027, 1087
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8313) - mean (117ms) : 113, 121
master - mean (114ms) : 111, 116
section Bailout
This PR (8313) - mean (119ms) : 116, 122
master - mean (113ms) : 111, 116
section CallTarget+Inlining+NGEN
This PR (8313) - mean (800ms) : 781, 820
master - mean (776ms) : 754, 797
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8313) - mean (103ms) : 100, 106
master - mean (99ms) : 96, 102
section Bailout
This PR (8313) - mean (105ms) : 101, 109
master - mean (101ms) : 98, 103
section CallTarget+Inlining+NGEN
This PR (8313) - mean (947ms) : 917, 977
master - mean (932ms) : 895, 969
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8313) - mean (104ms) : 100, 107
master - mean (98ms) : 95, 100
section Bailout
This PR (8313) - mean (105ms) : 102, 107
master - mean (100ms) : 97, 102
section CallTarget+Inlining+NGEN
This PR (8313) - mean (835ms) : 802, 868
master - mean (812ms) : 774, 849
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8313) - mean (189ms) : 186, 192
master - mean (189ms) : 186, 192
section Bailout
This PR (8313) - mean (192ms) : 191, 194
master - mean (192ms) : 190, 194
section CallTarget+Inlining+NGEN
This PR (8313) - mean (1,131ms) : 1074, 1187
master - mean (1,129ms) : 1080, 1178
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8313) - mean (271ms) : 267, 276
master - mean (271ms) : 268, 274
section Bailout
This PR (8313) - mean (272ms) : 269, 275
master - mean (271ms) : 269, 274
section CallTarget+Inlining+NGEN
This PR (8313) - mean (919ms) : 898, 941
master - mean (915ms) : 898, 932
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8313) - mean (265ms) : 261, 270
master - mean (265ms) : 261, 268
section Bailout
This PR (8313) - mean (265ms) : 263, 268
master - mean (265ms) : 262, 267
section CallTarget+Inlining+NGEN
This PR (8313) - mean (1,125ms) : 1069, 1181
master - mean (1,126ms) : 1080, 1172
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8313) - mean (263ms) : 259, 267
master - mean (263ms) : 259, 268
section Bailout
This PR (8313) - mean (263ms) : 261, 266
master - mean (263ms) : 261, 266
section CallTarget+Inlining+NGEN
This PR (8313) - mean (1,014ms) : 980, 1049
master - mean (1,010ms) : 974, 1047
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Extract the generation engine, configuration models, and resource templates from the GUI into a standalone Core library. The GUI now delegates to Core, reducing MainViewModel.Editor.cs from ~300 lines of inline logic to ~109 lines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add dd-autoinstrumentation CLI that uses the Core library to generate integration boilerplate from the command line. Includes --set key=value configuration, --config-file support, --json output, and Nuke build integration via RunInstrumentationGeneratorCli target. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… assembly inspection Add global --json flag, unified JSON error envelope with machine-readable error codes, inspect subcommand for type/method discovery, and structured --list-keys output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… workflow Update InstrumentationGenerator.md with inspect command, structured error handling, and LLM usage sections. Add dedicated LLM reference doc with full JSON schemas, error recovery patterns, and step-by-step autonomous workflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wrap AssemblyBrowser construction in try-catch so corrupted or non-.NET DLLs return a structured error instead of crashing the CLI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fc5fd18 to
dd7cbfc
Compare
Summary of changes
Adds a new CLI tool (
dd-autoinstrumentation) for auto-instrumentation code generation, designedfor scriptable and AI-agent-driven workflows with structured JSON output.
Reason for change
Creating integrations currently requires either the GUI or manual boilerplate. A CLI with structured
JSON output enables LLM agents to autonomously discover types/methods in an assembly, generate
instrumentation code, and recover from errors — all without human intervention.
Implementation details
New
Datadog.AutoInstrumentation.Generator.Cliproject with two commands:inspect— assembly discovery--list-types: lists all non-compiler-generated types with visibility, kind, method count--list-methods <type>: lists instrumentable methods with parameters, async detection, overloadindex/count
generate— code generation--overload-index,--parameter-types)--no-auto-detect)--set key=value,--config '{json}', or--config-file path.json--no-method-begin,--no-method-end,--async-method-end--jsonflag (global) — all output (success and error) as structured JSON on stdout with:FILE_NOT_FOUND,TYPE_NOT_FOUND,AMBIGUOUS_OVERLOAD,BAD_ASSEMBLY, etc.)AMBIGUOUS_OVERLOADincludes full overload list in response data for immediate retryinspectoutput includesoverloadIndex/overloadCountso agents know upfront if disambiguationis needed
Nuke integration —
RunInstrumentationGeneratorClitarget with direct parameters and--generator-argspassthrough.Documentation:
docs/development/InstrumentationGenerator.md— comprehensive reference for both GUI and CLIdocs/development/for-ai/InstrumentationGenerator-CLI.md— LLM-focused reference with full JSONschemas, error recovery patterns, and recommended autonomous workflow
Test coverage
No automated tests in this PR — this is a developer/AI tooling utility, not a production code path.
Manual testing performed against real assemblies for all commands, error paths, and JSON output.
Other details
#8312
🤖 Generated with Claude Code