Ejemplo n.º 1
0
def run(m2ee):
    metrics_interval = os.getenv("METRICS_INTERVAL")
    if metrics_interval:
        if util.is_free_app():
            thread = FreeAppsMetricsEmitterThread(int(metrics_interval), m2ee)
        else:
            thread = PaidAppsMetricsEmitterThread(int(metrics_interval), m2ee)
        thread.setDaemon(True)
        thread.start()
    else:
        logging.info("MENDIX-INTERNAL: Metrics are disabled.")
Ejemplo n.º 2
0
def configure_metrics_registry(m2ee):
    """Add custom environment variables to runtime.

    This ensures runtime micrometer sends metrics to telegraf.
    """
    if not micrometer_metrics_enabled(runtime.get_runtime_version()):
        return []

    logging.info(
        "Configuring runtime to push metrics to influx via micrometer")
    if util.is_free_app():
        return FREEAPPS_METRICS_REGISTRY

    paidapps_registries = [INFLUX_REGISTRY]

    if (datadog.is_enabled() or get_appmetrics_target()
            or appdynamics.machine_agent_enabled()):
        paidapps_registries.append(STATSD_REGISTRY)

    return paidapps_registries