diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/HandlerRegistry.java b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/HandlerRegistry.java index f55de1643ded..6de364065082 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/HandlerRegistry.java +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/HandlerRegistry.java @@ -10,7 +10,6 @@ import io.opentelemetry.api.metrics.MeterBuilder; import io.opentelemetry.instrumentation.api.internal.EmbeddedInstrumentationProperties; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.RecordedEventHandler; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.ThreadGrouper; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.buffer.DirectBufferStatisticsHandler; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.classes.ClassesLoadedHandler; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.container.ContainerConfigurationHandler; @@ -84,17 +83,16 @@ static List getHandlers( } } - ThreadGrouper grouper = new ThreadGrouper(); List basicHandlers = List.of( - new ObjectAllocationInNewTlabHandler(meter, grouper), - new ObjectAllocationOutsideTlabHandler(meter, grouper), - new NetworkReadHandler(meter, grouper), - new NetworkWriteHandler(meter, grouper), + new ObjectAllocationInNewTlabHandler(meter), + new ObjectAllocationOutsideTlabHandler(meter), + new NetworkReadHandler(meter), + new NetworkWriteHandler(meter), new ContextSwitchRateHandler(meter), new OverallCpuLoadHandler(meter), new ContainerConfigurationHandler(meter), - new LongLockHandler(meter, grouper), + new LongLockHandler(meter), new ThreadCountHandler(meter), new ClassesLoadedHandler(meter), new MetaspaceSummaryHandler(meter), diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/AbstractThreadDispatchingHandler.java b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/AbstractThreadDispatchingHandler.java deleted file mode 100644 index c18e92078bf6..000000000000 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/AbstractThreadDispatchingHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.instrumentation.runtimemetrics.java17.internal; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Consumer; -import jdk.jfr.consumer.RecordedEvent; - -/** - * This class is internal and is hence not for public use. Its APIs are unstable and can change at - * any time. - */ -public abstract class AbstractThreadDispatchingHandler implements RecordedEventHandler { - // Will need pruning code for fast-cycling thread frameworks to prevent memory leaks - private final Map> perThread = new HashMap<>(); - private final ThreadGrouper grouper; - - protected AbstractThreadDispatchingHandler(ThreadGrouper grouper) { - this.grouper = grouper; - } - - @Override - public abstract String getEventName(); - - public abstract Consumer createPerThreadSummarizer(String threadName); - - @Override - public void accept(RecordedEvent ev) { - String groupedName = grouper.groupedName(ev); - if (groupedName != null) { - perThread.computeIfAbsent(groupedName, this::createPerThreadSummarizer).accept(ev); - } - } -} diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/ThreadGrouper.java b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/ThreadGrouper.java deleted file mode 100644 index 6efc4c3e6ab8..000000000000 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/ThreadGrouper.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.instrumentation.runtimemetrics.java17.internal; - -import javax.annotation.Nullable; -import jdk.jfr.consumer.RecordedEvent; -import jdk.jfr.consumer.RecordedThread; - -/** - * This class is internal and is hence not for public use. Its APIs are unstable and can change at - * any time. - */ -public final class ThreadGrouper { - - // FIXME doesn't actually do any grouping, but should be safe for now - @Nullable - public String groupedName(RecordedEvent ev) { - Object thisField = ev.getValue("eventThread"); - if (thisField instanceof RecordedThread) { - return ((RecordedThread) thisField).getJavaName(); - } - return null; - } -} diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/cpu/LongLockHandler.java b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/cpu/LongLockHandler.java index 8eb26fc9f67b..b3dfad486887 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/cpu/LongLockHandler.java +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/cpu/LongLockHandler.java @@ -9,34 +9,34 @@ import io.opentelemetry.api.metrics.DoubleHistogram; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.instrumentation.runtimemetrics.java17.JfrFeature; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.AbstractThreadDispatchingHandler; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.Constants; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.DurationUtil; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.ThreadGrouper; +import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.RecordedEventHandler; import java.time.Duration; import java.util.Optional; -import java.util.function.Consumer; import jdk.jfr.consumer.RecordedEvent; /** * This class is internal and is hence not for public use. Its APIs are unstable and can change at * any time. */ -public final class LongLockHandler extends AbstractThreadDispatchingHandler { +public final class LongLockHandler implements RecordedEventHandler { private static final String METRIC_NAME = "jvm.cpu.longlock"; private static final String METRIC_DESCRIPTION = "Long lock times"; private static final String EVENT_NAME = "jdk.JavaMonitorWait"; private final DoubleHistogram histogram; + private final Attributes attributes; - public LongLockHandler(Meter meter, ThreadGrouper grouper) { - super(grouper); + public LongLockHandler(Meter meter) { histogram = meter .histogramBuilder(METRIC_NAME) .setDescription(METRIC_DESCRIPTION) .setUnit(Constants.SECONDS) .build(); + + attributes = Attributes.empty(); } @Override @@ -50,34 +50,17 @@ public JfrFeature getFeature() { } @Override - public Consumer createPerThreadSummarizer(String threadName) { - return new PerThreadLongLockHandler(histogram, threadName); + public void accept(RecordedEvent recordedEvent) { + histogram.record(DurationUtil.toSeconds(recordedEvent.getDuration()), attributes); + // What about the class name in MONITOR_CLASS ? + // We can get a stack trace from the thread on the event + // if (recordedEvent.hasField("eventThread")) { + // var eventThread = recordedEvent.getThread("eventThread"); + // } } @Override public Optional getThreshold() { return Optional.empty(); } - - private static class PerThreadLongLockHandler implements Consumer { - private static final String EVENT_THREAD = "eventThread"; - - private final DoubleHistogram histogram; - private final Attributes attributes; - - public PerThreadLongLockHandler(DoubleHistogram histogram, String threadName) { - this.histogram = histogram; - this.attributes = Attributes.of(Constants.ATTR_THREAD_NAME, threadName); - } - - @Override - public void accept(RecordedEvent recordedEvent) { - if (recordedEvent.hasField(EVENT_THREAD)) { - histogram.record(DurationUtil.toSeconds(recordedEvent.getDuration()), attributes); - } - // What about the class name in MONITOR_CLASS ? - // We can get a stack trace from the thread on the event - // var eventThread = recordedEvent.getThread(EVENT_THREAD); - } - } } diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/memory/ObjectAllocationInNewTlabHandler.java b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/memory/ObjectAllocationInNewTlabHandler.java index 224c113f99fe..c04de5bf944c 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/memory/ObjectAllocationInNewTlabHandler.java +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/memory/ObjectAllocationInNewTlabHandler.java @@ -9,10 +9,8 @@ import io.opentelemetry.api.metrics.LongHistogram; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.instrumentation.runtimemetrics.java17.JfrFeature; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.AbstractThreadDispatchingHandler; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.Constants; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.ThreadGrouper; -import java.util.function.Consumer; +import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.RecordedEventHandler; import jdk.jfr.consumer.RecordedEvent; /** @@ -22,13 +20,14 @@ *

This class is internal and is hence not for public use. Its APIs are unstable and can change * at any time. */ -public final class ObjectAllocationInNewTlabHandler extends AbstractThreadDispatchingHandler { +public final class ObjectAllocationInNewTlabHandler implements RecordedEventHandler { private static final String EVENT_NAME = "jdk.ObjectAllocationInNewTLAB"; + private static final String TLAB_SIZE = "tlabSize"; private final LongHistogram histogram; + private final Attributes attributes; - public ObjectAllocationInNewTlabHandler(Meter meter, ThreadGrouper grouper) { - super(grouper); + public ObjectAllocationInNewTlabHandler(Meter meter) { histogram = meter .histogramBuilder(Constants.METRIC_NAME_MEMORY_ALLOCATION) @@ -36,6 +35,7 @@ public ObjectAllocationInNewTlabHandler(Meter meter, ThreadGrouper grouper) { .setUnit(Constants.BYTES) .ofLongs() .build(); + attributes = Attributes.of(Constants.ATTR_ARENA_NAME, "TLAB"); } @Override @@ -49,29 +49,9 @@ public JfrFeature getFeature() { } @Override - public Consumer createPerThreadSummarizer(String threadName) { - return new PerThreadObjectAllocationInNewTlabHandler(histogram, threadName); - } - - /** This class aggregates all TLAB allocation JFR events for a single thread */ - private static class PerThreadObjectAllocationInNewTlabHandler - implements Consumer { - private static final String TLAB_SIZE = "tlabSize"; - - private final LongHistogram histogram; - private final Attributes attributes; - - public PerThreadObjectAllocationInNewTlabHandler(LongHistogram histogram, String threadName) { - this.histogram = histogram; - this.attributes = - Attributes.of(Constants.ATTR_THREAD_NAME, threadName, Constants.ATTR_ARENA_NAME, "TLAB"); - } - - @Override - public void accept(RecordedEvent ev) { - histogram.record(ev.getLong(TLAB_SIZE), attributes); - // Probably too high a cardinality - // ev.getClass("objectClass").getName(); - } + public void accept(RecordedEvent ev) { + histogram.record(ev.getLong(TLAB_SIZE), attributes); + // Probably too high a cardinality + // ev.getClass("objectClass").getName(); } } diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/memory/ObjectAllocationOutsideTlabHandler.java b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/memory/ObjectAllocationOutsideTlabHandler.java index 2929797b7d32..30dfc78c0126 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/memory/ObjectAllocationOutsideTlabHandler.java +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/memory/ObjectAllocationOutsideTlabHandler.java @@ -9,10 +9,8 @@ import io.opentelemetry.api.metrics.LongHistogram; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.instrumentation.runtimemetrics.java17.JfrFeature; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.AbstractThreadDispatchingHandler; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.Constants; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.ThreadGrouper; -import java.util.function.Consumer; +import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.RecordedEventHandler; import jdk.jfr.consumer.RecordedEvent; /** @@ -22,13 +20,14 @@ *

This class is internal and is hence not for public use. Its APIs are unstable and can change * at any time. */ -public final class ObjectAllocationOutsideTlabHandler extends AbstractThreadDispatchingHandler { +public final class ObjectAllocationOutsideTlabHandler implements RecordedEventHandler { private static final String EVENT_NAME = "jdk.ObjectAllocationOutsideTLAB"; + private static final String ALLOCATION_SIZE = "allocationSize"; private final LongHistogram histogram; + private final Attributes attributes; - public ObjectAllocationOutsideTlabHandler(Meter meter, ThreadGrouper grouper) { - super(grouper); + public ObjectAllocationOutsideTlabHandler(Meter meter) { histogram = meter .histogramBuilder(Constants.METRIC_NAME_MEMORY_ALLOCATION) @@ -36,6 +35,8 @@ public ObjectAllocationOutsideTlabHandler(Meter meter, ThreadGrouper grouper) { .setUnit(Constants.BYTES) .ofLongs() .build(); + + attributes = Attributes.of(Constants.ATTR_ARENA_NAME, "Main"); } @Override @@ -49,29 +50,9 @@ public JfrFeature getFeature() { } @Override - public Consumer createPerThreadSummarizer(String threadName) { - return new PerThreadObjectAllocationOutsideTlabHandler(histogram, threadName); - } - - /** This class aggregates all non-TLAB allocation JFR events for a single thread */ - private static class PerThreadObjectAllocationOutsideTlabHandler - implements Consumer { - private static final String ALLOCATION_SIZE = "allocationSize"; - - private final LongHistogram histogram; - private final Attributes attributes; - - public PerThreadObjectAllocationOutsideTlabHandler(LongHistogram histogram, String threadName) { - this.histogram = histogram; - this.attributes = - Attributes.of(Constants.ATTR_THREAD_NAME, threadName, Constants.ATTR_ARENA_NAME, "Main"); - } - - @Override - public void accept(RecordedEvent ev) { - histogram.record(ev.getLong(ALLOCATION_SIZE), attributes); - // Probably too high a cardinality - // ev.getClass("objectClass").getName(); - } + public void accept(RecordedEvent ev) { + histogram.record(ev.getLong(ALLOCATION_SIZE), attributes); + // Probably too high a cardinality + // ev.getClass("objectClass").getName(); } } diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/network/NetworkReadHandler.java b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/network/NetworkReadHandler.java index b1b1a6eee005..e84ca15a2315 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/network/NetworkReadHandler.java +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/network/NetworkReadHandler.java @@ -10,25 +10,24 @@ import io.opentelemetry.api.metrics.LongHistogram; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.instrumentation.runtimemetrics.java17.JfrFeature; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.AbstractThreadDispatchingHandler; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.Constants; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.DurationUtil; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.ThreadGrouper; -import java.util.function.Consumer; +import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.RecordedEventHandler; import jdk.jfr.consumer.RecordedEvent; /** * This class is internal and is hence not for public use. Its APIs are unstable and can change at * any time. */ -public final class NetworkReadHandler extends AbstractThreadDispatchingHandler { +public final class NetworkReadHandler implements RecordedEventHandler { private static final String EVENT_NAME = "jdk.SocketRead"; + private static final String BYTES_READ = "bytesRead"; private final LongHistogram bytesHistogram; private final DoubleHistogram durationHistogram; + private final Attributes attributes; - public NetworkReadHandler(Meter meter, ThreadGrouper nameNormalizer) { - super(nameNormalizer); + public NetworkReadHandler(Meter meter) { bytesHistogram = meter .histogramBuilder(Constants.METRIC_NAME_NETWORK_BYTES) @@ -42,6 +41,7 @@ public NetworkReadHandler(Meter meter, ThreadGrouper nameNormalizer) { .setDescription(Constants.METRIC_DESCRIPTION_NETWORK_DURATION) .setUnit(Constants.SECONDS) .build(); + attributes = Attributes.of(Constants.ATTR_NETWORK_MODE, Constants.NETWORK_MODE_READ); } @Override @@ -55,33 +55,8 @@ public JfrFeature getFeature() { } @Override - public Consumer createPerThreadSummarizer(String threadName) { - return new PerThreadNetworkReadHandler(bytesHistogram, durationHistogram, threadName); - } - - private static class PerThreadNetworkReadHandler implements Consumer { - private static final String BYTES_READ = "bytesRead"; - - private final LongHistogram bytesHistogram; - private final DoubleHistogram durationHistogram; - private final Attributes attributes; - - public PerThreadNetworkReadHandler( - LongHistogram bytesHistogram, DoubleHistogram durationHistogram, String threadName) { - this.bytesHistogram = bytesHistogram; - this.durationHistogram = durationHistogram; - this.attributes = - Attributes.of( - Constants.ATTR_THREAD_NAME, - threadName, - Constants.ATTR_NETWORK_MODE, - Constants.NETWORK_MODE_READ); - } - - @Override - public void accept(RecordedEvent ev) { - bytesHistogram.record(ev.getLong(BYTES_READ), attributes); - durationHistogram.record(DurationUtil.toSeconds(ev.getDuration()), attributes); - } + public void accept(RecordedEvent ev) { + bytesHistogram.record(ev.getLong(BYTES_READ), attributes); + durationHistogram.record(DurationUtil.toSeconds(ev.getDuration()), attributes); } } diff --git a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/network/NetworkWriteHandler.java b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/network/NetworkWriteHandler.java index 4de58802fdcf..8d0124ff4bcf 100644 --- a/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/network/NetworkWriteHandler.java +++ b/instrumentation/runtime-telemetry/runtime-telemetry-java17/library/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/internal/network/NetworkWriteHandler.java @@ -10,11 +10,9 @@ import io.opentelemetry.api.metrics.LongHistogram; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.instrumentation.runtimemetrics.java17.JfrFeature; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.AbstractThreadDispatchingHandler; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.Constants; import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.DurationUtil; -import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.ThreadGrouper; -import java.util.function.Consumer; +import io.opentelemetry.instrumentation.runtimemetrics.java17.internal.RecordedEventHandler; import jdk.jfr.consumer.RecordedEvent; // jdk.SocketWrite { @@ -39,14 +37,15 @@ * This class is internal and is hence not for public use. Its APIs are unstable and can change at * any time. */ -public final class NetworkWriteHandler extends AbstractThreadDispatchingHandler { +public final class NetworkWriteHandler implements RecordedEventHandler { private static final String EVENT_NAME = "jdk.SocketWrite"; + private static final String BYTES_WRITTEN = "bytesWritten"; private final LongHistogram bytesHistogram; private final DoubleHistogram durationHistogram; + private final Attributes attributes; - public NetworkWriteHandler(Meter meter, ThreadGrouper nameNormalizer) { - super(nameNormalizer); + public NetworkWriteHandler(Meter meter) { bytesHistogram = meter .histogramBuilder(Constants.METRIC_NAME_NETWORK_BYTES) @@ -60,6 +59,7 @@ public NetworkWriteHandler(Meter meter, ThreadGrouper nameNormalizer) { .setDescription(Constants.METRIC_DESCRIPTION_NETWORK_DURATION) .setUnit(Constants.SECONDS) .build(); + attributes = Attributes.of(Constants.ATTR_NETWORK_MODE, Constants.NETWORK_MODE_WRITE); } @Override @@ -73,33 +73,8 @@ public JfrFeature getFeature() { } @Override - public Consumer createPerThreadSummarizer(String threadName) { - return new PerThreadNetworkWriteHandler(bytesHistogram, durationHistogram, threadName); - } - - private static final class PerThreadNetworkWriteHandler implements Consumer { - private static final String BYTES_WRITTEN = "bytesWritten"; - - private final LongHistogram bytesHistogram; - private final DoubleHistogram durationHistogram; - private final Attributes attributes; - - private PerThreadNetworkWriteHandler( - LongHistogram bytesHistogram, DoubleHistogram durationHistogram, String threadName) { - this.bytesHistogram = bytesHistogram; - this.durationHistogram = durationHistogram; - this.attributes = - Attributes.of( - Constants.ATTR_THREAD_NAME, - threadName, - Constants.ATTR_NETWORK_MODE, - Constants.NETWORK_MODE_WRITE); - } - - @Override - public void accept(RecordedEvent ev) { - bytesHistogram.record(ev.getLong(BYTES_WRITTEN), attributes); - durationHistogram.record(DurationUtil.toSeconds(ev.getDuration()), attributes); - } + public void accept(RecordedEvent ev) { + bytesHistogram.record(ev.getLong(BYTES_WRITTEN), attributes); + durationHistogram.record(DurationUtil.toSeconds(ev.getDuration()), attributes); } }