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

io.opentelemetry.context.propagation.NoopTextMapPropagator Maven / Gradle / Ivy

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

package io.opentelemetry.context.propagation;

import io.opentelemetry.context.Context;
import java.util.Collection;
import java.util.Collections;
import javax.annotation.Nullable;

final class NoopTextMapPropagator implements TextMapPropagator {
  private static final NoopTextMapPropagator INSTANCE = new NoopTextMapPropagator();

  static TextMapPropagator getInstance() {
    return INSTANCE;
  }

  @Override
  public Collection fields() {
    return Collections.emptyList();
  }

  @Override
  public  void inject(Context context, @Nullable C carrier, TextMapSetter setter) {}

  @Override
  public  Context extract(Context context, @Nullable C carrier, TextMapGetter getter) {
    if (context == null) {
      return Context.root();
    }
    return context;
  }

  @Override
  public String toString() {
    return "NoopTextMapPropagator";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy