MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / writeEvent

Function writeEvent

src/Server/PrometheusMetricsWriter.cpp:80–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78constexpr auto dimensional_metrics_prefix = "ClickHouseDimensionalMetrics_";
79
80void writeEvent(DB::WriteBuffer & wb, ProfileEvents::Event event)
81{
82 const auto counter = ProfileEvents::global_counters[event].load(std::memory_order_relaxed);
83
84 std::string metric_name{ProfileEvents::getName(static_cast<ProfileEvents::Event>(event))};
85 std::string metric_doc{ProfileEvents::getDocumentation(static_cast<ProfileEvents::Event>(event))};
86
87 convertHelpToSingleLine(metric_doc);
88
89 if (!replaceInvalidChars(metric_name))
90 return;
91
92 std::string key{profile_events_prefix + metric_name};
93
94 writeOutLine(wb, "# HELP", key, metric_doc);
95 writeOutLine(wb, "# TYPE", key, "counter");
96 writeOutLine(wb, key, counter);
97}
98
99void writeMetric(DB::WriteBuffer & wb, size_t metric)
100{

Callers 1

writeEventsMethod · 0.85

Calls 5

convertHelpToSingleLineFunction · 0.85
replaceInvalidCharsFunction · 0.85
writeOutLineFunction · 0.85
getNameFunction · 0.50
loadMethod · 0.45

Tested by

no test coverage detected