// Path: src/main/java/io/vertx/ext/prometheus/metrics/counters/BytesCounter.java
// public final class BytesCounter {
//   private final @NotNull Counter counter;
//   private final @NotNull Supplier<String> localAddress;
// 
//   public BytesCounter(@NotNull String name, @NotNull String localAddress, @NotNull CounterFactory counters) {
//     this(name, () -> localAddress, counters);
//   }
// 
//   public BytesCounter(@NotNull String name, @NotNull Supplier<String> localAddress, @NotNull CounterFactory counters) {
//     this.localAddress = localAddress;
//     counter = counters.bytes(name);
//   }
// 
//   public void read(long bytes) {
//     increment("read", bytes);
//   }
// 
//   public void written(long bytes) {
//     increment("written", bytes);
//   }
// 
//   private void increment(@NotNull String operation, long bytes) {
//     counter.labels(localAddress.get(), operation).inc(bytes);
//   }
// }
// 
// Path: src/main/java/io/vertx/ext/prometheus/metrics/counters/ErrorCounter.java
// public final class ErrorCounter {
//   private final @NotNull Counter counter;
//   private final @NotNull Supplier<String> localAddress;
// 
//   public ErrorCounter(@NotNull String name, @NotNull String localAddress, @NotNull CounterFactory counters) {
//     this(name, () -> localAddress, counters);
//   }
// 
//   public ErrorCounter(@NotNull String name, @NotNull Supplier<String> localAddress, @NotNull CounterFactory counters) {
//     this.localAddress = localAddress;
//     counter = counters.errors(name);
//   }
// 
//   public void increment(@NotNull Throwable throwable) {
//     counter.labels(localAddress.get(), throwable.getClass().getSimpleName()).inc();
//   }
// }
// 
// Path: src/main/java/io/vertx/ext/prometheus/metrics/factories/CounterFactory.java
// public final class CounterFactory {
//   private final @NotNull CollectorRegistry registry;
//   private final @NotNull Map<String, Counter> counters = new ConcurrentHashMap<>();
// 
//   public CounterFactory(@NotNull CollectorRegistry registry) {
//     this.registry = registry;
//   }
// 
//   /**
//    * Unregisters the counters which were created by this factory from the registry.
//    */
//   public void close() {
//     counters.values().forEach(registry::unregister);
//   }
// 
//   /**
//    * Bytes counter.
//    *
//    * @param name The name of the counter, without prefix and suffix.
//    * @return A counter of bytes for the given name. Counters with the same name are shared.
//    */
//   public @NotNull Counter bytes(@NotNull String name) {
//     return counters.computeIfAbsent("vertx_" + name + "_bytes", key -> register(Counter.build(key, "Read/written bytes")
//         .labelNames("local_address", "type").create()));
//   }
// 
//   /**
//    * Errors counter.
//    *
//    * @param name The name of the counter, without prefix and suffix.
//    * @return A counter for errors, identified by the given name. Counters with the same name are shared.
//    */
//   public @NotNull Counter errors(@NotNull String name) {
//     return counters.computeIfAbsent("vertx_" + name + "_errors", key -> register(Counter.build(key, "Errors number")
//         .labelNames("local_address", "class").create()));
//   }
// 
//   /**
//    * HTTP responses counter.
//    *
//    * @param name The name of the counter, without prefix and suffix.
//    * @return A counter of http responses, identified by the given name. Counters with the same name are shared.
//    */
//   public @NotNull Counter httpResponses(@NotNull String name) {
//     return counters.computeIfAbsent("vertx_" + name + "_responses", key -> register(Counter.build(key, "HTTP responses number")
//         .labelNames("local_address", "code").create()));
//   }
// 
//   private @NotNull Counter register(@NotNull Counter counter) {
//     registry.register(counter);
//     return counter;
//   }
// }


import io.prometheus.client.CollectorRegistry;
import io.vertx.core.net.SocketAddress;
import io.vertx.core.net.impl.SocketAddressImpl;
import io.vertx.core.spi.metrics.DatagramSocketMetrics;
import io.vertx.ext.prometheus.metrics.counters.BytesCounter;
import io.vertx.ext.prometheus.metrics.counters.ErrorCounter;
import io.vertx.ext.prometheus.metrics.factories.CounterFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.Supplier;
package io.vertx.ext.prometheus.metrics;



public final class DatagramSocketPrometheusMetrics extends PrometheusMetrics implements DatagramSocketMetrics {
  private static final @NotNull String NAME = "datagram_socket";

  private final @NotNull BytesCounter bytes;
  private final @NotNull ErrorCounter errors;

  private volatile @Nullable SocketAddress namedLocalAddress;

