Class Metric

java.lang.Object
io.sentry.metrics.Metric
Direct Known Subclasses:
CounterMetric, DistributionMetric, GaugeMetric, SetMetric

@Internal public abstract class Metric extends Object
Base class for metric instruments
  • Constructor Details

    • Metric

      public Metric(@NotNull @NotNull MetricType type, @NotNull @NotNull String key, @Nullable @Nullable MeasurementUnit unit, @Nullable @Nullable Map<String,String> tags)
      Creates a new instance of Metric.
      Parameters:
      key - The text key to be used to identify the metric
      unit - An optional MeasurementUnit that describes the values being tracked
      tags - An optional set of key/value pairs that can be used to add dimensionality to metrics
  • Method Details

    • add

      public abstract void add(double value)
      Adds a value to the metric
    • getType

      @NotNull public @NotNull MetricType getType()
    • getWeight

      public abstract int getWeight()
    • getKey

      @NotNull public @NotNull String getKey()
    • getUnit

      @Nullable public @Nullable MeasurementUnit getUnit()
    • getTags

      @Nullable public @Nullable Map<String,String> getTags()
    • serialize

      @NotNull public abstract @NotNull Iterable<?> serialize()