Class AzureMonitorExporterBuilder

java.lang.Object
com.azure.monitor.opentelemetry.exporter.AzureMonitorExporterBuilder

public final class AzureMonitorExporterBuilder extends Object
This class provides a fluent builder API to instantiate AzureMonitorTraceExporter that implements SpanExporter interface defined by OpenTelemetry API specification.
  • Constructor Details

  • Method Details

    • httpPipeline

      public AzureMonitorExporterBuilder httpPipeline(com.azure.core.http.HttpPipeline httpPipeline)
      Sets the HTTP pipeline to use for the service client. If httpPipeline 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

      public AzureMonitorExporterBuilder httpClient(com.azure.core.http.HttpClient 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

      public AzureMonitorExporterBuilder retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
      Sets the RetryPolicy 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 - If policy is null.
    • configuration

      public AzureMonitorExporterBuilder configuration(com.azure.core.util.Configuration 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, use Configuration.NONE to bypass using configuration settings during construction.

      Parameters:
      configuration - The configuration store used to
      Returns:
      The updated AzureMonitorExporterBuilder object.
    • clientOptions

      public AzureMonitorExporterBuilder clientOptions(com.azure.core.util.ClientOptions 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

      public AzureMonitorExporterBuilder connectionString(String 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 is null.
      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

      public AzureMonitorExporterBuilder credential(com.azure.core.credential.TokenCredential 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

      public AzureMonitorTraceExporter buildTraceExporter()
      Creates an AzureMonitorTraceExporter based on the options set in the builder. This exporter is an implementation of OpenTelemetry SpanExporter.
      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

      public AzureMonitorMetricExporter buildMetricExporter()
      Creates an AzureMonitorMetricExporter based on the options set in the builder. This exporter is an implementation of OpenTelemetry MetricExporter.

      When a new MetricExporter is created, it will automatically start HeartbeatExporter.

      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

      public AzureMonitorLogExporter buildLogExporter()
      Creates an AzureMonitorLogExporter based on the options set in the builder. This exporter is an implementation of OpenTelemetry LogExporter.
      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.