Package jetbrains.buildServer.metrics
Class ServerMetricsFactory
- java.lang.Object
-
- jetbrains.buildServer.metrics.ServerMetricsFactory
-
- All Implemented Interfaces:
ServerMetrics
,ServerMetricsEx
,ServerMetricsReader
,Disposable
public class ServerMetricsFactory extends Object implements ServerMetricsEx, Disposable
- Author:
- kir
-
-
Field Summary
Fields Modifier and Type Field Description static jetbrains.buildServer.metrics.EmptyMetrics
EMPTY_METRICS
-
Fields inherited from interface jetbrains.buildServer.metrics.ServerMetricsEx
DISABLED_METRICS_PROPERTY, METRICS_ADD_NODE_ID_TAG_PROPERTY, TEAMCITY_METRICS_INTERNAL_ENABLED
-
-
Constructor Summary
Constructors Constructor Description ServerMetricsFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommonTag(String name, String value)
void
dispose()
String
getAllMetricsText(MetricQueryBuilder metricQuery)
MetricBuilder
metricBuilder(String metricName)
MetricBuilder
projectMetricBuilder(String metricName, String projectExtId, String buildTypeExtId)
Creates a metric builder for a metric associated with a project, and optionally, with a build configuration.MetricQueryBuilder
projectQueryBuilder(Collection<String> projectExtIds)
Returns a query builder for metrics created withServerMetrics.projectMetricBuilder(String, String, String)
builder.MetricQueryBuilder
queryBuilder()
void
unregisterAll()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.metrics.ServerMetricsEx
callCounter
-
-
-
-
Method Detail
-
metricBuilder
@NotNull public MetricBuilder metricBuilder(@NotNull String metricName)
- Specified by:
metricBuilder
in interfaceServerMetrics
- Parameters:
metricName
- metric name, it should provide enough context so that if all records are selected just by name, the value can be meaningful. Use "." separator, like "started.builds"
-
projectMetricBuilder
public MetricBuilder projectMetricBuilder(@NotNull String metricName, @NotNull String projectExtId, @Nullable String buildTypeExtId)
Description copied from interface:ServerMetrics
Creates a metric builder for a metric associated with a project, and optionally, with a build configuration. Project-scoped metrics have a separate query interface, and have a separate Prometheus endpoint. Such metrics should be reported not for all projects, but only for white-listed ones.- Specified by:
projectMetricBuilder
in interfaceServerMetrics
- Parameters:
metricName
- metric name, it should provide enough context so that if all records are selected just by name, the value can be meaningful. Use "." separator, like "started.builds"projectExtId
- project external ID, in the resulting metric is bound to projectId tagbuildTypeExtId
- build configuration external ID, if present, bound to buildTypeId tag- Returns:
- see above
- See Also:
MetricBuilder
,ServerMetricsReader.projectQueryBuilder(Collection)
-
queryBuilder
@NotNull public MetricQueryBuilder queryBuilder()
- Specified by:
queryBuilder
in interfaceServerMetricsReader
- Returns:
- A query builder to obtain metric values
-
projectQueryBuilder
public MetricQueryBuilder projectQueryBuilder(@Nullable Collection<String> projectExtIds)
Description copied from interface:ServerMetricsReader
Returns a query builder for metrics created withServerMetrics.projectMetricBuilder(String, String, String)
builder.- Specified by:
projectQueryBuilder
in interfaceServerMetricsReader
- Parameters:
projectExtIds
- Collection with projectIds for the reported metrics. If all projects should be returned, pass null.- Returns:
- see above
-
getAllMetricsText
@NotNull public String getAllMetricsText(@NotNull MetricQueryBuilder metricQuery)
- Specified by:
getAllMetricsText
in interfaceServerMetricsReader
- Parameters:
metricQuery
- specifies configured list of metrics for the output- Returns:
- text of all metrics in /metrics format
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceDisposable
-
unregisterAll
public void unregisterAll()
- Specified by:
unregisterAll
in interfaceServerMetricsEx
-
addCommonTag
public void addCommonTag(String name, String value)
- Specified by:
addCommonTag
in interfaceServerMetricsEx
-
-