Interface Metrics


public interface Metrics
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

      static MeterRegistry globalRegistry()
      Returns the global meter registry.
      Returns:
      the global meter registry
    • createMeterRegistry

      static MeterRegistry createMeterRegistry(MetricsConfig metricsConfig)
      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

      static MeterRegistry createMeterRegistry()
      Creates a meter registry, not saved as the global registry, using default metrics config information based on global config.
      Returns:
      new meter registry
    • getOrCreate

      static <M extends Meter, B extends Meter.Builder<B, M>> M getOrCreate(B builder)
      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

      static Optional<Counter> getCounter(String name, Iterable<Tag> tags)
      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

      static Optional<Counter> getCounter(String name)
      Locates a previously-registerec counter.
      Parameters:
      name - name to match
      Returns:
      Optional of the previously-registered counter; empty if not found
    • getSummary

      static Optional<DistributionSummary> getSummary(String name, Iterable<Tag> tags)
      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

      static Optional<DistributionSummary> getSummary(String name)
      Locates a previously-registered distribution summary.
      Parameters:
      name - name to match
      Returns:
      Optional of the previously-registered distribution summary; empty if not found
    • getGauge

      static Optional<Gauge> getGauge(String name, Iterable<Tag> tags)
      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

      static Optional<Gauge> getGauge(String name)
      Locates a previously-registered gauge.
      Parameters:
      name - name to match
      Returns:
      Optional of the previously-registered gauge; empty if not found
    • getTimer

      static Optional<Timer> getTimer(String name, Iterable<Tag> tags)
      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

      static Optional<Timer> getTimer(String name)
      Locates a previously-registered timer.
      Parameters:
      name - name to match
      Returns:
      Optional of the previously-registered timer; empty if not found
    • get

      static <M extends Meter> Optional<M> get(Class<M> mClass, String name, Iterable<Tag> tags)
      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

      static Tag tag(String key, String value)
      Creates a Tag for the specified key and value.
      Parameters:
      key - tag key
      value - tag value
      Returns:
      new tag
    • tags

      static Iterable<Tag> tags(String... keyValuePairs)
      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