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

com.aliyun.openservices.ons.shaded.io.opentelemetry.api.DefaultOpenTelemetry Maven / Gradle / Ivy

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

package com.aliyun.openservices.ons.shaded.io.opentelemetry.api;

import com.aliyun.openservices.ons.shaded.io.opentelemetry.api.trace.TracerProvider;
import com.aliyun.openservices.ons.shaded.io.opentelemetry.context.propagation.ContextPropagators;
import javax.annotation.concurrent.ThreadSafe;

/**
 * The default OpenTelemetry API, which tries to find API implementations via SPI or otherwise falls
 * back to no-op default implementations.
 */
@ThreadSafe
final class DefaultOpenTelemetry extends OpenTelemetry {
  private static final OpenTelemetry NO_OP = new DefaultOpenTelemetry(ContextPropagators.noop());

  static OpenTelemetry getNoop() {
    return NO_OP;
  }

  static OpenTelemetry getPropagating(ContextPropagators propagators) {
    return new DefaultOpenTelemetry(propagators);
  }

  private final ContextPropagators propagators;

  DefaultOpenTelemetry(ContextPropagators propagators) {
    this.propagators = propagators;
  }

  @Override
  public TracerProvider getTracerProvider() {
    return TracerProvider.noop();
  }

  @Override
  public ContextPropagators getPropagators() {
    return propagators;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy