Package io.grpc.opentelemetry
Class GrpcOpenTelemetry.Builder
- java.lang.Object
-
- io.grpc.opentelemetry.GrpcOpenTelemetry.Builder
-
- Enclosing class:
- GrpcOpenTelemetry
public static class GrpcOpenTelemetry.Builder extends Object
Builder for configuringGrpcOpenTelemetry.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GrpcOpenTelemetry.BuilderaddOptionalLabel(String optionalLabelKey)Adds optionalLabelKey to all the metrics that can provide value for the optionalLabelKey.GrpcOpenTelemetrybuild()Returns a newGrpcOpenTelemetrybuilt with the configuration of thisGrpcOpenTelemetry.Builder.GrpcOpenTelemetry.BuilderdisableAllMetrics()Disable all metrics.GrpcOpenTelemetry.BuilderdisableMetrics(Collection<String> disableMetrics)Disables the specified metrics from being collected and exported.GrpcOpenTelemetry.BuilderenableMetrics(Collection<String> enableMetrics)Enables the specified metrics for collection and export.GrpcOpenTelemetry.Buildersdk(io.opentelemetry.api.OpenTelemetry sdk)Sets theOpenTelemetryentrypoint to use.GrpcOpenTelemetry.BuildertargetAttributeFilter(Predicate<String> filter)Sets an optional filter to control recording of thegrpc.targetmetric attribute.
-
-
-
Method Detail
-
sdk
public GrpcOpenTelemetry.Builder sdk(io.opentelemetry.api.OpenTelemetry sdk)
Sets theOpenTelemetryentrypoint to use. This can be used to configure OpenTelemetry by returning the instance created by aio.opentelemetry.sdk.OpenTelemetrySdkBuilder.
-
addOptionalLabel
public GrpcOpenTelemetry.Builder addOptionalLabel(String optionalLabelKey)
Adds optionalLabelKey to all the metrics that can provide value for the optionalLabelKey.
-
enableMetrics
public GrpcOpenTelemetry.Builder enableMetrics(Collection<String> enableMetrics)
Enables the specified metrics for collection and export. By default, only a subset of metrics are enabled.
-
disableMetrics
public GrpcOpenTelemetry.Builder disableMetrics(Collection<String> disableMetrics)
Disables the specified metrics from being collected and exported.
-
disableAllMetrics
public GrpcOpenTelemetry.Builder disableAllMetrics()
Disable all metrics. If set to true all metrics must be explicitly enabled.
-
targetAttributeFilter
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/12595") @IgnoreJRERequirement public GrpcOpenTelemetry.Builder targetAttributeFilter(@Nullable Predicate<String> filter)
Sets an optional filter to control recording of thegrpc.targetmetric attribute.If the predicate returns
true, the original target is recorded. Otherwise, the target is recorded as"other"to limit metric cardinality.If unset, all targets are recorded as-is.
-
build
public GrpcOpenTelemetry build()
Returns a newGrpcOpenTelemetrybuilt with the configuration of thisGrpcOpenTelemetry.Builder.
-
-