From fde534e23bf36f253c64debaa1f261f8bbeabe7f Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 25 Mar 2024 16:06:24 +0100 Subject: [PATCH] Remove MetricResourceIdentifier (#3282) --- sentry/api/sentry.api | 10 --- .../metrics/MetricResourceIdentifier.java | 64 ------------------- 2 files changed, 74 deletions(-) delete mode 100644 sentry/src/main/java/io/sentry/metrics/MetricResourceIdentifier.java diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index ed00493135..bcfc1c9194 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -3479,16 +3479,6 @@ public abstract class io/sentry/metrics/Metric { public abstract fun serialize ()Ljava/lang/Iterable; } -public final class io/sentry/metrics/MetricResourceIdentifier { - public fun (Lio/sentry/metrics/MetricType;Ljava/lang/String;Lio/sentry/MeasurementUnit;)V - public fun equals (Ljava/lang/Object;)Z - public fun getKey ()Ljava/lang/String; - public fun getMetricType ()Lio/sentry/metrics/MetricType; - public fun getUnit ()Lio/sentry/MeasurementUnit; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - public final class io/sentry/metrics/MetricType : java/lang/Enum { public static final field Counter Lio/sentry/metrics/MetricType; public static final field Distribution Lio/sentry/metrics/MetricType; diff --git a/sentry/src/main/java/io/sentry/metrics/MetricResourceIdentifier.java b/sentry/src/main/java/io/sentry/metrics/MetricResourceIdentifier.java deleted file mode 100644 index 7aebd4f010..0000000000 --- a/sentry/src/main/java/io/sentry/metrics/MetricResourceIdentifier.java +++ /dev/null @@ -1,64 +0,0 @@ -package io.sentry.metrics; - -import io.sentry.MeasurementUnit; -import io.sentry.util.Objects; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Uniquely identifies a metric resource. Used for caching the {@link CodeLocations} for a given - * metric. - */ -@ApiStatus.Internal -public final class MetricResourceIdentifier { - private final @NotNull MetricType metricType; - private final @NotNull String key; - private final @Nullable MeasurementUnit unit; - - public MetricResourceIdentifier( - final @NotNull MetricType metricType, - final @NotNull String key, - final @Nullable MeasurementUnit unit) { - this.metricType = metricType; - this.key = key; - this.unit = unit; - } - - @NotNull - public MetricType getMetricType() { - return metricType; - } - - @NotNull - public String getKey() { - return key; - } - - @Nullable - public MeasurementUnit getUnit() { - return unit; - } - - /** Returns a string representation of the metric resource identifier. */ - @Override - public String toString() { - return String.format( - "%s:%s@%s", MetricsHelper.toStatsdType(metricType), MetricsHelper.sanitizeKey(key), unit); - } - - @Override - public boolean equals(@Nullable Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - final @NotNull MetricResourceIdentifier that = (MetricResourceIdentifier) o; - return metricType == that.metricType - && Objects.equals(key, that.key) - && Objects.equals(unit, that.unit); - } - - @Override - public int hashCode() { - return Objects.hash(metricType, key, unit); - } -}