|
10 | 10 | import io.opentelemetry.proto.common.v1.InstrumentationScope; |
11 | 11 | import io.opentelemetry.proto.common.v1.KeyValue; |
12 | 12 | import io.opentelemetry.proto.metrics.v1.AggregationTemporality; |
13 | | -import io.opentelemetry.proto.metrics.v1.Metric; |
14 | 13 | import io.opentelemetry.proto.metrics.v1.SummaryDataPoint; |
15 | 14 | import io.opentelemetry.proto.resource.v1.Resource; |
16 | 15 |
|
@@ -201,26 +200,28 @@ public void testSummary() throws Exception { |
201 | 200 | Resource resource = Resource.newBuilder().build(); |
202 | 201 | InstrumentationScope scope = InstrumentationScope.newBuilder().build(); |
203 | 202 |
|
204 | | - SummaryDataPoint dataPoint = SummaryDataPoint.newBuilder() |
205 | | - .setTimeUnixNano(timestamp) |
206 | | - .setStartTimeUnixNano(startTimestamp) |
207 | | - .setCount(1) |
208 | | - .setSum(42.0) |
209 | | - .addAllAttributes(mappingHints(MappingHints.DOC_COUNT)) |
210 | | - .build(); |
211 | | - Metric metric = createSummaryMetric("summary", "", List.of()); |
212 | | - List<DataPoint> dataPoints = List.of(new DataPoint.Summary(dataPoint, metric)); |
213 | | - |
214 | 203 | DataPointGroupingContext.DataPointGroup dataPointGroup = new DataPointGroupingContext.DataPointGroup( |
215 | 204 | resource, |
216 | 205 | null, |
217 | 206 | scope, |
218 | 207 | null, |
219 | 208 | List.of(), |
220 | 209 | "", |
221 | | - dataPoints, |
222 | 210 | "metrics-generic.otel-default" |
223 | 211 | ); |
| 212 | + dataPointGroup.addDataPoint( |
| 213 | + Set.of(), |
| 214 | + new DataPoint.Summary( |
| 215 | + SummaryDataPoint.newBuilder() |
| 216 | + .setTimeUnixNano(timestamp) |
| 217 | + .setStartTimeUnixNano(startTimestamp) |
| 218 | + .setCount(1) |
| 219 | + .setSum(42.0) |
| 220 | + .addAllAttributes(mappingHints(MappingHints.DOC_COUNT)) |
| 221 | + .build(), |
| 222 | + createSummaryMetric("summary", "", List.of()) |
| 223 | + ) |
| 224 | + ); |
224 | 225 |
|
225 | 226 | XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); |
226 | 227 | HashMap<String, String> dynamicTemplates = documentBuilder.buildMetricDocument(builder, dataPointGroup); |
|
0 commit comments