io.opentelemetry.javaagent.instrumentation.jaxrs.v2_0.ResteasySpanName Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opentelemetry-javaagent-jaxrs-2.0-resteasy-common Show documentation
Show all versions of opentelemetry-javaagent-jaxrs-2.0-resteasy-common Show documentation
Instrumentation of Java libraries using OpenTelemetry.
The newest version!
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.jaxrs.v2_0;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRoute;
import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRouteGetter;
import io.opentelemetry.instrumentation.api.semconv.http.HttpServerRouteSource;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;
import javax.annotation.Nullable;
public final class ResteasySpanName implements HttpServerRouteGetter {
public static final ResteasySpanName INSTANCE = new ResteasySpanName();
public void updateServerSpanName(Context context, String name) {
if (name != null) {
HttpServerRoute.update(context, HttpServerRouteSource.NESTED_CONTROLLER, this, name);
}
}
@Override
@Nullable
public String get(Context context, String name) {
if (name.isEmpty()) {
return null;
}
return ServletContextPath.prepend(context, JaxrsContextPath.prepend(context, name));
}
private ResteasySpanName() {}
}