Class AzureMonitorExporterBuilder
java.lang.Object
com.azure.monitor.opentelemetry.exporter.AzureMonitorExporterBuilder
This class provides a fluent builder API to instantiate
AzureMonitorTraceExporter
that
implements SpanExporter
interface defined by OpenTelemetry API specification.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddHttpPipelinePolicy
(com.azure.core.http.policy.HttpPipelinePolicy httpPipelinePolicy) Adds a policy to the set of existing policies that are executed after required policies.Creates anAzureMonitorLogExporter
based on the options set in the builder.Creates anAzureMonitorMetricExporter
based on the options set in the builder.Creates anAzureMonitorTraceExporter
based on the options set in the builder.clientOptions
(com.azure.core.util.ClientOptions clientOptions) Sets the client options such as application ID and custom headers to set on a request.configuration
(com.azure.core.util.Configuration configuration) Sets the configuration store that is used during construction of the service client.connectionString
(String connectionString) Sets the connection string to use for exporting telemetry events to Azure Monitor.credential
(com.azure.core.credential.TokenCredential credential) Sets the token credential required for authentication with the ingestion endpoint service.httpClient
(com.azure.core.http.HttpClient httpClient) Sets the HTTP client to use for sending and receiving requests to and from the service.httpLogOptions
(com.azure.core.http.policy.HttpLogOptions httpLogOptions) Sets the logging configuration for HTTP requests and responses.httpPipeline
(com.azure.core.http.HttpPipeline httpPipeline) Sets the HTTP pipeline to use for the service client.retryPolicy
(com.azure.core.http.policy.RetryPolicy retryPolicy) Sets theRetryPolicy
that is used when each request is sent.serviceVersion
(AzureMonitorExporterServiceVersion serviceVersion) Sets the Azure Monitor service version.
-
Constructor Details
-
AzureMonitorExporterBuilder
public AzureMonitorExporterBuilder()Creates an instance ofAzureMonitorExporterBuilder
.
-
-
Method Details
-
httpPipeline
Sets the HTTP pipeline to use for the service client. IfhttpPipeline
is set, all other settings are ignored.- Parameters:
httpPipeline
- The HTTP pipeline to use for sending service requests and receiving responses.- Returns:
- The updated
AzureMonitorExporterBuilder
object.
-
httpClient
Sets the HTTP client to use for sending and receiving requests to and from the service.- Parameters:
httpClient
- The HTTP client to use for requests.- Returns:
- The updated
AzureMonitorExporterBuilder
object.
-
httpLogOptions
public AzureMonitorExporterBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions httpLogOptions) Sets the logging configuration for HTTP requests and responses.If logLevel is not provided, default value of
HttpLogDetailLevel.NONE
is set.- Parameters:
httpLogOptions
- The logging configuration to use when sending and receiving HTTP requests/responses.- Returns:
- The updated
AzureMonitorExporterBuilder
object.
-
retryPolicy
Sets theRetryPolicy
that is used when each request is sent.The default retry policy will be used if not provided to build
AzureMonitorExporterBuilder
.- Parameters:
retryPolicy
- user's retry policy applied to each request.- Returns:
- The updated
AzureMonitorExporterBuilder
object.
-
addHttpPipelinePolicy
public AzureMonitorExporterBuilder addHttpPipelinePolicy(com.azure.core.http.policy.HttpPipelinePolicy httpPipelinePolicy) Adds a policy to the set of existing policies that are executed after required policies.- Parameters:
httpPipelinePolicy
- a policy to be added to the http pipeline.- Returns:
- The updated
AzureMonitorExporterBuilder
object. - Throws:
NullPointerException
- Ifpolicy
isnull
.
-
configuration
Sets the configuration store that is used during construction of the service client.The default configuration store is a clone of the
global configuration store
, useConfiguration.NONE
to bypass using configuration settings during construction.- Parameters:
configuration
- The configuration store used to- Returns:
- The updated
AzureMonitorExporterBuilder
object.
-
clientOptions
Sets the client options such as application ID and custom headers to set on a request.- Parameters:
clientOptions
- The client options.- Returns:
- The updated
AzureMonitorExporterBuilder
object.
-
connectionString
Sets the connection string to use for exporting telemetry events to Azure Monitor.- Parameters:
connectionString
- The connection string for the Azure Monitor resource.- Returns:
- The updated
AzureMonitorExporterBuilder
object. - Throws:
NullPointerException
- If the connection string isnull
.IllegalArgumentException
- If the connection string is invalid.
-
serviceVersion
public AzureMonitorExporterBuilder serviceVersion(AzureMonitorExporterServiceVersion serviceVersion) Sets the Azure Monitor service version.- Parameters:
serviceVersion
- The Azure Monitor service version.- Returns:
- The update
AzureMonitorExporterBuilder
object.
-
credential
Sets the token credential required for authentication with the ingestion endpoint service.- Parameters:
credential
- The Azure Identity TokenCredential.- Returns:
- The updated
AzureMonitorExporterBuilder
object.
-
buildTraceExporter
Creates anAzureMonitorTraceExporter
based on the options set in the builder. This exporter is an implementation of OpenTelemetrySpanExporter
.- Returns:
- An instance of
AzureMonitorTraceExporter
. - Throws:
NullPointerException
- if the connection string is not set on this builder or if the environment variable "APPLICATIONINSIGHTS_CONNECTION_STRING" is not set.
-
buildMetricExporter
Creates anAzureMonitorMetricExporter
based on the options set in the builder. This exporter is an implementation of OpenTelemetryMetricExporter
.When a new
MetricExporter
is created, it will automatically startHeartbeatExporter
.- Returns:
- An instance of
AzureMonitorMetricExporter
. - Throws:
NullPointerException
- if the connection string is not set on this builder or if the environment variable "APPLICATIONINSIGHTS_CONNECTION_STRING" is not set.
-
buildLogExporter
Creates anAzureMonitorLogExporter
based on the options set in the builder. This exporter is an implementation of OpenTelemetryLogExporter
.- Returns:
- An instance of
AzureMonitorLogExporter
. - Throws:
NullPointerException
- if the connection string is not set on this builder or if the environment variable "APPLICATIONINSIGHTS_CONNECTION_STRING" is not set.
-