Class MetricsUtils

java.lang.Object
io.confluent.telemetry.MetricsUtils

public class MetricsUtils extends Object
  • Constructor Details

    • MetricsUtils

      public MetricsUtils()
  • Method Details

    • toTimeUnixNanos

      public static long toTimeUnixNanos(Instant t)
    • fromTimeUnixNanos

      public static Instant fromTimeUnixNanos(long t)
    • nowInUTC

      public static ZonedDateTime nowInUTC(Clock clock)
    • nowInUTC

      public static OffsetDateTime nowInUTC()
    • attributesMap

      public static Map<String,String> attributesMap(io.opentelemetry.proto.resource.v1.Resource resource)
      Convert resource attributes to a map of strings, ignoring non-string attributes
      Parameters:
      resource -
      Returns:
    • attributesMap

      public static Map<String,String> attributesMap(List<io.opentelemetry.proto.common.v1.KeyValue> attributes)
    • extractDataPoints

      public static List<io.opentelemetry.proto.metrics.v1.NumberDataPoint> extractDataPoints(io.opentelemetry.proto.metrics.v1.Metric metric)
      Extracts the list of data points from the given metric based on its type. Supports SUM and GAUGE metric types. Returns an empty list if the metric type is unsupported or does not contain data points.
      Parameters:
      metric - The metric from which to extract data points.
      Returns:
      A list of NumberDataPoint objects, or an empty list if no data points are available.