Package io.opentelemetry.exporter.otlp
Class OtlpGrpcMetricExporter.Builder
- java.lang.Object
-
- io.opentelemetry.sdk.common.export.ConfigBuilder<OtlpGrpcMetricExporter.Builder>
-
- io.opentelemetry.exporter.otlp.OtlpGrpcMetricExporter.Builder
-
- Enclosing class:
- OtlpGrpcMetricExporter
public static class OtlpGrpcMetricExporter.Builder extends io.opentelemetry.sdk.common.export.ConfigBuilder<OtlpGrpcMetricExporter.Builder>
Builder utility for this exporter.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OtlpGrpcMetricExporter.BuilderaddHeader(String key, String value)Add header to request.OtlpGrpcMetricExporterbuild()Constructs a new instance of the exporter based on the builder's values.protected OtlpGrpcMetricExporter.BuilderfromConfigMap(Map<String,String> configMap, io.opentelemetry.sdk.common.export.ConfigBuilder.NamingConvention namingConvention)Sets the configuration values from the given configuration map for only the available keys.OtlpGrpcMetricExporter.BuildersetChannel(io.grpc.ManagedChannel channel)Sets the managed chanel to use when communicating with the backend.OtlpGrpcMetricExporter.BuildersetDeadlineMs(long deadlineMs)Sets the max waiting time for the collector to process each metric batch.OtlpGrpcMetricExporter.BuildersetEndpoint(String endpoint)Sets the OTLP endpoint to connect to.OtlpGrpcMetricExporter.BuildersetUseTls(boolean useTls)Sets use or not TLS, default is false.
-
-
-
Method Detail
-
setChannel
public OtlpGrpcMetricExporter.Builder setChannel(io.grpc.ManagedChannel channel)
Sets the managed chanel to use when communicating with the backend. Takes precedence oversetEndpoint(String)if both are called.- Parameters:
channel- the channel to use- Returns:
- this builder's instance
-
setDeadlineMs
public OtlpGrpcMetricExporter.Builder setDeadlineMs(long deadlineMs)
Sets the max waiting time for the collector to process each metric batch. Optional.- Parameters:
deadlineMs- the max waiting time- Returns:
- this builder's instance
-
setEndpoint
public OtlpGrpcMetricExporter.Builder setEndpoint(String endpoint)
Sets the OTLP endpoint to connect to. Optional, defaults to "localhost:55680".- Parameters:
endpoint- endpoint to connect to- Returns:
- this builder's instance
-
setUseTls
public OtlpGrpcMetricExporter.Builder setUseTls(boolean useTls)
Sets use or not TLS, default is false. Optional. Applicable only ifendpointis set to build channel.- Parameters:
useTls- use TLS or not- Returns:
- this builder's instance
-
addHeader
public OtlpGrpcMetricExporter.Builder addHeader(String key, String value)
Add header to request. Optional. Applicable only ifendpointis set to build channel.- Parameters:
key- header keyvalue- header value- Returns:
- this builder's instance
-
build
public OtlpGrpcMetricExporter build()
Constructs a new instance of the exporter based on the builder's values.- Returns:
- a new exporter's instance
-
fromConfigMap
protected OtlpGrpcMetricExporter.Builder fromConfigMap(Map<String,String> configMap, io.opentelemetry.sdk.common.export.ConfigBuilder.NamingConvention namingConvention)
Sets the configuration values from the given configuration map for only the available keys.- Specified by:
fromConfigMapin classio.opentelemetry.sdk.common.export.ConfigBuilder<OtlpGrpcMetricExporter.Builder>- Parameters:
configMap-Mapholding the configuration values.- Returns:
- this.
-
-