All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.vespa.metricsproxy.http.PrometheusResponse Maven / Gradle / Ivy

There is a newer version: 8.458.13
Show newest version
package ai.vespa.metricsproxy.http;

import ai.vespa.metricsproxy.metric.model.prometheus.PrometheusModel;
import com.yahoo.container.jdisc.HttpResponse;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;

/**
 * @author jonmv
 */
public class PrometheusResponse extends HttpResponse {

    private final PrometheusModel model;

    public PrometheusResponse(int status, PrometheusModel model) {
        super(status);
        this.model = model;
    }

    @Override
    public void render(OutputStream outputStream) throws IOException {
        Writer writer = new OutputStreamWriter(outputStream);
        model.serialize(writer);
        writer.flush();
    }

    @Override
    public long maxPendingBytes() {
        return 1 << 20;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy