io.opentelemetry.instrumentation.kafka.internal.MetricsReporterList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opentelemetry-kafka-clients-common Show documentation
Show all versions of opentelemetry-kafka-clients-common Show documentation
Instrumentation of Java libraries using OpenTelemetry.
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.kafka.internal;
import java.util.ArrayList;
import java.util.List;
/**
* List implementation that can be used to hold metrics reporters in kafka configuration without
* breaking serialization. When this list is serialized it removes OpenTelemetryMetricsReporter to
* ensure that the configuration can be deserialized even when the instrumentation is not present.
*
* This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public class MetricsReporterList extends ArrayList {
private static final long serialVersionUID = 1L;
public static List singletonList(T o) {
List list = new MetricsReporterList<>();
list.add(o);
return list;
}
private Object writeReplace() {
// serialize to plain ArrayList that does not contain OpenTelemetryMetricsReporter
List