|
@@ -191,27 +191,64 @@ public class GetFlamegraphResponse extends ActionResponse implements ChunkedToXC
|
|
|
ChunkedToXContentHelper.array("ExeFilename", Iterators.map(fileNames.iterator(), e -> (b, p) -> b.value(e))),
|
|
|
ChunkedToXContentHelper.array("AddressOrLine", Iterators.map(addressOrLines.iterator(), e -> (b, p) -> b.value(e))),
|
|
|
ChunkedToXContentHelper.array("FunctionName", Iterators.map(functionNames.iterator(), e -> (b, p) -> b.value(e))),
|
|
|
- ChunkedToXContentHelper.array("FunctionOffset", Iterators.map(functionOffsets.iterator(), e -> (b, p) -> b.value(e))),
|
|
|
+ ChunkedToXContentHelper.singleChunk((b, p) -> {
|
|
|
+ b.startArray("FunctionOffset");
|
|
|
+ for (int functionOffset : functionOffsets) {
|
|
|
+ b.value(functionOffset);
|
|
|
+ }
|
|
|
+ return b.endArray();
|
|
|
+ }),
|
|
|
ChunkedToXContentHelper.array("SourceFilename", Iterators.map(sourceFileNames.iterator(), e -> (b, p) -> b.value(e))),
|
|
|
- ChunkedToXContentHelper.array("SourceLine", Iterators.map(sourceLines.iterator(), e -> (b, p) -> b.value(e))),
|
|
|
- ChunkedToXContentHelper.array("CountInclusive", Iterators.map(countInclusive.iterator(), e -> (b, p) -> b.value(e))),
|
|
|
- ChunkedToXContentHelper.array("CountExclusive", Iterators.map(countExclusive.iterator(), e -> (b, p) -> b.value(e))),
|
|
|
- ChunkedToXContentHelper.array(
|
|
|
- "AnnualCO2TonsInclusive",
|
|
|
- Iterators.map(annualCO2TonsInclusive.iterator(), e -> (b, p) -> b.value(e))
|
|
|
- ),
|
|
|
- ChunkedToXContentHelper.array(
|
|
|
- "AnnualCO2TonsExclusive",
|
|
|
- Iterators.map(annualCO2TonsExclusive.iterator(), e -> (b, p) -> b.value(e))
|
|
|
- ),
|
|
|
- ChunkedToXContentHelper.array(
|
|
|
- "AnnualCostsUSDInclusive",
|
|
|
- Iterators.map(annualCostsUSDInclusive.iterator(), e -> (b, p) -> b.value(e))
|
|
|
- ),
|
|
|
- ChunkedToXContentHelper.array(
|
|
|
- "AnnualCostsUSDExclusive",
|
|
|
- Iterators.map(annualCostsUSDExclusive.iterator(), e -> (b, p) -> b.value(e))
|
|
|
- ),
|
|
|
+ ChunkedToXContentHelper.singleChunk((b, p) -> {
|
|
|
+ b.startArray("SourceLine");
|
|
|
+ for (int sourceLine : sourceLines) {
|
|
|
+ b.value(sourceLine);
|
|
|
+ }
|
|
|
+ return b.endArray();
|
|
|
+ }),
|
|
|
+ ChunkedToXContentHelper.singleChunk((b, p) -> {
|
|
|
+ b.startArray("CountInclusive");
|
|
|
+ for (long countInclusive : countInclusive) {
|
|
|
+ b.value(countInclusive);
|
|
|
+ }
|
|
|
+ return b.endArray();
|
|
|
+ }),
|
|
|
+ ChunkedToXContentHelper.singleChunk((b, p) -> {
|
|
|
+ b.startArray("CountExclusive");
|
|
|
+ for (long c : countExclusive) {
|
|
|
+ b.value(c);
|
|
|
+ }
|
|
|
+ return b.endArray();
|
|
|
+ }),
|
|
|
+ ChunkedToXContentHelper.singleChunk((b, p) -> {
|
|
|
+ b.startArray("AnnualCO2TonsInclusive");
|
|
|
+ for (double co2Tons : annualCO2TonsInclusive) {
|
|
|
+ // write as raw value - we need direct control over the output representation (here: limit to 4 decimal places)
|
|
|
+ b.rawValue(NumberUtils.doubleToString(co2Tons));
|
|
|
+ }
|
|
|
+ return b.endArray();
|
|
|
+ }),
|
|
|
+ ChunkedToXContentHelper.singleChunk((b, p) -> {
|
|
|
+ b.startArray("AnnualCO2TonsExclusive");
|
|
|
+ for (double co2Tons : annualCO2TonsExclusive) {
|
|
|
+ b.rawValue(NumberUtils.doubleToString(co2Tons));
|
|
|
+ }
|
|
|
+ return b.endArray();
|
|
|
+ }),
|
|
|
+ ChunkedToXContentHelper.singleChunk((b, p) -> {
|
|
|
+ b.startArray("AnnualCostsUSDInclusive");
|
|
|
+ for (double costs : annualCostsUSDInclusive) {
|
|
|
+ b.rawValue(NumberUtils.doubleToString(costs));
|
|
|
+ }
|
|
|
+ return b.endArray();
|
|
|
+ }),
|
|
|
+ ChunkedToXContentHelper.singleChunk((b, p) -> {
|
|
|
+ b.startArray("AnnualCostsUSDExclusive");
|
|
|
+ for (double costs : annualCostsUSDExclusive) {
|
|
|
+ b.rawValue(NumberUtils.doubleToString(costs));
|
|
|
+ }
|
|
|
+ return b.endArray();
|
|
|
+ }),
|
|
|
Iterators.single((b, p) -> b.field("Size", size)),
|
|
|
Iterators.single((b, p) -> b.field("SamplingRate", samplingRate)),
|
|
|
Iterators.single((b, p) -> b.field("SelfCPU", selfCPU)),
|