MCPcopy Create free account
hub / github.com/ByConity/ByConity / getPartMetricKeyLabel

Function getPartMetricKeyLabel

src/Server/ServerPrometheusMetricsWriter.cpp:97–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97String getPartMetricKeyLabel(const String & database, const String & table, const String partition_id,
98 const String partition, const String first_partition = "", const String & type = "")
99{
100 String account_id = "";
101 String db_name = database;
102
103 size_t found = database.find_first_of(DB_NAME_DELIMITER);
104 if (found != std::string::npos)
105 {
106 account_id = database.substr(0, found);
107 db_name = database.substr(found + 1);
108 }
109
110 MetricLabels labels
111 {
112 {"account_id", account_id},
113 {"database", db_name},
114 {"table", table},
115 {"partition_id", partition_id},
116 {"partition", partition},
117 };
118
119 if (!type.empty())
120 {
121 labels.insert({"type", type});
122 }
123 else
124 {
125 labels.insert({"first_partition", first_partition});
126 }
127
128 return getLabel(labels);
129
130}
131
132void ServerPrometheusMetricsWriter::writeConfigMetrics(WriteBuffer & wb)
133{

Callers 1

writePartMetricsMethod · 0.85

Calls 3

getLabelFunction · 0.85
emptyMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected