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.ExponentialHistogramBuckets;
006import io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointData;
007import java.util.List;
008
009public class ExponentialHistogramPointDataImpl extends PointDataImpl
010    implements ExponentialHistogramPointData {
011
012  private final int scale;
013  private final double sum;
014  private final long count;
015  private final long zeroCount;
016  private final double min;
017  private final double max;
018
019  private final ExponentialHistogramBuckets positiveBuckets;
020  private final ExponentialHistogramBuckets negativeBuckets;
021
022  ExponentialHistogramPointDataImpl(
023      int scale,
024      double sum,
025      long count,
026      long zeroCount,
027      double min,
028      double max,
029      ExponentialHistogramBuckets positiveBuckets,
030      ExponentialHistogramBuckets negativeBuckets,
031      long startEpochNanos,
032      long epochNanos,
033      Attributes attributes,
034      List<DoubleExemplarData> exemplars) {
035    super(startEpochNanos, epochNanos, attributes, exemplars);
036    this.scale = scale;
037    this.sum = sum;
038    this.count = count;
039    this.zeroCount = zeroCount;
040    this.min = min;
041    this.max = max;
042    this.positiveBuckets = positiveBuckets;
043    this.negativeBuckets = negativeBuckets;
044  }
045
046  @Override
047  public int getScale() {
048    return scale;
049  }
050
051  @Override
052  public double getSum() {
053    return sum;
054  }
055
056  @Override
057  public long getCount() {
058    return count;
059  }
060
061  @Override
062  public long getZeroCount() {
063    return zeroCount;
064  }
065
066  @Override
067  public boolean hasMin() {
068    return !Double.isNaN(min);
069  }
070
071  @Override
072  public double getMin() {
073    return min;
074  }
075
076  @Override
077  public boolean hasMax() {
078    return !Double.isNaN(max);
079  }
080
081  @Override
082  public double getMax() {
083    return max;
084  }
085
086  @Override
087  public ExponentialHistogramBuckets getPositiveBuckets() {
088    return positiveBuckets;
089  }
090
091  @Override
092  public ExponentialHistogramBuckets getNegativeBuckets() {
093    return negativeBuckets;
094  }
095}