async function getProfilingData()

in middleware/controllers/pyroscope.js [44:68]


async function getProfilingData(req, res) {
    const { query, from = "now-5m", until = "now", format = "json" } = req.body;
    const baseUrl = buildUrl(getEnv("PYROSCOPE_BASE_URL"), {
        query: `${query}.cpu`,
        from: from,
        until: until,
        format: format,
    });

    const config = {
        method: 'get',
        maxBodyLength: Infinity,
        url: baseUrl,
    };

    try {
        const response = await axios.request(config);
        return res.send(response.data);
    } catch (error) {
        logger.error(error);
        return res.status(500).send({
            error: error.message || "An error occurred while fetching profiling data",
        });
    }
}