Class MeterConfigurationsImpl

java.lang.Object
com.atlassian.diagnostics.ipd.api.MeterConfigurationsImpl
All Implemented Interfaces:
MeterConfigurations

public class MeterConfigurationsImpl extends Object implements MeterConfigurations
Since:
5.0.0
  • Constructor Details

  • Method Details

    • addMeterConfig

      public MeterConfigurations addMeterConfig(String prefixMatcher, Consumer<MeterConfigBuilder> meterConfig)
      Description copied from interface: MeterConfigurations
      Adds a configuration for a specific meter key prefix. The key prefix must be made of full meter segments it wants to match. Matching prefix as `String.startsWith()` is not supported.

      For example, a meter "issue.created" will apply configurations with prefix "issue" and "issue.created". However, it won't apply configuration with prefix "iss". Such configuration would apply to meters like "iss" and "iss.created".

      The configuration is applied to all meters whose key starts with the provided prefix. The configuration is applied after the default configuration.

      Configuration added with prefix "" (empty string) will apply to all meters.

      Important Note: The configuration is applied only on meter creation. Changing the configuration after the meter is created will not affect the meter. It is recommended to declare all configurations before creating any meters, otherwise meters may not have the expected configuration.
      Specified by:
      addMeterConfig in interface MeterConfigurations
      Parameters:
      prefixMatcher - the prefix of the meter key to match
      meterConfig - the configuration that will be applied to meters with keys matching the prefix
      Returns:
      this MeterConfigurations instance
    • evaluateConfig

      public void evaluateConfig(MeterKey meterKey, ProductMeterConfigBuilder configBuilder)
      Description copied from interface: MeterConfigurations
      Evaluates the configuration for the given MeterKey and applies it to the provided ProductMeterConfigBuilder. The default configuration is applied first, followed by any specific configurations that match the MeterKey.

      This method applies configurations for each segment of the meter key, starting from the most generic to the most specific. For example, if the meter key is "issue.created" and there are configurations for "issue" and "issue.created", the configuration for "issue" will be applied first, followed by the configuration for "issue.created".

      Specified by:
      evaluateConfig in interface MeterConfigurations
      Parameters:
      meterKey - the key of the meter to evaluate the configuration for
      configBuilder - the builder to apply the configuration to