forked from trpc-group/trpc-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrpc_metrics_report.h
69 lines (56 loc) · 2.21 KB
/
trpc_metrics_report.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
//
// Tencent is pleased to support the open source community by making tRPC available.
//
// Copyright (C) 2023 THL A29 Limited, a Tencent company.
// All rights reserved.
//
// If you have downloaded a copy of the tRPC source code from Tencent,
// please note that tRPC source code is licensed under the Apache 2.0 License,
// A copy of the Apache 2.0 License is included in this file.
//
//
#pragma once
#include <string>
#include "trpc/metrics/metrics.h"
namespace trpc {
/// @brief Trpc metrics data for inter-module calls
struct TrpcModuleMetricsInfo {
/// Metrics plugin name. Specifies which plugin to report the data to.
std::string plugin_name;
/// Metrics data
ModuleMetricsInfo module_info;
};
/// @brief Trpc metrics data with single-dimensional attribute
struct TrpcSingleAttrMetricsInfo {
/// Metrics plugin name. Specifies which plugin to report the data to.
std::string plugin_name;
/// Metrics data
SingleAttrMetricsInfo single_attr_info;
};
/// @brief Trpc metrics data with multi-dimensional attributes
struct TrpcMultiAttrMetricsInfo {
/// Metrics plugin name. Specifies which plugin to report the data to.
std::string plugin_name;
/// Metrics data
MultiAttrMetricsInfo multi_attr_info;
};
/// @brief Metrics interfaces for user programing
namespace metrics {
/// @brief Report the trpc metrics data for inter-module calls
/// @param info metrics data
/// @return the reported result, where 0 indicates success and non-zero indicates failure
int ModuleReport(const TrpcModuleMetricsInfo& info);
int ModuleReport(TrpcModuleMetricsInfo&& info);
/// @brief Report the trpc metrics data with single-dimensional attribute
/// @param info metrics data
/// @return the reported result, where 0 indicates success and non-zero indicates failure
int SingleAttrReport(const TrpcSingleAttrMetricsInfo& info);
int SingleAttrReport(TrpcSingleAttrMetricsInfo&& info);
/// @brief Report the metrics data with multi-dimensional attributes
/// @param info metrics data
/// @return the reported result, where 0 indicates success and non-zero indicates failure
int MultiAttrReport(const TrpcMultiAttrMetricsInfo& info);
int MultiAttrReport(TrpcMultiAttrMetricsInfo&& info);
} // namespace metrics
} // namespace trpc