Class MetricFilter

java.lang.Object
com.codingchili.core.metrics.MetricFilter

public class MetricFilter extends Object
Configuration used to filter metrics.
  • Constructor Details

    • MetricFilter

      public MetricFilter()
  • Method Details

    • getPath

      public String getPath()
      Returns:
      the path to the metric, for example 'vertx.eventbus.handlers'.
    • setPath

      public MetricFilter setPath(String path)
    • getAlias

      public String getAlias()
      Returns:
      the alias to write the metrics as, for example if the path is "vertx.eventbus.handlers" an alias could be used in events, such as {myAlias: ... metrics} especially useful for longer paths such as vertx.http.servers.0.0.0.0:8080.requests which could be aliased as "myService1.requests".

      Note: the alias can only be applied if the filter matches exactly one metric.

    • aliasOrPath

      public String aliasOrPath()
    • setAlias

      public MetricFilter setAlias(String alias)
    • getInclude

      public Set<String> getInclude()
      Returns:
      a list of metrics to include from the event, some metric types contain a large number of fields, all of them might not be relevant. Specifying include lists greatly reduces the size of the events.
    • setInclude

      public void setInclude(Set<String> include)
    • getExclude

      public Set<String> getExclude()
    • setExclude

      public void setExclude(Set<String> exclude)
      Parameters:
      exclude - a list of keys to ignore from metric events matching the filter.
    • include

      public MetricFilter include(String... key)
      Parameters:
      key - the key to include from entries matching the filter.
      Returns:
      fluent.
    • exclude

      public MetricFilter exclude(String... key)
      Parameters:
      key - the key to exclude from entries matching the filter.
      Returns:
      fluent.
    • apply

      public io.vertx.core.json.JsonObject apply(com.codahale.metrics.Metric metric, String path)
      Applies the filtering logic to a metrics object.
      Parameters:
      metric - converted to json and filtered.
      path - the full path of the metrics object.
      Returns:
      a converted metrics object with filtered properties.
    • convert

      public static io.vertx.core.json.JsonObject convert(com.codahale.metrics.Metric metric, String path)
      Parameters:
      metric - a metric to convert to a json object.
      path - the path to the metric, used as the key for the data.
      Returns:
      a json object where the path is mapped to an object containing the metric data.
    • defaultIncludes

      public static Set<String> defaultIncludes()
      Returns:
      a list of default includes for dropwizard. Use includes and excludes to modify this with filters.