Class Metrics

java.lang.Object
io.helidon.metrics.api.Metrics

public class Metrics extends Object
A main entry point for developers to the Helidon metrics system, allowing access to the global meter registry and providing shortcut methods to register and locate meters in the global registry and remove meters from it.
  • Method Details

    • globalRegistry

      @Deprecated(since="4.4.0", forRemoval=true) public static MeterRegistry globalRegistry()
      Deprecated, for removal: This API element is subject to removal in a future version.
      global instances are deprecated in general, and Services can be used to get such an instance; until these methods are removed, the behavior may differ
      Returns the global meter registry.
      Returns:
      the global meter registry
    • createMeterRegistry

      @Deprecated(since="4.4.0", forRemoval=true) public static MeterRegistry createMeterRegistry(MetricsConfig metricsConfig)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a meter registry, not saved as the global registry, based on the provided metrics config.
      Parameters:
      metricsConfig - metrics config
      Returns:
      new meter registry
    • createMeterRegistry

      @Deprecated(since="4.4.0", forRemoval=true) public static MeterRegistry createMeterRegistry()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a meter registry, not saved as the global registry, using default metrics config information based on global config.
      Returns:
      new meter registry
    • getOrCreate

      @Deprecated(since="4.4.0", forRemoval=true) public static <M extends Meter, B extends Meter.Builder<B, M>> M getOrCreate(B builder)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registered meter using the name and tags in the provided builder or, if not found, registers a new one using the provided builder, both using the metrics factory's global registry.
      Type Parameters:
      M - type of the meter
      B - builder for the meter
      Parameters:
      builder - builder to use in finding or creating a meter
      Returns:
      the previously-registered meter with the same name and tags or, if none, the newly-registered one
    • getCounter

      @Deprecated(since="4.4.0", forRemoval=true) public static Optional<Counter> getCounter(String name, Iterable<Tag> tags)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registered counter.
      Parameters:
      name - name to match
      tags - tags to match
      Returns:
      Optional of the previously-registered counter; empty if not found
    • getCounter

      @Deprecated(since="4.4.0", forRemoval=true) public static Optional<Counter> getCounter(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registerec counter.
      Parameters:
      name - name to match
      Returns:
      Optional of the previously-registered counter; empty if not found
    • getSummary

      @Deprecated(since="4.4.0", forRemoval=true) public static Optional<DistributionSummary> getSummary(String name, Iterable<Tag> tags)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registered distribution summary.
      Parameters:
      name - name to match
      tags - tags to match
      Returns:
      Optional of the previously-registered distribution summary; empty if not found
    • getSummary

      @Deprecated(since="4.4.0", forRemoval=true) public static Optional<DistributionSummary> getSummary(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registered distribution summary.
      Parameters:
      name - name to match
      Returns:
      Optional of the previously-registered distribution summary; empty if not found
    • getGauge

      @Deprecated(since="4.4.0", forRemoval=true) public static Optional<Gauge> getGauge(String name, Iterable<Tag> tags)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registered gauge.
      Parameters:
      name - name to match
      tags - tags to match
      Returns:
      Optional of the previously-registered gauge; empty if not found
    • getGauge

      @Deprecated(since="4.4.0", forRemoval=true) public static Optional<Gauge> getGauge(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registered gauge.
      Parameters:
      name - name to match
      Returns:
      Optional of the previously-registered gauge; empty if not found
    • getTimer

      @Deprecated(since="4.4.0", forRemoval=true) public static Optional<Timer> getTimer(String name, Iterable<Tag> tags)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registered timer.
      Parameters:
      name - name to match
      tags - tags to match
      Returns:
      Optional of the previously-registered timer; empty if not found
    • getTimer

      @Deprecated(since="4.4.0", forRemoval=true) public static Optional<Timer> getTimer(String name)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registered timer.
      Parameters:
      name - name to match
      Returns:
      Optional of the previously-registered timer; empty if not found
    • get

      @Deprecated(since="4.4.0", forRemoval=true) public static <M extends Meter> Optional<M> get(Class<M> mClass, String name, Iterable<Tag> tags)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use the MeterRegistry API instead, as this method is just a shortcut to globalRegistry(); this method will be removed without a replacement
      Locates a previously-registered meter of the specified type, matching the name and tags.

      The method throws an IllegalArgumentException if a meter exists with the name and tags but is not type-compatible with the provided class.

      Type Parameters:
      M - type of the meter to find
      Parameters:
      mClass - type of the meter to find
      name - name to match
      tags - tags to match
      Returns:
      Optional of the previously-regsitered meter; empty if not found
    • tag

      @Deprecated(since="4.4.0", forRemoval=true) public static Tag tag(String key, String value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a Tag for the specified key and value.
      Parameters:
      key - tag key
      value - tag value
      Returns:
      new tag
    • tags

      @Deprecated(since="4.4.0", forRemoval=true) public static Iterable<Tag> tags(String... keyValuePairs)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns an Iterable of Tag by interpreting the provided strings as tag name/tag value pairs.
      Parameters:
      keyValuePairs - pairs of tag name/tag value pairs
      Returns:
      tags corresponding to the tag name/tag value pairs