예제 #1
0
def setup_telemetry(key: str):
    """Setup telemetry.

    EH Forwarder Bot framework includes NO code that uploads your log
    or any other data to anywhere.

    To enable telemetry functionality, additional modules need to be
    installed manually, and explicit settings must be added in the configuration
    file. See :doc:`telemetry` for details.
    """

    if not isinstance(key, str):
        return

    if key not in (CAPTURE_EXCEPTIONS, CAPTURE_LOG, CAPTURE_LOG_ANALYSIS):
        return

    telemetry_config = {}
    if key in (CAPTURE_LOG, CAPTURE_LOG_ANALYSIS):
        telemetry_config.update({"sentry": {"enable": True, "capture_logs": True}})
    if key == CAPTURE_LOG_ANALYSIS:
        telemetry_config.update({
            "logz": {"enable": True},
            "loggly": {"enable": True},
            "logdna": {"enable": True}
        })

    global telemetry

    import telemetry_1a23
    telemetry_1a23.init('ehforwarderbot', telemetry_config)
    telemetry_1a23.set_metadata({"ehforwarderbot": __version__})

    telemetry = telemetry_1a23
예제 #2
0
def setup_telemetry(key: str):
    """Setup telemetry"""

    if not isinstance(key, str):
        return

    if key not in (CAPTURE_EXCEPTIONS, CAPTURE_LOG, CAPTURE_LOG_ANALYSIS):
        return

    telemetry_config = {}
    if key in (CAPTURE_LOG, CAPTURE_LOG_ANALYSIS):
        telemetry_config.update(
            {"sentry": {
                "enable": True,
                "capture_logs": True
            }})
    if key == CAPTURE_LOG_ANALYSIS:
        telemetry_config.update({
            "logz": {
                "enable": True
            },
            "loggly": {
                "enable": True
            },
            "logdna": {
                "enable": True
            }
        })

    global telemetry

    import telemetry_1a23
    telemetry_1a23.init('ehforwarderbot', telemetry_config)
    telemetry_1a23.set_metadata({"ehforwarderbot": __version__})

    telemetry = telemetry_1a23