MCPcopy
hub / github.com/OneUptime/oneuptime / parseRedisInfoValue

Function parseRedisInfoValue

App/API/AdminHealth.ts:215–227  ·  view source on GitHub ↗
(info: string, key: string)

Source from the content-addressed store, hash-verified

213
214// Read a single integer field out of the Redis INFO memory section.
215function parseRedisInfoValue(info: string, key: string): number | null {
216 const line: string | undefined = info
217 .split(/\r?\n/)
218 .find((current: string): boolean => {
219 return current.startsWith(`${key}:`);
220 });
221
222 if (!line) {
223 return null;
224 }
225
226 return toNumberOrNull(line.split(":")[1]);
227}
228
229async function getRedisStats(): Promise<JSONObject> {
230 const result: JSONObject = {

Callers 1

getRedisStatsFunction · 0.85

Calls 3

findMethod · 0.80
startsWithMethod · 0.80
toNumberOrNullFunction · 0.70

Tested by

no test coverage detected