File tree Expand file tree Collapse file tree 5 files changed +8
-8
lines changed
Expand file tree Collapse file tree 5 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -866,6 +866,7 @@ class ExtractorConfig(ConfigModel):
866866 """
867867
868868 state_store : StateStoreConfig | None = None
869+ metrics : MetricsConfig | None = None
869870 log_handlers : list [LogHandlerConfig ] = Field (default_factory = _log_handler_default )
870871 retry_startup : bool = True
871872
Original file line number Diff line number Diff line change @@ -73,7 +73,6 @@ def my_task_function(self, task_context: TaskContext) -> None:
7373 ExtractorConfig ,
7474 LogConsoleHandlerConfig ,
7575 LogFileHandlerConfig ,
76- MetricsConfig ,
7776)
7877from cognite .extractorutils .unstable .core ._dto import (
7978 CogniteModel ,
@@ -118,13 +117,11 @@ def __init__(
118117 application_config : _T ,
119118 current_config_revision : ConfigRevision ,
120119 log_level_override : str | None = None ,
121- metrics_config : MetricsConfig | None = None ,
122120 ) -> None :
123121 self .connection_config = connection_config
124122 self .application_config = application_config
125123 self .current_config_revision : ConfigRevision = current_config_revision
126124 self .log_level_override = log_level_override
127- self .metrics_config = metrics_config
128125
129126
130127class Extractor (Generic [ConfigType ], CogniteLogger ):
@@ -162,7 +159,7 @@ def __init__(
162159
163160 self .connection_config = config .connection_config
164161 self .application_config = config .application_config
165- self .metrics_config = config .metrics_config
162+ self .metrics_config = config .application_config . metrics
166163 self .current_config_revision : ConfigRevision = config .current_config_revision
167164 self .log_level_override = config .log_level_override
168165
Original file line number Diff line number Diff line change @@ -249,7 +249,6 @@ def test_raw_state_store_integration(
249249@pytest .mark .parametrize ("metrics_type" , ["prometheus" , "cognite" ])
250250def test_extractor_with_metrics_pushers (connection_config : ConnectionConfig , metrics_type : str ) -> None :
251251 override_level = "INFO"
252- app_config = TestConfig (parameter_one = 1 , parameter_two = "a" )
253252 call_count = {"count" : 0 }
254253
255254 if metrics_type == "prometheus" :
@@ -293,12 +292,17 @@ def counting_push(self: CognitePusher) -> None:
293292
294293 original_push = pusher_cls ._push_to_server
295294
295+ app_config = TestConfig (
296+ parameter_one = 1 ,
297+ parameter_two = "a" ,
298+ metrics = metrics_config ,
299+ )
300+
296301 full_config = FullConfig (
297302 connection_config = connection_config ,
298303 application_config = app_config ,
299304 current_config_revision = 1 ,
300305 log_level_override = override_level ,
301- metrics_config = metrics_config ,
302306 )
303307 worker = get_checkin_worker (connection_config )
304308 extractor = TestExtractor (full_config , worker , metrics = TestMetrics )
Original file line number Diff line number Diff line change @@ -225,7 +225,6 @@ def test_reporting_errors(
225225 headers = {"cdf-version" : "alpha" },
226226 ).json ()["items" ]
227227 assert len (res ) == 1
228-
229228 assert res [0 ]["externalId" ] == err .external_id
230229 assert res [0 ]["startTime" ] == err .start_time
231230 assert res [0 ]["description" ] == err .description
Original file line number Diff line number Diff line change @@ -121,7 +121,6 @@ def cancel_after_delay() -> None:
121121 assert config .parameter_one == 123
122122 assert config .parameter_two == "abc"
123123
124- # There should be one error reported from initially attempting to run without a config
125124 errors = cognite_client .get (
126125 url = f"/api/v1/projects/{ cognite_client .config .project } /integrations/errors" ,
127126 params = {"integration" : connection_config .integration .external_id },
You can’t perform that action at this time.
0 commit comments