Class Metric
- All Implemented Interfaces:
Describable<Metric>,Serializable
A single statistic published by the
interactiveOutput step: a labelled value with an
optional unit and an optional stable key.
Rendered as a KPI card / table row on the build page. When the value parses as a number
and a key is set, the value also feeds the per-job trend chart (the key identifies
the series across builds). Instances are immutable, XStream-persistable (they are stored inside the
build's InteractiveOutputBuildAction) and a Describable so the step's
config.jelly can render them as a repeatable nested form block.
- See Also:
-
Constructor Details
-
Metric
- Parameters:
label- human-readable label (required)value- the value as text (required); may be numeric (feeds the trend) or free-form
-
-
Method Details
-
setUnit
-
setKey
-
getLabel
-
getValue
-
getUnit
-
getKey
-
seriesKey
- Returns:
- the stable series id for the trend:
keyif set, otherwise thelabel.
-
numericValue
public double numericValue()- Returns:
- the value parsed as a double for the trend chart, or
Double.NaNif it is not a plain number. Strips a leading currency symbol and grouping commas so "$1,234.5" parses.
-
isNumeric
public boolean isNumeric()- Returns:
trueif the value is numeric (and therefore usable in the trend chart).
-
getDisplayValue
- Returns:
- the value with its unit appended (for display), e.g.
"12.4 kg".
-
toJson
@NonNull public net.sf.json.JSONObject toJson()
-