Class OutputMetrics

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, ProfileAction, Aware, MessageSource, MessageSourceAware, Action

public class OutputMetrics extends AbstractProfileAction
Action that outputs one or more Metric objects.

On success, a 200 HTTP status is returned. On failure, a non-successful HTTP status is returned.

Event:
EventIds.PROCEED_EVENT_ID, EventIds.INVALID_PROFILE_CTX, EventIds.IO_ERROR
  • Field Details

    • ALL_METRICS

      @Nonnull @NotEmpty public static final String ALL_METRICS
      Constant representing all metrics.
      See Also:
    • METRIC_ID

      @Nonnull @NotEmpty public static final String METRIC_ID
      Flow variable indicating ID of metric or group of metrics to output.
      See Also:
    • log

      @Nonnull private org.slf4j.Logger log
      Class logger.
    • metricFilter

      @Nullable private com.codahale.metrics.MetricFilter metricFilter
      Pre-installed filter to apply alongside dynamically derived filter.
    • metricRegistry

      @NonnullAfterInit private com.codahale.metrics.MetricRegistry metricRegistry
      The metric registry.
    • allowedOrigin

      @Nullable private String allowedOrigin
      Value for Access-Control-Allow-Origin header, if any.
    • jsonpCallbackName

      @Nullable private String jsonpCallbackName
      Name of JSONP callback function, if any.
    • dateTimeFormatter

      @Nonnull private DateTimeFormatter dateTimeFormatter
      Formatter for date/time fields.
    • useDefaultTimeZone

      private boolean useDefaultTimeZone
      Convert date/time fields to default time zone.
    • metricFilterMap

      @Nonnull @NonnullElements private Map<String,com.codahale.metrics.MetricFilter> metricFilterMap
      Map of custom metric groups to filters.
    • metricId

      @Nullable private String metricId
      Metric ID to operate on.
  • Constructor Details

    • OutputMetrics

      public OutputMetrics()
      Constructor.
  • Method Details

    • setMetricFilter

      public void setMetricFilter(@Nullable com.codahale.metrics.MetricFilter filter)
      Set the external metric filter to apply.
      Parameters:
      filter - metric filter
    • setMetricRegistry

      public void setMetricRegistry(@Nonnull com.codahale.metrics.MetricRegistry registry)
      Set the registry of metrics.
      Parameters:
      registry - metric registry
    • setAllowedOrigin

      public void setAllowedOrigin(@Nullable String origin)
      Set the value of the Access-Control-Allow-Origin CORS header, if any.
      Parameters:
      origin - header value
    • setJSONPCallbackName

      public void setJSONPCallbackName(@Nullable String callbackName)
      Set a JSONP callback function to wrap the result in, if any.
      Parameters:
      callbackName - callback function name.
    • setDateTimeFormat

      public void setDateTimeFormat(@Nullable @NotEmpty String format)
      Set the formatting string to apply when extracting date/time fields.
      Parameters:
      format - formatting string
    • setUseDefaultTimeZone

      public void setUseDefaultTimeZone(boolean flag)
      Convert date/time fields to default time zone.
      Parameters:
      flag - flag to set
      Since:
      4.1.0
    • setMetricFilterMap

      public void setMetricFilterMap(@Nonnull @NonnullElements Map<String,com.codahale.metrics.MetricFilter> map)
      Set the map of custom group names to metric filters.
      Parameters:
      map - group to filter map
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractInitializableComponent
      Throws:
      ComponentInitializationException
    • doPreExecute

      protected boolean doPreExecute(ProfileRequestContext profileRequestContext)
      Overrides:
      doPreExecute in class AbstractConditionalProfileAction
    • doExecute

      protected void doExecute(ProfileRequestContext profileRequestContext)
      Overrides:
      doExecute in class AbstractProfileAction