Skip to content

Commit

Permalink
Move ServletContextPath to servlet-common:bootstrap (#4824)
Browse files Browse the repository at this point in the history
* Move ServletContextPath to servlet-common:bootstrap

* fix tests

* Simplify ServletContextPath calls in restlet instrumentation
  • Loading branch information
Mateusz Rzeszutek authored Dec 8, 2021
1 parent d590481 commit 0bab0c2
Show file tree
Hide file tree
Showing 74 changed files with 111 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ dependencies {
compileOnly("io.opentelemetry:opentelemetry-api")
compileOnly(project(":instrumentation-api"))
compileOnly(project(":javaagent-instrumentation-api"))

testImplementation("io.opentelemetry:opentelemetry-api")
testImplementation(project(":instrumentation-api"))
testImplementation(project(":javaagent-instrumentation-api"))
}
2 changes: 2 additions & 0 deletions instrumentation/grails-3.0/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ val grailsVersion = "3.0.6"
val springBootVersion = "1.2.5.RELEASE"

dependencies {
bootstrap(project(":instrumentation:servlet:servlet-common:bootstrap"))

library("org.grails:grails-plugin-url-mappings:$grailsVersion")

testInstrumentation(project(":instrumentation:servlet:servlet-3.0:javaagent"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package io.opentelemetry.javaagent.instrumentation.grails;

import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;
import org.grails.web.mapping.mvc.GrailsControllerUrlMappingInfo;

public class GrailsServerSpanNaming {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
package io.opentelemetry.javaagent.instrumentation.jaxrs.v1_0;

import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;

public class JaxrsServerSpanNaming {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
package io.opentelemetry.javaagent.instrumentation.jaxrs.v2_0;

import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;

public class JaxrsServerSpanNaming {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;
import org.apache.cxf.jaxrs.model.ClassResourceInfo;
import org.apache.cxf.jaxrs.model.OperationResourceInfo;
import org.apache.cxf.jaxrs.model.URITemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;
import javax.annotation.Nullable;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;
import javax.annotation.Nullable;

public final class ResteasySpanName implements ServerSpanNameSupplier<String> {
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/jaxrs/jaxrs-common/bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
id("otel.javaagent-bootstrap")
}

dependencies {
api(project(":instrumentation:servlet:servlet-common:bootstrap"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Helper container for storing context path for jax-rs requests. Jax-rs context path is the path
* where jax-rs servlet is mapped or the value of ApplicationPath annotation. Span name is built by
* combining servlet context path from {@code
* io.opentelemetry.instrumentation.api.servlet.ServletContextPath}, jax-rs context path and the
* io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath}, jax-rs context path and the
* Path annotation from called method or class.
*/
public final class JaxrsContextPath {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ muzzle {
}

configurations.configureEach {
if (!name.contains("muzzle")) {
// axis has a dependency on servlet api, get rid of it
if (name.contains("test")) {
// axis has a dependency on servlet2 api, get rid of it - otherwise the servlet3 instrumentation
// will fail during tests
exclude("javax.servlet", "servlet-api")
}
}

dependencies {
implementation(project(":instrumentation:jaxws:jaxws-2.0-axis2-1.6:library"))
bootstrap(project(":instrumentation:servlet:servlet-common:bootstrap"))

val axis2Version = "1.6.0"
library("org.apache.axis2:axis2-jaxws:$axis2Version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.axis2;
package io.opentelemetry.javaagent.instrumentation.axis2;

import static io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming.Source.CONTROLLER;
import static io.opentelemetry.instrumentation.axis2.Axis2Singletons.instrumenter;
import static io.opentelemetry.javaagent.instrumentation.axis2.Axis2Singletons.instrumenter;

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.axis2;
package io.opentelemetry.javaagent.instrumentation.axis2;

import org.apache.axis2.jaxws.core.MessageContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.axis2;
package io.opentelemetry.javaagent.instrumentation.axis2;

import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;
import javax.servlet.http.HttpServletRequest;
import org.apache.axis2.jaxws.core.MessageContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.axis2;
package io.opentelemetry.javaagent.instrumentation.axis2;

import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.api.config.ExperimentalConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import static net.bytebuddy.matcher.ElementMatchers.isTypeInitializer;
import static net.bytebuddy.matcher.ElementMatchers.named;

import io.opentelemetry.instrumentation.axis2.TracingInvocationListenerFactory;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import net.bytebuddy.asm.Advice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.axis2;
package io.opentelemetry.javaagent.instrumentation.axis2;

import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.server.InvocationListener;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
plugins {
id("otel.library-instrumentation")
id("otel.java-conventions")
}

dependencies {
compileOnly("javax.servlet:javax.servlet-api:3.0.1")
compileOnly("org.apache.cxf:cxf-rt-frontend-jaxws:3.0.0")

implementation(project(":instrumentation:jaxws:jaxws-2.0-cxf-3.0:javaagent"))

testImplementation(project(":instrumentation-api"))
testImplementation("org.apache.cxf:cxf-rt-frontend-jaxws:3.0.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ muzzle {
}

dependencies {
implementation(project(":instrumentation:jaxws:jaxws-2.0-cxf-3.0:library"))
bootstrap(project(":instrumentation:servlet:servlet-common:bootstrap"))

library("org.apache.cxf:cxf-rt-frontend-jaxws:3.0.0")
compileOnly("javax.servlet:javax.servlet-api:3.0.1")

testLibrary("org.apache.cxf:cxf-rt-transports-http:3.0.0")

testImplementation(project(":instrumentation:jaxws:jaxws-2.0-common-testing"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package io.opentelemetry.javaagent.instrumentation.cxf;

import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;
import javax.servlet.http.HttpServletRequest;

public class CxfServerSpanNaming {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ muzzle {
}

dependencies {
bootstrap(project(":instrumentation:servlet:servlet-common:bootstrap"))

library("com.sun.xml.ws:jaxws-rt:2.2.0.1")

compileOnly("javax.servlet:javax.servlet-api:3.0.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import com.sun.xml.ws.api.message.Packet;
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;
import javax.servlet.http.HttpServletRequest;
import javax.xml.ws.handler.MessageContext;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
plugins {
id("otel.library-instrumentation")
id("otel.javaagent-instrumentation")
}

dependencies {
compileOnly(project(":instrumentation:servlet:servlet-common:bootstrap"))

compileOnly("jakarta.faces:jakarta.faces-api:2.3.2")
compileOnly("jakarta.el:jakarta.el-api:3.0.3")
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.jsf;
package io.opentelemetry.javaagent.instrumentation.jsf;

import io.opentelemetry.instrumentation.api.instrumenter.ErrorCauseExtractor;
import javax.faces.FacesException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.jsf;
package io.opentelemetry.javaagent.instrumentation.jsf;

import java.util.Objects;
import javax.faces.component.ActionSource2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.jsf;
package io.opentelemetry.javaagent.instrumentation.jsf;

import io.opentelemetry.instrumentation.api.servlet.ServerSpanNameSupplier;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.javaagent.bootstrap.servlet.ServletContextPath;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ tasks {
dependencies {
compileOnly("javax.faces:jsf-api:1.2")

implementation(project(":instrumentation:jsf:jsf-common:library"))
implementation(project(":instrumentation:jsf:jsf-common:javaagent"))

testImplementation(project(":instrumentation:jsf:jsf-common:testing"))
testInstrumentation(project(":instrumentation:servlet:servlet-3.0:javaagent"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.instrumentation.jsf.JsfRequest;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge;
import io.opentelemetry.javaagent.instrumentation.jsf.JsfRequest;
import javax.faces.event.ActionEvent;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.api.config.ExperimentalConfig;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.jsf.JsfErrorCauseExtractor;
import io.opentelemetry.instrumentation.jsf.JsfRequest;
import io.opentelemetry.javaagent.instrumentation.jsf.JsfErrorCauseExtractor;
import io.opentelemetry.javaagent.instrumentation.jsf.JsfRequest;

public class MojarraSingletons {
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.mojarra-1.2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;

import io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming;
import io.opentelemetry.instrumentation.jsf.JsfServerSpanNaming;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.instrumentation.jsf.JsfServerSpanNaming;
import javax.faces.context.FacesContext;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
compileOnly("org.apache.myfaces.core:myfaces-api:1.2.12")
compileOnly("javax.el:el-api:1.0")

implementation(project(":instrumentation:jsf:jsf-common:library"))
implementation(project(":instrumentation:jsf:jsf-common:javaagent"))

testImplementation(project(":instrumentation:jsf:jsf-common:testing"))
testInstrumentation(project(":instrumentation:servlet:servlet-3.0:javaagent"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.instrumentation.jsf.JsfRequest;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge;
import io.opentelemetry.javaagent.instrumentation.jsf.JsfRequest;
import javax.faces.event.ActionEvent;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package io.opentelemetry.javaagent.instrumentation.myfaces;

import io.opentelemetry.instrumentation.jsf.JsfErrorCauseExtractor;
import io.opentelemetry.javaagent.instrumentation.jsf.JsfErrorCauseExtractor;
import javax.el.ELException;

public class MyFacesErrorCauseExtractor extends JsfErrorCauseExtractor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.api.config.ExperimentalConfig;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.jsf.JsfRequest;
import io.opentelemetry.javaagent.instrumentation.jsf.JsfRequest;

public class MyFacesSingletons {
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.myfaces-1.2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;

import io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming;
import io.opentelemetry.instrumentation.jsf.JsfServerSpanNaming;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.instrumentation.jsf.JsfServerSpanNaming;
import javax.faces.context.FacesContext;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ repositories {

dependencies {
api(project(":instrumentation:restlet:restlet-1.0:library"))
bootstrap(project(":instrumentation:servlet:servlet-common:bootstrap"))

library("org.restlet:org.restlet:1.1.5")
library("com.noelios.restlet:com.noelios.restlet:1.1.5")
Expand Down
Loading

0 comments on commit 0bab0c2

Please sign in to comment.