Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sdk/ml/azure-ai-ml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ See full SDK logging documentation with examples [here][sdk_logging_docs].

### Telemetry

The Azure ML Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK.
The Azure ML Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK in a Jupyter Notebook only.
<u>Telemetry will **not** be collected for any use of the Python SDK outside of a Jupyter Notebook.</u>

Telemetry data helps the SDK team understand how the SDK is used so it can be improved and the information about failures helps the team resolve problems and fix bugs.
The SDK telemetry feature is enabled by default. To opt out of the telemetry feature, set the AZUREML_SDKV2_TELEMETRY_OPTOUT environment variable to 1 or true.
The SDK telemetry feature is enabled by default for Jupyter Notebook usage. To opt out of the telemetry feature, set the AZUREML_SDKV2_TELEMETRY_OPTOUT environment variable to '1' or 'true'.

## Next steps

Expand Down
13 changes: 7 additions & 6 deletions sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from azure.ai.ml._restclient.v2022_10_01_preview import AzureMachineLearningWorkspaces as ServiceClient102022Preview
from azure.ai.ml._restclient.v2022_10_01 import AzureMachineLearningWorkspaces as ServiceClient102022
from azure.ai.ml._scope_dependent_operations import OperationConfig, OperationsContainer, OperationScope
from azure.ai.ml._telemetry.logging_handler import get_appinsights_log_handler
from azure.ai.ml._user_agent import USER_AGENT
from azure.ai.ml._utils._experimental import experimental
from azure.ai.ml._utils._http_utils import HttpPipeline
Expand Down Expand Up @@ -215,12 +216,12 @@ def __init__(
if registry_name:
properties.update({"registry_name": registry_name})

# user_agent = None
# if "user_agent" in kwargs:
# user_agent = kwargs.get("user_agent")
# app_insights_handler = get_appinsights_log_handler(user_agent, **{"properties": properties})
# app_insights_handler_kwargs = {"app_insights_handler": app_insights_handler}
app_insights_handler_kwargs = {}
user_agent = None
if "user_agent" in kwargs:
user_agent = kwargs.get("user_agent")

app_insights_handler = get_appinsights_log_handler(user_agent, **{"properties": properties})
app_insights_handler_kwargs = {"app_insights_handler": app_insights_handler}

base_url = _get_base_url_from_metadata(cloud_name=cloud_name, is_local_mfe=True)
self._base_url = base_url
Expand Down
16 changes: 8 additions & 8 deletions sdk/ml/azure-ai-ml/azure/ai/ml/_telemetry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

__path__ = __import__("pkgutil").extend_path(__path__, __name__)

# from .activity import ActivityType, log_activity, monitor_with_activity, monitor_with_telemetry_mixin
# from .logging_handler import AML_INTERNAL_LOGGER_NAMESPACE, get_appinsights_log_handler
from .activity import ActivityType, log_activity, monitor_with_activity, monitor_with_telemetry_mixin
from .logging_handler import AML_INTERNAL_LOGGER_NAMESPACE, get_appinsights_log_handler

__all__ = [
# "monitor_with_activity",
# "monitor_with_telemetry_mixin",
# "log_activity",
# "ActivityType",
# "get_appinsights_log_handler",
# "AML_INTERNAL_LOGGER_NAMESPACE",
"monitor_with_activity",
"monitor_with_telemetry_mixin",
"log_activity",
"ActivityType",
"get_appinsights_log_handler",
"AML_INTERNAL_LOGGER_NAMESPACE",
]
4 changes: 2 additions & 2 deletions sdk/ml/azure-ai-ml/azure/ai/ml/_telemetry/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

from marshmallow import ValidationError

from azure.ai.ml.exceptions import ErrorCategory, MlException
from azure.core.exceptions import HttpResponseError

from .._utils.utils import _is_user_error_from_exception_type, _is_user_error_from_status_code, _str_to_bool
from azure.ai.ml._utils.utils import _is_user_error_from_exception_type, _is_user_error_from_status_code, _str_to_bool
from azure.ai.ml.exceptions import ErrorCategory, MlException

# Get environment variable IS_IN_CI_PIPELINE to decide whether it's in CI test
IS_IN_CI_PIPELINE = _str_to_bool(os.environ.get("IS_IN_CI_PIPELINE", "False"))
Expand Down
Loading