Skip to content

Commit

Permalink
Merge pull request #557 from Cluas/feat-labelValues_support_json_format
Browse files Browse the repository at this point in the history
feat: labelValues support json format
  • Loading branch information
akvlad authored Aug 30, 2024
2 parents d8e30af + 14e5eb1 commit 5e1d223
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pyroscope/json_parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -52,6 +64,7 @@ module.exports = {
series,
getProfileStats,
labelNames,
labelValues,
settingsGet,
analyzeQuery
}
1 change: 1 addition & 0 deletions pyroscope/pyroscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 5e1d223

Please sign in to comment.