1717from datadog_checks .base .utils .functions import identity
1818from datadog_checks .base .utils .models import validation
1919
20- from . import defaults , validators
20+ from . import defaults , deprecations , validators
2121
2222
2323class AgentJobs (BaseModel ):
@@ -48,6 +48,16 @@ class Azure(BaseModel):
4848 fully_qualified_domain_name : Optional [str ] = None
4949
5050
51+ class CollectDeadlocks (BaseModel ):
52+ model_config = ConfigDict (
53+ arbitrary_types_allowed = True ,
54+ frozen = True ,
55+ )
56+ collection_interval : Optional [float ] = None
57+ enabled : Optional [bool ] = None
58+ max_deadlocks : Optional [float ] = None
59+
60+
5161class CollectRawQueryStatement (BaseModel ):
5262 model_config = ConfigDict (
5363 arbitrary_types_allowed = True ,
@@ -56,6 +66,16 @@ class CollectRawQueryStatement(BaseModel):
5666 enabled : Optional [bool ] = None
5767
5868
69+ class CollectSchemas (BaseModel ):
70+ model_config = ConfigDict (
71+ arbitrary_types_allowed = True ,
72+ frozen = True ,
73+ )
74+ collection_interval : Optional [float ] = None
75+ enabled : Optional [bool ] = None
76+ max_execution_time : Optional [float ] = None
77+
78+
5979class CollectSettings (BaseModel ):
6080 model_config = ConfigDict (
6181 arbitrary_types_allowed = True ,
@@ -65,6 +85,36 @@ class CollectSettings(BaseModel):
6585 enabled : Optional [bool ] = None
6686
6787
88+ class QueryCompletions (BaseModel ):
89+ model_config = ConfigDict (
90+ arbitrary_types_allowed = True ,
91+ frozen = True ,
92+ )
93+ collection_interval : Optional [float ] = Field (None , examples = [10 ])
94+ enabled : Optional [bool ] = Field (None , examples = [False ])
95+ max_events : Optional [int ] = Field (None , examples = [1000 ])
96+
97+
98+ class QueryErrors (BaseModel ):
99+ model_config = ConfigDict (
100+ arbitrary_types_allowed = True ,
101+ frozen = True ,
102+ )
103+ collection_interval : Optional [float ] = Field (None , examples = [10 ])
104+ enabled : Optional [bool ] = Field (None , examples = [False ])
105+ max_events : Optional [int ] = Field (None , examples = [1000 ])
106+
107+
108+ class CollectXe (BaseModel ):
109+ model_config = ConfigDict (
110+ arbitrary_types_allowed = True ,
111+ frozen = True ,
112+ )
113+ debug_sample_events : Optional [int ] = None
114+ query_completions : Optional [QueryCompletions ] = None
115+ query_errors : Optional [QueryErrors ] = None
116+
117+
68118class CustomQuery (BaseModel ):
69119 model_config = ConfigDict (
70120 arbitrary_types_allowed = True ,
@@ -357,26 +407,6 @@ class SchemasCollection(BaseModel):
357407 max_execution_time : Optional [float ] = None
358408
359409
360- class QueryCompletions (BaseModel ):
361- model_config = ConfigDict (
362- arbitrary_types_allowed = True ,
363- frozen = True ,
364- )
365- collection_interval : Optional [float ] = Field (None , examples = [10 ])
366- enabled : Optional [bool ] = Field (None , examples = [False ])
367- max_events : Optional [int ] = Field (None , examples = [1000 ])
368-
369-
370- class QueryErrors (BaseModel ):
371- model_config = ConfigDict (
372- arbitrary_types_allowed = True ,
373- frozen = True ,
374- )
375- collection_interval : Optional [float ] = Field (None , examples = [10 ])
376- enabled : Optional [bool ] = Field (None , examples = [False ])
377- max_events : Optional [int ] = Field (None , examples = [1000 ])
378-
379-
380410class XeCollection (BaseModel ):
381411 model_config = ConfigDict (
382412 arbitrary_types_allowed = True ,
@@ -400,8 +430,11 @@ class InstanceConfig(BaseModel):
400430 autodiscovery_include : Optional [tuple [str , ...]] = None
401431 aws : Optional [Aws ] = None
402432 azure : Optional [Azure ] = None
433+ collect_deadlocks : Optional [CollectDeadlocks ] = None
403434 collect_raw_query_statement : Optional [CollectRawQueryStatement ] = None
435+ collect_schemas : Optional [CollectSchemas ] = None
404436 collect_settings : Optional [CollectSettings ] = None
437+ collect_xe : Optional [CollectXe ] = None
405438 command_timeout : Optional [int ] = None
406439 connection_string : Optional [str ] = None
407440 connector : Optional [str ] = None
@@ -448,6 +481,12 @@ class InstanceConfig(BaseModel):
448481 username : Optional [str ] = None
449482 xe_collection : Optional [XeCollection ] = None
450483
484+ @model_validator (mode = 'before' )
485+ def _handle_deprecations (cls , values , info ):
486+ fields = info .context ['configured_fields' ]
487+ validation .utils .handle_deprecations ('instances' , deprecations .instance (), fields , info .context )
488+ return values
489+
451490 @model_validator (mode = 'before' )
452491 def _initial_validation (cls , values ):
453492 return validation .core .initialize_config (getattr (validators , 'initialize_instance' , identity )(values ))
0 commit comments