io.opentelemetry.sdk.metrics.internal.data.ImmutableGaugeData Maven / Gradle / Ivy
The newest version!
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.sdk.metrics.internal.data;
import com.google.auto.value.AutoValue;
import io.opentelemetry.sdk.metrics.data.DoublePointData;
import io.opentelemetry.sdk.metrics.data.GaugeData;
import io.opentelemetry.sdk.metrics.data.PointData;
import java.util.Collection;
import java.util.Collections;
import javax.annotation.concurrent.Immutable;
/**
* {@link GaugeData} recorded uses {@code double}s.
*
* This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
@Immutable
@AutoValue
public abstract class ImmutableGaugeData implements GaugeData {
private static final ImmutableGaugeData EMPTY =
ImmutableGaugeData.create(Collections.emptyList());
// Type doesn't matter for an empty list.
@SuppressWarnings("unchecked")
public static ImmutableGaugeData empty() {
return (ImmutableGaugeData) EMPTY;
}
public static ImmutableGaugeData create(Collection points) {
return new AutoValue_ImmutableGaugeData<>(points);
}
ImmutableGaugeData() {}
@Override
public abstract Collection getPoints();
}