diff --git a/pyroscope/json_parsers.js b/pyroscope/json_parsers.js index 48d8e27a..a1b8ed23 100644 --- a/pyroscope/json_parsers.js +++ b/pyroscope/json_parsers.js @@ -37,6 +37,18 @@ const labelNames = async (req, payload) => { } } +const labelValues = async (req, payload) => { + req.type = 'json' + let body = await bufferize(payload) + body = JSON.parse(body.toString()) + return { + getName: () => body.name, + getMatchers: () => body.matchers, + getStart: () => body.start, + getEnd: () => body.end + } +} + const analyzeQuery = async (req, payload) => { req.type = 'json' let body = await bufferize(payload) @@ -52,6 +64,7 @@ module.exports = { series, getProfileStats, labelNames, + labelValues, settingsGet, analyzeQuery } diff --git a/pyroscope/pyroscope.js b/pyroscope/pyroscope.js index 1ed58ec2..b47e5dde 100644 --- a/pyroscope/pyroscope.js +++ b/pyroscope/pyroscope.js @@ -488,6 +488,7 @@ module.exports.init = (fastify) => { series: jsonParsers.series, getProfileStats: jsonParsers.getProfileStats, labelNames: jsonParsers.labelNames, + labelValues: jsonParsers.labelValues, analyzeQuery: jsonParsers.analyzeQuery } for (const name of Object.keys(fns)) {