diff --git a/src/vm-repair/azext_vm_repair/_validators.py b/src/vm-repair/azext_vm_repair/_validators.py index 08dff07ab57..1cb68485c04 100644 --- a/src/vm-repair/azext_vm_repair/_validators.py +++ b/src/vm-repair/azext_vm_repair/_validators.py @@ -4,7 +4,8 @@ # -------------------------------------------------------------------------------------------- from datetime import datetime -from json import loads +import json +from applicationinsights import TelemetryClient from re import match, search, findall from knack.log import get_logger from knack.util import CLIError @@ -14,21 +15,32 @@ from azure.cli.command_modules.resource._client_factory import _resource_client_factory from msrestazure.azure_exceptions import CloudError from msrestazure.tools import parse_resource_id, is_valid_resource_id +from opencensus.ext.azure.log_exporter import AzureLogHandler from .encryption_types import Encryption from .exceptions import AzCommandError from .repair_utils import ( _call_az_command, _get_repair_resource_tag, + _get_current_vmrepair_version, _fetch_encryption_settings, _resolve_api_version, check_extension_version, _check_existing_rg ) +# For test releases and testing +TEST_KEY = 'a6bdff92-33b5-426f-9123-33875d0ae98b' +PROD_KEY = '3e7130f2-759b-41d4-afb8-f1405d1d7ed9' + +tc = TelemetryClient(PROD_KEY) +tc.context.application.ver = _get_current_vmrepair_version() # pylint: disable=line-too-long, broad-except logger = get_logger(__name__) +logger.addHandler(AzureLogHandler( + connection_string='InstrumentationKey='+PROD_KEY) +) EXTENSION_NAME = 'vm-repair'