Commit 1e709af
Add configuration discovery infrastructure to datadog_checks_base (#23963)
* Add configuration discovery infrastructure to datadog_checks_base.
Extends AgentCheck with discover_config / generate_configs class methods
for auto-detecting working configurations from service metadata. Adds
Discovery, Service, and Port data types to datadog_checks.base.utils.discovery,
a probe module (_suppress_discovery_side_effects, _try_discovery_candidate,
run_discovery) that trial-runs candidates in isolation, and a _package_name
helper in base.py to eliminate repeated module-string parsing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* walrus
* comment
* Use pydantic BaseModel for Port and Service
Simplifies _parse_service_json: the Agent always sends well-typed JSON
(int number, string name), so manual field extraction and to_native_string
coercion are unnecessary — model_validate handles all of it.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* validate
* Remove from_ports from base; add discovery_strategy decorator
Move from_ports strategy logic to the dev-side codegen registry (Phase 2).
Base retains only the runtime primitives: Service, Port, candidate_ports,
and the probing harness. Add the discovery_strategy decorator for custom
(local:) strategies that run arbitrary integration code at Agent runtime.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* datadog_checks_base: match changelog text to phase 1 spec
Use the wording prescribed by the phase 1 plan: the Phase 1 changelog
describes the discovery runtime (Service/Port types, candidate_ports,
probing harness, discovery entry points), not the codegen/validation
tooling, which belongs to Phase 2.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Fix test mock to patch import_module where it is called
The test patched datadog_checks.base.checks.base.importlib.import_module,
but generate_configs() delegates to the probe module, which calls
probe.importlib.import_module. Patch that path instead so the mock is
actually exercised.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Remove __discovery_provides__ attribute and dead-code tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent cb40f3f commit 1e709af
9 files changed
Lines changed: 737 additions & 12 deletions
File tree
- datadog_checks_base
- changelog.d
- datadog_checks/base
- checks
- utils/discovery
- tests/base
- checks
- utils/discovery
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
179 | 181 | | |
180 | 182 | | |
181 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
182 | 211 | | |
183 | 212 | | |
184 | 213 | | |
| |||
752 | 781 | | |
753 | 782 | | |
754 | 783 | | |
755 | | - | |
| 784 | + | |
756 | 785 | | |
757 | 786 | | |
758 | 787 | | |
| |||
770 | 799 | | |
771 | 800 | | |
772 | 801 | | |
773 | | - | |
| 802 | + | |
774 | 803 | | |
775 | 804 | | |
776 | 805 | | |
777 | 806 | | |
778 | 807 | | |
779 | 808 | | |
780 | | - | |
| 809 | + | |
781 | 810 | | |
782 | 811 | | |
783 | 812 | | |
784 | 813 | | |
785 | 814 | | |
786 | 815 | | |
787 | | - | |
| 816 | + | |
788 | 817 | | |
789 | 818 | | |
790 | 819 | | |
791 | 820 | | |
792 | 821 | | |
793 | 822 | | |
794 | | - | |
| 823 | + | |
795 | 824 | | |
796 | 825 | | |
797 | 826 | | |
| |||
810 | 839 | | |
811 | 840 | | |
812 | 841 | | |
813 | | - | |
| 842 | + | |
814 | 843 | | |
815 | 844 | | |
816 | 845 | | |
| |||
974 | 1003 | | |
975 | 1004 | | |
976 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
977 | 1010 | | |
978 | 1011 | | |
979 | 1012 | | |
| |||
1012 | 1045 | | |
1013 | 1046 | | |
1014 | 1047 | | |
1015 | | - | |
| 1048 | + | |
1016 | 1049 | | |
1017 | 1050 | | |
1018 | 1051 | | |
| |||
1233 | 1266 | | |
1234 | 1267 | | |
1235 | 1268 | | |
1236 | | - | |
| 1269 | + | |
1237 | 1270 | | |
1238 | 1271 | | |
1239 | 1272 | | |
| |||
1649 | 1682 | | |
1650 | 1683 | | |
1651 | 1684 | | |
1652 | | - | |
| 1685 | + | |
1653 | 1686 | | |
1654 | 1687 | | |
1655 | 1688 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | | - | |
| 7 | + | |
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
8 | 31 | | |
9 | 32 | | |
10 | 33 | | |
| |||
21 | 44 | | |
22 | 45 | | |
23 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments