1010from functools import singledispatch
1111from itertools import product
1212from pathlib import Path
13- from typing import Any , Dict , Optional , Tuple , TypeVar , Union
13+ from typing import Any , Optional , Tuple , TypeVar , Union
1414
1515from azure .ai .ml ._azure_environments import (
1616 CloudArgumentKeys ,
4343 AzureMachineLearningWorkspaces as ServiceClientWorkspaceDataplane ,
4444)
4545from azure .ai .ml ._scope_dependent_operations import OperationConfig , OperationsContainer , OperationScope
46- from azure .ai .ml ._telemetry .logging_handler import get_appinsights_log_handler
46+ from azure .ai .ml ._telemetry .logging_handler import set_appinsights_distro
4747from azure .ai .ml ._user_agent import USER_AGENT
4848from azure .ai .ml ._utils ._experimental import experimental
4949from azure .ai .ml ._utils ._http_utils import HttpPipeline
@@ -278,12 +278,11 @@ def __init__(
278278
279279 user_agent = kwargs .get ("user_agent" , None )
280280
281- app_insights_handler : Tuple = get_appinsights_log_handler (
281+ set_appinsights_distro (
282282 user_agent ,
283283 ** {"properties" : properties },
284284 enable_telemetry = self ._operation_config .enable_telemetry ,
285285 )
286- app_insights_handler_kwargs : Dict [str , Tuple ] = {"app_insights_handler" : app_insights_handler }
287286
288287 base_url = _get_base_url_from_metadata (cloud_name = cloud_name , is_local_mfe = True )
289288 self ._base_url = base_url
@@ -292,7 +291,7 @@ def __init__(
292291 self ._operation_container = OperationsContainer ()
293292
294293 # kwargs related to operations alone not all kwargs passed to MLClient are needed by operations
295- ops_kwargs = app_insights_handler_kwargs
294+ ops_kwargs = {}
296295 if base_url :
297296 ops_kwargs ["enforce_https" ] = _is_https_url (base_url )
298297
@@ -479,7 +478,6 @@ def __init__(
479478 self ._credential ,
480479 requests_pipeline = self ._requests_pipeline ,
481480 dataplane_client = self ._service_client_workspace_dataplane ,
482- ** app_insights_handler_kwargs ,
483481 )
484482 self ._operation_container .add (AzureMLResourceType .WORKSPACE , self ._workspaces ) # type: ignore[arg-type]
485483
@@ -497,7 +495,6 @@ def __init__(
497495 self ._service_client_10_2022_preview ,
498496 self ._operation_container ,
499497 self ._credential ,
500- ** app_insights_handler_kwargs , # type: ignore[arg-type]
501498 )
502499 self ._operation_container .add (AzureMLResourceType .REGISTRY , self ._registries ) # type: ignore[arg-type]
503500
@@ -519,7 +516,6 @@ def __init__(
519516 self ._operation_config ,
520517 self ._service_client_08_2023_preview ,
521518 self ._service_client_04_2024_preview ,
522- ** app_insights_handler_kwargs , # type: ignore[arg-type]
523519 )
524520 self ._operation_container .add (AzureMLResourceType .COMPUTE , self ._compute )
525521 self ._datastores = DatastoreOperations (
@@ -545,7 +541,6 @@ def __init__(
545541 workspace_rg = self ._ws_rg ,
546542 workspace_sub = self ._ws_sub ,
547543 registry_reference = registry_reference ,
548- ** app_insights_handler_kwargs , # type: ignore[arg-type]
549544 )
550545 # Evaluators
551546 self ._evaluators = EvaluatorOperations (
@@ -563,7 +558,6 @@ def __init__(
563558 workspace_rg = self ._ws_rg ,
564559 workspace_sub = self ._ws_sub ,
565560 registry_reference = registry_reference ,
566- ** app_insights_handler_kwargs , # type: ignore[arg-type]
567561 )
568562
569563 self ._operation_container .add (AzureMLResourceType .MODEL , self ._models )
@@ -705,7 +699,6 @@ def __init__(
705699 self ._service_client_07_2024_preview ,
706700 self ._operation_container ,
707701 self ._credential ,
708- ** app_insights_handler_kwargs , # type: ignore[arg-type]
709702 )
710703
711704 self ._featuresets = FeatureSetOperations (
0 commit comments