Class PipelineMetricRegistry

java.lang.Object
org.graylog.plugins.pipelineprocessor.processors.PipelineMetricRegistry

public class PipelineMetricRegistry extends Object
A metric registry for processing pipelines, stages, and rules.

The registry simplifies metrics management by automatically applying metric name prefixes to metric registration and removal. It also applies the correct name pattern for metrics.

  • Method Details

    • create

      public static PipelineMetricRegistry create(com.codahale.metrics.MetricRegistry metricRegistry, String pipelinesPrefix, String rulesPrefix)
      Creates a new pipeline metric registry.
      Parameters:
      metricRegistry - metric registry to register the metrics with
      pipelinesPrefix - metric name prefix for pipelines and stages
      rulesPrefix - metric name prefix for rules
      Returns:
      the new pipeline metric registry instance
    • registerPipelineMeter

      public com.codahale.metrics.Meter registerPipelineMeter(String pipelineId, String name)
      Registers a new pipeline meter for the given pipeline ID and name.
      Parameters:
      pipelineId - the pipeline ID
      name - the meter name
      Returns:
      the new pipeline meter
      Throws:
      IllegalArgumentException - if pipelineId or name are blank
    • registerStageMeter

      public com.codahale.metrics.Meter registerStageMeter(String pipelineId, int stage, String name)
      Registers a new stage meter for the given pipeline ID, stage, and name.
      Parameters:
      pipelineId - the pipeline ID
      stage - the stage number
      name - the meter name
      Returns:
      the new stage meter
      Throws:
      IllegalArgumentException - if pipelineId or name are blank
    • registerLocalRuleMeter

      public com.codahale.metrics.Meter registerLocalRuleMeter(String pipelineId, int stage, String ruleId, String name)
      Registers a new local rule meter for the given pipeline ID, stage, rule ID, and name.

      A local meter name includes the pipeline ID and stage number to track metrics for the rule in a specific pipeline and stage.

      Parameters:
      pipelineId - the pipeline ID
      stage - the stage number
      ruleId - the rule ID
      name - the meter name
      Returns:
      the new local rule meter
      Throws:
      IllegalArgumentException - if pipelineId, ruleId or name are blank
    • registerGlobalRuleMeter

      public com.codahale.metrics.Meter registerGlobalRuleMeter(String ruleId, String name)
      Registers a new global rule meter for the given rule ID and name.

      A global meter name only includes the rule ID to track metrics for the rule overall.

      Parameters:
      ruleId - the rule ID
      name - the meter name
      Returns:
      the new local rule meter
      Throws:
      IllegalArgumentException - if ruleId or name are blank
    • removePipelineMetrics

      public void removePipelineMetrics(String pipelineId)
      Removes all pipeline metrics for the given pipeline ID from the registry.
      Parameters:
      pipelineId - the pipeline ID
      Throws:
      IllegalArgumentException - if pipelineId is blank
    • removeRuleMetrics

      public void removeRuleMetrics(String ruleId)
      Removes all rule metrics for the given rule ID from the registry.
      Parameters:
      ruleId - the rule ID
      Throws:
      IllegalArgumentException - if ruleId is blank