| 350 | } |
| 351 | |
| 352 | void handleErrorStatItem(struct RedisModuleCtx *ctx, std::string name, std::string rest) { |
| 353 | size_t idx = rest.find('='); |
| 354 | if (idx != std::string::npos) { |
| 355 | std::string statValue = rest.substr(idx + 1); |
| 356 | long long val = strtoll(statValue.c_str(), nullptr, 10); |
| 357 | g_stats->gauge(name, val); |
| 358 | RedisModule_Log(ctx, REDISMODULE_LOGLEVEL_DEBUG, "Emitting metric \"%s\": %lld", name.c_str(), val); |
| 359 | } else { |
| 360 | RedisModule_Log(ctx, REDISMODULE_LOGLEVEL_WARNING, "Unexpected errorstat line format returned by \"INFO\" command: \"%s\"", (name + rest).c_str()); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | void handleReplicaOrDbInfoItem(struct RedisModuleCtx *ctx, std::string name, std::string rest) { |
| 365 | //use a stringstream to extract each metric of the form <name>=<value> |
no test coverage detected