Module io.helidon.dbclient.metrics
Package io.helidon.dbclient.metrics
Class DbMetricBuilder<T extends DbMetricBuilder<T>>
- java.lang.Object
-
- io.helidon.dbclient.metrics.DbMetricBuilder<T>
-
- Type Parameters:
T- type of the builder extending this class
- Direct Known Subclasses:
DbCounter.Builder,DbMeter.Builder,DbTimer.Builder
public abstract class DbMetricBuilder<T extends DbMetricBuilder<T>> extends Object
A metric builder used as a base for Helidon DB metrics.
-
-
Constructor Summary
Constructors Constructor Description DbMetricBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tconfig(Config config)Configure a metric from configuration.Tdescription(String description)Description of the metric used in metric metadata.TmeasureErrors(boolean shouldWe)Whether to measure failed statements.TmeasureSuccess(boolean shouldWe)Whether to measure successful statements.Tmetadata(org.eclipse.microprofile.metrics.Metadata meta)Configure metric metadata.Tname(String metricName)Configure a metric name.TnameFormat(String format)Configure a name format.TnameFormat(BiFunction<String,DbStatementType,String> function)Configure a name format function.
-
-
-
Method Detail
-
name
public T name(String metricName)
Configure a metric name.- Parameters:
metricName- name of the metric- Returns:
- updated builder instance
-
metadata
public T metadata(org.eclipse.microprofile.metrics.Metadata meta)
Configure metric metadata.- Parameters:
meta- metric metadata- Returns:
- updated builder instance
-
nameFormat
public T nameFormat(String format)
Configure a name format.The format can use up to two parameters - first is the statement name, second the
DbStatementTypeas a string.- Parameters:
format- format string expecting zero to two parameters that can be processed byString.format(String, Object...)- Returns:
- updated builder instance
-
nameFormat
public T nameFormat(BiFunction<String,DbStatementType,String> function)
Configure a name format function.The first parameter is the statement name.
- Parameters:
function- function to use to create metric name- Returns:
- updated builder instance
-
measureErrors
public T measureErrors(boolean shouldWe)
Whether to measure failed statements.- Parameters:
shouldWe- set tofalseif errors should be ignored- Returns:
- updated builder instance
-
measureSuccess
public T measureSuccess(boolean shouldWe)
Whether to measure successful statements.- Parameters:
shouldWe- set tofalseif successes should be ignored- Returns:
- updated builder instance
-
description
public T description(String description)
Description of the metric used in metric metadata.- Parameters:
description- description- Returns:
- updated builder instance
-
config
public T config(Config config)
Configure a metric from configuration. The following configuration key are used:DB Metric configuration options key default description errors trueWhether this metric triggers for error states success trueWhether this metric triggers for successful executions name-format db.metric-type.statement-nameA string format used to construct a metric name. The format gets two parameters: the statement name and the statement type description Description of this metric, used in metric Metadata- Parameters:
config- configuration to configure this metric- Returns:
- updated builder instance
-
-