Metrics.cpp 1.3 KB
Newer Older
Y
yu yunfeng 已提交
1 2 3 4 5 6 7 8 9 10 11 12
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/

#include "Metrics.h"

namespace zilliz {
namespace vecwise {
namespace server {

Y
yu yunfeng 已提交
13 14 15 16 17 18 19 20 21
MetricsBase &
Metrics::CreateMetricsCollector(MetricCollectorType collector_type) {
    switch (collector_type) {
        case MetricCollectorType::PROMETHEUS:
//            static PrometheusMetrics instance = PrometheusMetrics::GetInstance();
            return MetricsBase::GetInstance();
        default:return MetricsBase::GetInstance();
    }
}
Y
yu yunfeng 已提交
22

Y
yu yunfeng 已提交
23 24 25 26 27 28 29 30 31 32 33
MetricsBase &
Metrics::GetInstance() {
    ConfigNode &config = ServerConfig::GetInstance().GetConfig(CONFIG_METRIC);
    std::string collector_typr_str = config.GetValue(CONFIG_METRIC_COLLECTOR);
    if (collector_typr_str == "prometheus") {
        return CreateMetricsCollector(MetricCollectorType::PROMETHEUS);
    } else if (collector_typr_str == "zabbix") {
        return CreateMetricsCollector(MetricCollectorType::ZABBIX);
    } else {
        return CreateMetricsCollector(MetricCollectorType::INVALID);
    }
Y
yu yunfeng 已提交
34 35 36 37 38
}

}
}
}