diff options
author | gjoranv <gv@verizonmedia.com> | 2019-08-27 11:44:41 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2019-08-27 16:21:01 +0200 |
commit | 3007317e7fcfc0bc11e41f878bb7e2a98bd9fbfc (patch) | |
tree | 6c99a1e82194399005a71493b46654bd5d1973d9 /metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/TextResponse.java | |
parent | b6a3f24a4a34002d1d49246d739921cc23e33564 (diff) |
Add Prometheus http api
Diffstat (limited to 'metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/TextResponse.java')
-rw-r--r-- | metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/TextResponse.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/TextResponse.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/TextResponse.java new file mode 100644 index 00000000000..7dfc232d253 --- /dev/null +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/http/TextResponse.java @@ -0,0 +1,31 @@ +/* + * Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + */ + +package ai.vespa.metricsproxy.http; + +import com.yahoo.container.jdisc.HttpResponse; + +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.Charset; + +/** + * @author yj-jtakagi + * @author gjoranv + */ +public class TextResponse extends HttpResponse { + + private final byte[] data; + + public TextResponse(int code, String data) { + super(code); + this.data = data.getBytes(Charset.forName(DEFAULT_CHARACTER_ENCODING)); + } + + @Override + public void render(OutputStream outputStream) throws IOException { + outputStream.write(data); + } + +} |