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

Method create_stat

plugins/cache_promote/policy.cc:39–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39int
40PromotionPolicy::create_stat(std::string_view name, std::string_view remap_identifier)
41{
42 int stat_id = -1;
43 swoc::LocalBufferWriter<MAX_STAT_LENGTH> stat_name;
44
45 stat_name.clear().restrict(1);
46 stat_name.print("plugin.{}.{}.{}", PLUGIN_NAME, remap_identifier, name);
47 stat_name.restore(1).write('\0');
48
49 if (TS_ERROR == TSStatFindName(stat_name.data(), &stat_id)) {
50 stat_id = TSStatCreate(stat_name.data(), TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM);
51 if (TS_ERROR == stat_id) {
52 DBG("error creating stat_name: %s", stat_name.data());
53 } else {
54 DBG("created stat_name: %s, stat_id: %d", stat_name.data(), stat_id);
55 }
56 }
57
58 return stat_id;
59}

Callers

nothing calls this directly

Calls 8

TSStatFindNameFunction · 0.85
TSStatCreateFunction · 0.85
restrictMethod · 0.45
clearMethod · 0.45
printMethod · 0.45
writeMethod · 0.45
restoreMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected