Skip to content

Large prometheus scrape body uses a lot of memory #1000

@yawkat

Description

@yawkat

Issue description

This code transforms the entire meter registry into a String for the scrape endpoint. If there are a lot of metrics, this can use a bunch of memory. Additionally, micronaut-http-server-netty allocates a buffer for the full string, which is slow for multi-MB strings.

It would be better to stream the response using the scrape(OutputStream) method. I don't think it's a straight-forward change though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions