MCPcopy Create free account
hub / github.com/apache/trafficserver / createStat

Function createStat

plugins/prefetch/fetch.cc:98–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98static bool
99createStat(const String &prefix, const String &space, const char *module, const char *statName,
100 TSRecordDataType /* statType ATS_UNUSED */, int &statId)
101{
102 String name(prefix);
103 name.append(".").append(space);
104 if (nullptr != module) {
105 name.append(".").append(module);
106 }
107 name.append(".").append(statName);
108
109 if (TSStatFindName(name.c_str(), &statId) == TS_ERROR) {
110 statId = TSStatCreate(name.c_str(), TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM);
111 if (statId == TS_ERROR) {
112 PrefetchError("failed to register '%s'", name.c_str());
113 return false;
114 }
115
116 TSStatIntSet(statId, 0);
117 }
118
119 PrefetchDebug("created metric '%s (id:%d)'", name.c_str(), statId);
120
121 return true;
122}
123
124BgFetchState::BgFetchState()
125{

Callers 1

initializeMetricsFunction · 0.85

Calls 5

TSStatFindNameFunction · 0.85
TSStatCreateFunction · 0.85
TSStatIntSetFunction · 0.85
appendMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected