Metrics.h 1.0 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.
 ******************************************************************************/
#pragma once

#include "utils/Error.h"
#include <memory>
#include <vector>


Y
yu yunfeng 已提交
13
#pragma once
Y
yu yunfeng 已提交
14

Y
yu yunfeng 已提交
15 16
#include "MetricBase.h"
//#include "PrometheusMetrics.h"
Y
yu yunfeng 已提交
17 18 19 20 21

namespace zilliz {
namespace vecwise {
namespace server {

Y
yu yunfeng 已提交
22 23 24
#define METRICS_NOW_TIME std::chrono::system_clock::now()
//#define server::Metrics::GetInstance() server::Metrics::GetInstance()
#define METRICS_MICROSECONDS(a, b) (std::chrono::duration_cast<std::chrono::microseconds> (b-a)).count();
Y
yu yunfeng 已提交
25

Y
yu yunfeng 已提交
26
enum class MetricCollectorType {
Y
yu yunfeng 已提交
27 28 29 30 31
    INVALID,
    PROMETHEUS,
    ZABBIX
};

Y
yu yunfeng 已提交
32
class Metrics {
Y
yu yunfeng 已提交
33
 public:
Y
yu yunfeng 已提交
34 35
    static MetricsBase &
    CreateMetricsCollector(MetricCollectorType collector_type);
Y
yu yunfeng 已提交
36

Y
yu yunfeng 已提交
37 38
    static MetricsBase &
    GetInstance();
Y
yu yunfeng 已提交
39 40 41 42 43 44 45 46 47 48
};



}
}
}