Skip to content

Commit

Permalink
feat: labelValues support json format
Browse files Browse the repository at this point in the history
  • Loading branch information
Cluas committed Aug 29, 2024
1 parent 73e86d8 commit 14e5eb1
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 14e5eb1

Please sign in to comment.