| 37 | } |
| 38 | |
| 39 | int |
| 40 | PromotionPolicy::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 | } |
nothing calls this directly
no test coverage detected