Created
June 18, 2023 16:44
-
-
Save stand-sure/5148790e26b745bcec3d7a385f07dd22 to your computer and use it in GitHub Desktop.
nextjs prometheus metrics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {collectDefaultMetrics, register} from 'prom-client'; | |
collectDefaultMetrics({ register }); | |
export async function GET() { | |
const metrics : string = await register.metrics(); | |
return new Response(metrics, { | |
status: 200, | |
headers: { | |
"Content-Type": register.contentType, | |
}, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment