Class SimpleMeterConvention<C extends @Nullable Object>

java.lang.Object
io.micrometer.core.instrument.binder.SimpleMeterConvention<C>
Type Parameters:
C - context type from which tags can be derived
All Implemented Interfaces:
MeterConvention<C>

public class SimpleMeterConvention<C extends @Nullable Object> extends Object implements MeterConvention<C>
Basic implementation of a MeterConvention.
Since:
1.16.0
  • Constructor Details

    • SimpleMeterConvention

      public SimpleMeterConvention(String name)
      Create a convention with a name and no tags.
      Parameters:
      name - meter name
    • SimpleMeterConvention

      public SimpleMeterConvention(String name, Tags tags)
      Create a convention with a name and fixed tags.
      Parameters:
      name - meter name
      tags - tags associated with the meter
    • SimpleMeterConvention

      public SimpleMeterConvention(String name, Function<C,Tags> tagsFunction)
      Create a convention with a name and tags derived from a function.
      Parameters:
      name - meter name
      tagsFunction - derive tags from the context with this function
  • Method Details

    • getName

      public String getName()
      Description copied from interface: MeterConvention
      Canonical name of the meter.
      Specified by:
      getName in interface MeterConvention<C extends @Nullable Object>
      Returns:
      meter name
    • getTags

      public Tags getTags(C context)
      Description copied from interface: MeterConvention
      Tags specific to this meter convention. Generally they should be combined with any common tags if this convention is associated with other conventions that share tags.
      Specified by:
      getTags in interface MeterConvention<C extends @Nullable Object>
      Parameters:
      context - optional context which may be used for deriving tags
      Returns:
      tags instance to use with the meter described by this convention