blob: 6c94de4914061788e6e430e41e9e3fab5fecc647 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.metricsproxy.http.yamas;
import ai.vespa.metricsproxy.metric.model.MetricsPacket;
import ai.vespa.metricsproxy.metric.model.json.YamasJsonUtil;
import com.yahoo.container.jdisc.HttpResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
/**
* @author olaa
*/
public class YamasResponse extends HttpResponse {
private final List<MetricsPacket> metrics;
public YamasResponse(int code, List<MetricsPacket> metrics) {
super(code);
this.metrics = metrics;
}
@Override
public String getContentType() {
return "application/json";
}
@Override
public void render(OutputStream outputStream) throws IOException {
YamasJsonUtil.toJson(metrics, outputStream, false);
}
}
|