@@ -69,7 +69,7 @@ def my_task_function(self, task_context: TaskContext) -> None:
6969from typing_extensions import Self , assert_never
7070
7171from cognite .extractorutils ._inner_util import _resolve_log_level
72- from cognite .extractorutils .metrics import BaseMetrics , safe_get
72+ from cognite .extractorutils .metrics import BaseMetrics , MetricsType , safe_get
7373from cognite .extractorutils .statestore import (
7474 AbstractStateStore ,
7575 LocalStateStore ,
@@ -127,13 +127,13 @@ def __init__(
127127 application_config : _T ,
128128 current_config_revision : ConfigRevision ,
129129 log_level_override : str | None = None ,
130- metrics_class : type [BaseMetrics ] | None = None ,
130+ metrics_class : type [MetricsType ] | None = None ,
131131 ) -> None :
132132 self .connection_config = connection_config
133133 self .application_config = application_config
134134 self .current_config_revision : ConfigRevision = current_config_revision
135135 self .log_level_override = log_level_override
136- self .metrics_class : type [BaseMetrics ] | None = metrics_class
136+ self .metrics_class : type [MetricsType ] | None = metrics_class
137137
138138
139139class Extractor (Generic [ConfigType ], CogniteLogger ):
@@ -273,17 +273,15 @@ def _setup_logging(self) -> None:
273273 "Defaulted to console logging."
274274 )
275275
276- def _load_metrics (self , metrics_class : type [BaseMetrics ] | None = None ) -> BaseMetrics :
276+ def _load_metrics (self , metrics_class : type [MetricsType ] | None = None ) -> MetricsType | BaseMetrics :
277277 """
278278 Loads metrics based on the provided metrics class.
279279
280280 Reuses existing singleton if available to avoid Prometheus registry conflicts.
281281 """
282282 if metrics_class :
283- metrics_instance = safe_get (metrics_class )
284- else :
285- metrics_instance = safe_get (BaseMetrics , extractor_name = self .EXTERNAL_ID , extractor_version = self .VERSION )
286- return metrics_instance
283+ return safe_get (metrics_class )
284+ return safe_get (BaseMetrics , extractor_name = self .EXTERNAL_ID , extractor_version = self .VERSION )
287285
288286 def _load_state_store (self ) -> None :
289287 """
0 commit comments