001package io.prometheus.metrics.exporter.opentelemetry.otelmodel; 002 003import io.opentelemetry.api.common.Attributes; 004import io.opentelemetry.sdk.metrics.data.DoubleExemplarData; 005import io.opentelemetry.sdk.metrics.data.SummaryPointData; 006import io.opentelemetry.sdk.metrics.data.ValueAtQuantile; 007import java.util.ArrayList; 008import java.util.List; 009 010public class SummaryPointDataImpl extends PointDataImpl implements SummaryPointData { 011 private final double sum; 012 private final long count; 013 private final List<ValueAtQuantile> values; 014 015 public SummaryPointDataImpl( 016 double sum, 017 long count, 018 long startEpochNanos, 019 long epochNanos, 020 Attributes attributes, 021 List<DoubleExemplarData> exemplars) { 022 super(startEpochNanos, epochNanos, attributes, exemplars); 023 this.sum = sum; 024 this.count = count; 025 this.values = new ArrayList<>(); 026 } 027 028 void addValue(double quantile, double value) { 029 values.add(new ValueAtQuantileImpl(quantile, value)); 030 } 031 032 @Override 033 public long getCount() { 034 return count; 035 } 036 037 @Override 038 public double getSum() { 039 return sum; 040 } 041 042 @Override 043 public List<ValueAtQuantile> getValues() { 044 return values; 045 } 046}