io.opentelemetry.context.propagation.NoopTextMapPropagator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opentelemetry-context Show documentation
Show all versions of opentelemetry-context Show documentation
OpenTelemetry Context (Incubator)
/*
* 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";
}
}