All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.exporter.otlp.internal.OtlpUserAgent Maven / Gradle / Ivy

There is a newer version: 1.46.0
Show newest version
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.exporter.otlp.internal;

import io.opentelemetry.sdk.common.internal.OtelVersion;
import java.util.function.BiConsumer;

/**
 * This class is internal and is hence not for public use. Its APIs are unstable and can change at
 * any time.
 */
public final class OtlpUserAgent {

  private static final String userAgent = "OTel-OTLP-Exporter-Java/" + OtelVersion.VERSION;

  /**
   * Return an OTLP {@code User-Agent} header value of the form {@code "OTel OTLP Exporter
   * Java/{version}"}.
   *
   * @see OTLP
   *     Exporter User Agent
   */
  public static String getUserAgent() {
    return userAgent;
  }

  /**
   * Call the {@code consumer with} an OTLP {@code User-Agent} header value of the form {@code "OTel
   * OTLP Exporter Java/{version}"}.
   *
   * @see OTLP
   *     Exporter User Agent
   */
  public static void addUserAgentHeader(BiConsumer consumer) {
    consumer.accept("User-Agent", userAgent);
  }

  private OtlpUserAgent() {}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy