Package jetbrains.buildServer.metrics
Interface MetricBuilder
-
public interface MetricBuilder
- Since:
- 2019.2
- Author:
- kir
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MetricBuilder
addTag(String name, String value)
Add a tag which should be added to the generated metricCounter
buildCounter()
Build and return counter metric based on the specified parametersvoid
buildGauge(GaugeValueProvider valueProvider)
Build and return gauge metric based on the specified parameters.Counter
buildTimeHistogram(Duration... buckets)
Build and return counter metric based on specified paramters.MetricBuilder
dataType(MetricDataType type)
MetricBuilder
description(String userDescription)
MetricBuilder
experimental(boolean experimental)
MetricBuilder
tags(String... name2ValuePairs)
MetricBuilder
tags(Map<String,String> tags)
-
-
-
Method Detail
-
description
@NotNull MetricBuilder description(@NotNull String userDescription)
- Parameters:
userDescription
- optional description for the metric, may be shown in UI
-
tags
@NotNull MetricBuilder tags(@NotNull String... name2ValuePairs)
- Parameters:
name2ValuePairs
- tags for this metric, extra specificators in form name=value (should go in pairs), can be used in query parameters. Existing tags are preserved
-
tags
@NotNull MetricBuilder tags(@NotNull Map<String,String> tags)
- Parameters:
tags
- tags for this metric, extra specificators in form name=value (should go in pairs), can be used in query parameters. Existing tags are preserved
-
addTag
MetricBuilder addTag(@NotNull String name, @NotNull String value)
Add a tag which should be added to the generated metric- Parameters:
name
- name of the tagvalue
- tag value- Returns:
- this builder
- Since:
- 2022.08
-
experimental
@NotNull MetricBuilder experimental(boolean experimental)
- Parameters:
experimental
- if true, the metric is considered experimental and is not returned by default. Currently, all metrics are experimental unless explicitly set to false.
-
dataType
@NotNull MetricBuilder dataType(@NotNull MetricDataType type)
- Parameters:
type
- specify additional type for the reported metric, may affect the presentation. Default type isMetricDataType.NUMBER
-
buildCounter
@NotNull Counter buildCounter()
Build and return counter metric based on the specified parameters- Returns:
- see above
-
buildGauge
void buildGauge(@NotNull GaugeValueProvider valueProvider)
Build and return gauge metric based on the specified parameters. If builder is built multiple times with same tags/parameters, the first registered GaugeValueProvider will always be used. I.e. it is not possible to provide another gauge value by re-registering a gauge.
-
buildTimeHistogram
@NotNull Counter buildTimeHistogram(@NotNull Duration... buckets)
Build and return counter metric based on specified paramters. Additionally, all recorded values will be sorted by buckets with given boundaries. Values in buckets will have "_bucket" metric suffix and contain bucket upper boundaty in "le" metric value tag.
Resulting bucket configuration:
(0 .. buckets[0]), (buckets[0] .. buckets[1]), .. (buckets[n-1] .. buckets[n])
Note that histogram is cumulative, meaning each bucket contains sum of the counts of all previous buckets.- Parameters:
buckets
- Upper bounds of desired buckets.
-
-