当前位置: 首页>>代码示例>>Python>>正文


Python applicationinsights.TelemetryClient方法代码示例

本文整理汇总了Python中applicationinsights.TelemetryClient方法的典型用法代码示例。如果您正苦于以下问题:Python applicationinsights.TelemetryClient方法的具体用法?Python applicationinsights.TelemetryClient怎么用?Python applicationinsights.TelemetryClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在applicationinsights的用法示例。


在下文中一共展示了applicationinsights.TelemetryClient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_telemetry_client_with_processor

# 需要导入模块: import applicationinsights [as 别名]
# 或者: from applicationinsights import TelemetryClient [as 别名]
def get_telemetry_client_with_processor(
    key: str, channel: TelemetryChannel, telemetry_processor: TelemetryProcessor = None
) -> TelemetryClient:
    """Gets a telemetry client instance with a telemetry processor.

    :param key: instrumentation key
    :type key: str
    :param channel: Telemetry channel
    :type channel: TelemetryChannel
    :param telemetry_processor: use an existing telemetry processor from caller.
    :type telemetry_processor: TelemetryProcessor
    :return: a telemetry client with telemetry processor.
    :rtype: TelemetryClient
    """
    client = TelemetryClient(key, channel)
    processor = (
        telemetry_processor
        if telemetry_processor is not None
        else DjangoTelemetryProcessor()
    )
    client.add_telemetry_processor(processor)
    return client 
开发者ID:microsoft,项目名称:botbuilder-python,代码行数:24,代码来源:common.py

示例2: __init__

# 需要导入模块: import applicationinsights [as 别名]
# 或者: from applicationinsights import TelemetryClient [as 别名]
def __init__(self):
        try:
            self.telemetry = TelemetryClient(IKEY)
            if os.path.exists("telemetry.config"):
                config_file = open("telemetry.config", "r")
                if config_file.read() == "1":
                    self.enable_telemetry = True
                else:
                    self.enable_telemetry = False
            else:
                self.enable_telemetry = self._query_yes_no(PROMPT_TEXT)
                config_file = open("telemetry.config", "w")
                if self.enable_telemetry:
                    config_file.write("1")
                    self.telemetry.track_event("yes", {"device": DEVICE, "language": LANGUAGE})
                else:
                    config_file.write("0")
                    self.telemetry.context.location.ip = "0.0.0.0"
                    self.telemetry.track_event("no", {"device": DEVICE, "language": LANGUAGE})
            self.telemetry.flush()
        except:
            pass 
开发者ID:Azure-Samples,项目名称:iot-hub-python-raspberrypi-client-app,代码行数:24,代码来源:telemetry.py

示例3: _telemetry

# 需要导入模块: import applicationinsights [as 别名]
# 或者: from applicationinsights import TelemetryClient [as 别名]
def _telemetry(self) -> TelemetryClient:
        """Create the telemetry client."""
        if not self.ikey:
            sender = NullSender()
        else:
            sender = AsynchronousSender(self.endpoint)
        ikey = self.ikey or '00000000-0000-0000-0000-000000000000'
        queue = AsynchronousQueue(sender)
        context = TelemetryContext()
        context.instrumentation_key = ikey
        channel = TelemetryChannel(context, queue)
        return TelemetryClient(ikey, telemetry_channel=channel) 
开发者ID:microsoft,项目名称:agogosml,代码行数:14,代码来源:logger.py

示例4: build_vortex_telemetry_client

# 需要导入模块: import applicationinsights [as 别名]
# 或者: from applicationinsights import TelemetryClient [as 别名]
def build_vortex_telemetry_client(service_endpoint_uri):
    """
        Build vortex telemetry client.
    """
    vortex_sender = VortexSynchronousSender(service_endpoint_uri)
    sync_queue = SynchronousQueue(vortex_sender)
    channel = VortexTelemetryChannel(None, queue=sync_queue)

    client = TelemetryClient(INSTRUMENTATION_KEY, channel)

    enable(INSTRUMENTATION_KEY)
    return client 
开发者ID:dbcli,项目名称:mssql-cli,代码行数:14,代码来源:telemetry_upload.py


注:本文中的applicationinsights.TelemetryClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。