Skip to content

Commit

Permalink
support ADVANCED_PROFILES_MERGE_LIMIT limit
Browse files Browse the repository at this point in the history
  • Loading branch information
akvlad committed Jan 24, 2024
1 parent af0d7ac commit 8129c1a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyroscope/pyroscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ const selectMergeStacktraces = async (req, res) => {
Sql.Lte('timestamp_ns', new Sql.Raw(Math.floor(toTimeSec) + '000000000')),
new Sql.In('fingerprint', 'IN', idxSelect)
))
const profiles = await clickhouse.rawRequest(sqlReq.toString() + 'FORMAT RowBinary', null, DATABASE_NAME(), {
if (process.env.ADVANCED_PROFILES_MERGE_LIMIT) {
sqlReq.orderBy(['timestamp_ns', 'desc']).limit(parseInt(process.env.ADVANCED_PROFILES_MERGE_LIMIT))
}
const profiles = await clickhouse.rawRequest(sqlReq.toString() + ' FORMAT RowBinary', null, DATABASE_NAME(), {
responseType: 'arraybuffer'
})
const binData = Uint8Array.from(profiles.data)
Expand Down

0 comments on commit 8129c1a

Please sign in to comment.