  public DatagramSocketPrometheusMetrics(@NotNull CollectorRegistry registry, @NotNull CounterFactory counters) {
    super(registry);
    final Supplier<String> localAddress = () -> String.valueOf(namedLocalAddress);
// Path: src/main/java/io/vertx/ext/prometheus/metrics/counters/BytesCounter.java
// public final class BytesCounter {
//   private final @NotNull Counter counter;
//   private final @NotNull Supplier<String> localAddress;
// 
//   public BytesCounter(@NotNull String name, @NotNull String localAddress, @NotNull CounterFactory counters) {
//     this(name, () -> localAddress, counters);
//   }
// 
//   public BytesCounter(@NotNull String name, @NotNull Supplier<String> localAddress, @NotNull CounterFactory counters) {
//     this.localAddress = localAddress;
//     counter = counters.bytes(name);
//   }
// 
//   public void read(long bytes) {
//     increment("read", bytes);
//   }
// 
//   public void written(long bytes) {
//     increment("written", bytes);
//   }
// 
//   private void increment(@NotNull String operation, long bytes) {
//     counter.labels(localAddress.get(), operation).inc(bytes);
//   }
// }
// 
// Path: src/main/java/io/vertx/ext/prometheus/metrics/counters/ErrorCounter.java
// public final class ErrorCounter {
//   private final @NotNull Counter counter;
//   private final @NotNull Supplier<String> localAddress;
// 
//   public ErrorCounter(@NotNull String name, @NotNull String localAddress, @NotNull CounterFactory counters) {
//     this(name, () -> localAddress, counters);
//   }
// 
//   public ErrorCounter(@NotNull String name, @NotNull Supplier<String> localAddress, @NotNull CounterFactory counters) {
//     this.localAddress = localAddress;
//     counter = counters.errors(name);
//   }
// 
//   public void increment(@NotNull Throwable throwable) {
//     counter.labels(localAddress.get(), throwable.getClass().getSimpleName()).inc();
//   }
// }
// 
// Path: src/main/java/io/vertx/ext/prometheus/metrics/factories/CounterFactory.java
// public final class CounterFactory {
//   private final @NotNull CollectorRegistry registry;
//   private final @NotNull Map<String, Counter> counters = new ConcurrentHashMap<>();
// 
//   public CounterFactory(@NotNull CollectorRegistry registry) {
//     this.registry = registry;
//   }
// 
//   /**
//    * Unregisters the counters which were created by this factory from the registry.
//    */
//   public void close() {
//     counters.values().forEach(registry::unregister);
//   }
// 
//   /**
//    * Bytes counter.
//    *
//    * @param name The name of the counter, without prefix and suffix.
//    * @return A counter of bytes for the given name. Counters with the same name are shared.
//    */
//   public @NotNull Counter bytes(@NotNull String name) {
//     return counters.computeIfAbsent("vertx_" + name + "_bytes", key -> register(Counter.build(key, "Read/written bytes")
//         .labelNames("local_address", "type").create()));
//   }
// 
//   /**
//    * Errors counter.
//    *
//    * @param name The name of the counter, without prefix and suffix.
//    * @return A counter for errors, identified by the given name. Counters with the same name are shared.
//    */
//   public @NotNull Counter errors(@NotNull String name) {
//     return counters.computeIfAbsent("vertx_" + name + "_errors", key -> register(Counter.build(key, "Errors number")
//         .labelNames("local_address", "class").create()));
//   }
// 
//   /**
//    * HTTP responses counter.
//    *
//    * @param name The name of the counter, without prefix and suffix.
//    * @return A counter of http responses, identified by the given name. Counters with the same name are shared.
//    */
//   public @NotNull Counter httpResponses(@NotNull String name) {
//     return counters.computeIfAbsent("vertx_" + name + "_responses", key -> register(Counter.build(key, "HTTP responses number")
//         .labelNames("local_address", "code").create()));
//   }
// 
//   private @NotNull Counter register(@NotNull Counter counter) {
//     registry.register(counter);
//     return counter;
//   }
// }


// Path: src/main/java/io/vertx/ext/prometheus/metrics/DatagramSocketPrometheusMetrics.java
import io.prometheus.client.CollectorRegistry;
import io.vertx.core.net.SocketAddress;
import io.vertx.core.net.impl.SocketAddressImpl;
import io.vertx.core.spi.metrics.DatagramSocketMetrics;
import io.vertx.ext.prometheus.metrics.counters.BytesCounter;
import io.vertx.ext.prometheus.metrics.counters.ErrorCounter;
import io.vertx.ext.prometheus.metrics.factories.CounterFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.Supplier;

package io.vertx.ext.prometheus.metrics;



public final class DatagramSocketPrometheusMetrics extends PrometheusMetrics implements DatagramSocketMetrics {
  private static final @NotNull String NAME = "datagram_socket";

  private final @NotNull BytesCounter bytes;
  private final @NotNull ErrorCounter errors;

  private volatile @Nullable SocketAddress namedLocalAddress;

  public DatagramSocketPrometheusMetrics(@NotNull CollectorRegistry registry, @NotNull CounterFactory counters) {
    super(registry);
    final Supplier<String> localAddress = () -> String.valueOf(namedLocalAddress);
    bytes = new BytesCounter(NAME, localAddress, counters);