org.apache.hadoop.metrics2.annotation

## Annotation Type Metric

-     @InterfaceAudience.Public
       @InterfaceStability.Evolving
       @Documented
       @Target(value={FIELD,METHOD})
       @Retention(value=RUNTIME)
      public @interface Metric

  Annotation interface for a single metric used to annotate a field or a method in the class.

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `String` | `about`
    `boolean` | `always`
    `int` | `interval`
    `String` | `sampleName`
    `Metric.Type` | `type`
    `String[]` | `value` Shorthand for optional name and description
    `String` | `valueName`

- - ### Element Detail

    - #### value

          public abstract String[] value

      Shorthand for optional name and description
      Returns:
        {description} or {name, description}
      Default:
        {}

  - - #### about

          public abstract String about

      Returns:
        optional description of the metric
      Default:
        ""

  - - #### sampleName

          public abstract String sampleName

      Returns:
        optional sample name for MutableStat/Rate/Rates
      Default:
        "Ops"

  - - #### valueName

          public abstract String valueName

      Returns:
        optional value name for MutableStat/Rate/Rates
      Default:
        "Time"

  - - #### always

          public abstract boolean always

      Returns:
        true to create a metric snapshot even if unchanged.
      Default:
        false

  - - #### type

          public abstract Metric.Type type

      Returns:
        optional type (counter|gauge) of the metric
      Default:
        org.apache.hadoop.metrics2.annotation.Metric.Type.DEFAULT

  - - #### interval

          public abstract int interval

      Returns:
        optional roll over interval in secs for MutableQuantiles
      Default:
        10

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.