Class OpenTelemetryMetricsCollector.Builder
java.lang.Object
com.pyranid.otel.OpenTelemetryMetricsCollector.Builder
- Enclosing class:
OpenTelemetryMetricsCollector
Builder used to construct instances of
OpenTelemetryMetricsCollector.- Since:
- 1.0.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescription@NonNull OpenTelemetryMetricsCollectorbuild()Builds the collector.instrumentationName(@NonNull String instrumentationName) Sets the instrumentation scope name to use when constructing a meter.instrumentationVersion(@Nullable String instrumentationVersion) Sets an optional instrumentation scope version to use when constructing a meter.meter(@NonNull io.opentelemetry.api.metrics.Meter meter) Sets a specific meter to use for metric instruments.Sets the logical database namespace to emit asdb.namespace.openTelemetry(@NonNull io.opentelemetry.api.OpenTelemetry openTelemetry) Sets the OpenTelemetry API object used to construct a meter ifmeter(Meter)is not set.Sets the database connection pool name to emit asdb.client.connection.pool.name.recordCollectionName(@NonNull Boolean recordCollectionName) Controls whether parsed collection/table names are emitted asdb.collection.name.recordFullSqlState(@NonNull Boolean recordFullSqlState) Controls whether full SQLSTATE values are emitted asdb.response.status_code.
-
Method Details
-
meter
public @NonNull OpenTelemetryMetricsCollector.Builder meter(@NonNull io.opentelemetry.api.metrics.Meter meter) Sets a specific meter to use for metric instruments.- Parameters:
meter- the meter to use- Returns:
- this builder
-
openTelemetry
public @NonNull OpenTelemetryMetricsCollector.Builder openTelemetry(@NonNull io.opentelemetry.api.OpenTelemetry openTelemetry) Sets the OpenTelemetry API object used to construct a meter ifmeter(Meter)is not set.- Parameters:
openTelemetry- the OpenTelemetry instance- Returns:
- this builder
-
instrumentationName
public @NonNull OpenTelemetryMetricsCollector.Builder instrumentationName(@NonNull String instrumentationName) Sets the instrumentation scope name to use when constructing a meter.- Parameters:
instrumentationName- the instrumentation scope name- Returns:
- this builder
-
instrumentationVersion
public @NonNull OpenTelemetryMetricsCollector.Builder instrumentationVersion(@Nullable String instrumentationVersion) Sets an optional instrumentation scope version to use when constructing a meter.- Parameters:
instrumentationVersion- the instrumentation scope version, ornull- Returns:
- this builder
-
poolName
Sets the database connection pool name to emit asdb.client.connection.pool.name.When unset or
null,db.client.connection.wait_timeanddb.client.connection.use_timeare not emitted, and notification metrics omit the pool-name attribute.- Parameters:
poolName- pool name, ornull- Returns:
- this builder
-
namespace
Sets the logical database namespace to emit asdb.namespace.No JDBC metadata lookup is performed. When unset or
null, the attribute is omitted.- Parameters:
namespace- logical database namespace, ornull- Returns:
- this builder
-
recordCollectionName
public @NonNull OpenTelemetryMetricsCollector.Builder recordCollectionName(@NonNull Boolean recordCollectionName) Controls whether parsed collection/table names are emitted asdb.collection.name.The default is
false. When enabled, the flag applies consistently todb.client.operation.durationanddb.client.response.returned_rows.- Parameters:
recordCollectionName- whether to record collection/table names- Returns:
- this builder
-
recordFullSqlState
public @NonNull OpenTelemetryMetricsCollector.Builder recordFullSqlState(@NonNull Boolean recordFullSqlState) Controls whether full SQLSTATE values are emitted asdb.response.status_code.The default is
true. Set this tofalseto record only the two-character SQLSTATE class.- Parameters:
recordFullSqlState- whether to record full SQLSTATE values- Returns:
- this builder
-
build
Builds the collector.- Returns:
- the collector instance
-