From 8d44a37f40b9088c1eb8e8b0e7e537fbebeab8c3 Mon Sep 17 00:00:00 2001 From: Anastasia Popova Date: Wed, 3 Nov 2021 10:01:49 +0300 Subject: [PATCH] Added TID to Telemetry initialization. (#8194) * Added TID to telemetry initialization. * Moved TID to separate file. --- model-optimizer/automation/package_BOM.txt | 1 + model-optimizer/mo/main.py | 7 ++++--- model-optimizer/mo/utils/check_ie_bindings.py | 3 ++- model-optimizer/mo/utils/telemetry_params.py | 6 ++++++ model-optimizer/mo/utils/telemetry_utils.py | 11 ++++++++++- 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 model-optimizer/mo/utils/telemetry_params.py diff --git a/model-optimizer/automation/package_BOM.txt b/model-optimizer/automation/package_BOM.txt index 9f61c68d961b36..dad585c2f43487 100644 --- a/model-optimizer/automation/package_BOM.txt +++ b/model-optimizer/automation/package_BOM.txt @@ -1079,6 +1079,7 @@ mo/utils/shape.py mo/utils/simple_proto_parser.py mo/utils/str_to.py mo/utils/summarize_graph.py +mo/utils/telemetry_params.py mo/utils/telemetry_stub.py mo/utils/telemetry_utils.py mo/utils/tensorboard_util.py diff --git a/model-optimizer/mo/main.py b/model-optimizer/mo/main.py index 60117df3baf9ef..c939d9523ed919 100644 --- a/model-optimizer/mo/main.py +++ b/model-optimizer/mo/main.py @@ -40,11 +40,12 @@ from mo.utils.model_analysis import AnalysisResults from mo.utils.utils import refer_to_faq_msg from mo.utils.telemetry_utils import send_params_info, send_framework_info -from mo.utils.version import get_version, get_simplified_mo_version, get_simplified_ie_version +from mo.utils.version import get_simplified_mo_version, get_simplified_ie_version from mo.utils.versions_checker import check_requirements # pylint: disable=no-name-in-module +from mo.utils.telemetry_utils import get_tid # pylint: disable=no-name-in-module,import-error -from ngraph.frontend import FrontEndManager, FrontEnd +from ngraph.frontend import FrontEndManager def replace_ext(name: str, old: str, new: str): @@ -425,7 +426,7 @@ def driver(argv: argparse.Namespace): def main(cli_parser: argparse.ArgumentParser, fem: FrontEndManager, framework: str): - telemetry = tm.Telemetry(app_name='Model Optimizer', app_version=get_simplified_mo_version()) + telemetry = tm.Telemetry(tid=get_tid(), app_name='Model Optimizer', app_version=get_simplified_mo_version()) telemetry.start_session('mo') telemetry.send_event('mo', 'version', get_simplified_mo_version()) try: diff --git a/model-optimizer/mo/utils/check_ie_bindings.py b/model-optimizer/mo/utils/check_ie_bindings.py index 43761981b1eee0..557aec24c4371c 100644 --- a/model-optimizer/mo/utils/check_ie_bindings.py +++ b/model-optimizer/mo/utils/check_ie_bindings.py @@ -22,10 +22,11 @@ except ImportError: import mo.utils.telemetry_stub as tm from mo.utils.error import classify_error_type +from telemetry_utils import get_tid def send_telemetry(mo_version: str, message: str, event_type: str): - t = tm.Telemetry(app_name='Version Checker', app_version=mo_version) + t = tm.Telemetry(tid=get_tid(), app_name='Version Checker', app_version=mo_version) # do not trigger new session if we are executing from the check from within the MO because it is actually not model # conversion run which we want to send if execution_type != 'mo': diff --git a/model-optimizer/mo/utils/telemetry_params.py b/model-optimizer/mo/utils/telemetry_params.py new file mode 100644 index 00000000000000..ab6ba41d6c08b2 --- /dev/null +++ b/model-optimizer/mo/utils/telemetry_params.py @@ -0,0 +1,6 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +telemetry_params = { + 'TID': "UA-17808594-29" +} diff --git a/model-optimizer/mo/utils/telemetry_utils.py b/model-optimizer/mo/utils/telemetry_utils.py index 37b96cda969de0..2ed899c66ff6fe 100644 --- a/model-optimizer/mo/utils/telemetry_utils.py +++ b/model-optimizer/mo/utils/telemetry_utils.py @@ -1,13 +1,15 @@ # Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -import numpy as np import argparse from collections import Counter +import numpy as np + from mo.front.common.partial_infer.utils import is_fully_defined, unmask_shape, int64_array from mo.graph.graph import Graph from mo.middle.pattern_match import for_graph_and_each_sub_graph_recursively from mo.utils.cli_parser import get_params_with_paths_list +from mo.utils.telemetry_params import telemetry_params try: import openvino_telemetry as tm @@ -89,3 +91,10 @@ def send_framework_info(framework: str): """ t = tm.Telemetry() t.send_event('mo', 'framework', framework) + + +def get_tid(): + """ + This function returns the ID of the database to send telemetry. + """ + return telemetry_params['TID']