Skip to content

Commit

Permalink
Move instrumentation specific classes out of javaagent-instrumentatio…
Browse files Browse the repository at this point in the history
…n-api
  • Loading branch information
Mateusz Rzeszutek committed Jul 27, 2021
1 parent 262feb1 commit 4669004
Show file tree
Hide file tree
Showing 28 changed files with 61 additions and 23 deletions.
18 changes: 18 additions & 0 deletions buildSrc/src/main/kotlin/otel.javaagent-bootstrap.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import org.gradle.kotlin.dsl.project

plugins {
id("otel.java-conventions")
}

// make sure that archive name contains the instrumentation lib name
base.archivesName.set(projectDir.parentFile.name + "-bootstrap")

dependencies {
compileOnly("io.opentelemetry:opentelemetry-api")
compileOnly(project(":instrumentation-api"))
compileOnly(project(":javaagent-instrumentation-api"))

// this only exists to make Intellij happy since it doesn't (currently at least) understand our
// inclusion of this artifact inside of :instrumentation-api
compileOnly(project(":instrumentation-api-caching"))
}
3 changes: 3 additions & 0 deletions instrumentation/jaxrs/bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id("otel.javaagent-bootstrap")
}
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.javaagent.instrumentation.api;
package io.opentelemetry.javaagent.bootstrap.jaxrs;

import java.util.ArrayDeque;
import java.util.HashSet;
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.javaagent.instrumentation.api.jaxrs;
package io.opentelemetry.javaagent.bootstrap.jaxrs;

import io.opentelemetry.context.Context;
import io.opentelemetry.context.ContextKey;
Expand All @@ -12,7 +12,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 {@link
* combining servlet context path from {@code
* io.opentelemetry.instrumentation.api.servlet.ServletContextPath} jax-rs context path and the Path
* annotation from called method or class.
*/
Expand Down
2 changes: 2 additions & 0 deletions instrumentation/jaxrs/jaxrs-1.0/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ muzzle {
}

dependencies {
compileOnly(project(":instrumentation:jaxrs:bootstrap"))

compileOnly("javax.ws.rs:jsr311-api:1.1.1")

testImplementation("io.dropwizard:dropwizard-testing:0.7.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.opentelemetry.instrumentation.api.tracer.BaseTracer;
import io.opentelemetry.instrumentation.api.tracer.ServerSpan;
import io.opentelemetry.instrumentation.api.tracer.SpanNames;
import io.opentelemetry.javaagent.instrumentation.api.ClassHierarchyIterable;
import io.opentelemetry.javaagent.bootstrap.jaxrs.ClassHierarchyIterable;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ muzzle {
}

dependencies {
compileOnly(project(":instrumentation:jaxrs:bootstrap"))

compileOnly("javax.ws.rs:javax.ws.rs-api:2.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import io.opentelemetry.instrumentation.api.tracer.BaseTracer;
import io.opentelemetry.instrumentation.api.tracer.ServerSpan;
import io.opentelemetry.instrumentation.api.tracer.SpanNames;
import io.opentelemetry.javaagent.instrumentation.api.ClassHierarchyIterable;
import io.opentelemetry.javaagent.instrumentation.api.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.jaxrs.ClassHierarchyIterable;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ muzzle {
}

dependencies {
compileOnly(project(":instrumentation:jaxrs:bootstrap"))

compileOnly("javax.ws.rs:javax.ws.rs-api:2.0")
compileOnly("javax.servlet:javax.servlet-api:3.1.0")
library("org.apache.cxf:cxf-rt-frontend-jaxrs:3.2.0")
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.javaagent.bootstrap.jaxrs.JaxrsContextPath;
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.api.jaxrs.JaxrsContextPath;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
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.api.jaxrs.JaxrsContextPath;
import javax.servlet.http.HttpServletRequest;
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 @@ -12,7 +12,7 @@
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.instrumentation.api.tracer.ServerSpan;
import io.opentelemetry.javaagent.instrumentation.api.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
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 @@ -20,6 +20,8 @@ muzzle {
}

dependencies {
compileOnly(project(":instrumentation:jaxrs:bootstrap"))

compileOnly("javax.ws.rs:javax.ws.rs-api:2.0")
compileOnly("javax.servlet:javax.servlet-api:3.1.0")
library("org.glassfish.jersey.core:jersey-server:2.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
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.api.jaxrs.JaxrsContextPath;
import javax.servlet.http.HttpServletRequest;
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 @@ -12,7 +12,7 @@
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.instrumentation.api.tracer.ServerSpan;
import io.opentelemetry.javaagent.instrumentation.api.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
import java.util.Optional;
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 @@ -23,6 +23,8 @@ muzzle {
}

dependencies {
compileOnly(project(":instrumentation:jaxrs:bootstrap"))

compileOnly("javax.ws.rs:javax.ws.rs-api:2.0")
library("org.jboss.resteasy:resteasy-jaxrs:3.0.0.Final")

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.javaagent.bootstrap.jaxrs.JaxrsContextPath;
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.api.jaxrs.JaxrsContextPath;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
}

dependencies {
compileOnly(project(":instrumentation:jaxrs:bootstrap"))

compileOnly("javax.ws.rs:javax.ws.rs-api:2.0")
compileOnly("org.jboss.resteasy:resteasy-jaxrs:3.1.0.Final")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.instrumentation.api.InstrumentationContext;
import io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge;
import io.opentelemetry.javaagent.instrumentation.api.jaxrs.JaxrsContextPath;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
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.javaagent.bootstrap.jaxrs.JaxrsContextPath;
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.api.jaxrs.JaxrsContextPath;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import io.opentelemetry.instrumentation.api.servlet.ServerSpanNaming;
import io.opentelemetry.instrumentation.api.servlet.ServletContextPath;
import io.opentelemetry.instrumentation.api.tracer.ServerSpan;
import io.opentelemetry.javaagent.instrumentation.api.jaxrs.JaxrsContextPath;
import io.opentelemetry.javaagent.bootstrap.jaxrs.JaxrsContextPath;

public final class ResteasyTracingUtil {

Expand Down
3 changes: 3 additions & 0 deletions instrumentation/rmi/bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id("otel.javaagent-bootstrap")
}
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.javaagent.instrumentation.api.rmi;
package io.opentelemetry.javaagent.bootstrap.rmi;

import io.opentelemetry.context.Context;

Expand Down
4 changes: 4 additions & 0 deletions instrumentation/rmi/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ muzzle {
}
}

dependencies {
compileOnly(project(":instrumentation:rmi:bootstrap"))
}

tasks {
val rmic by registering(Exec::class) {
dependsOn(testClasses)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package io.opentelemetry.javaagent.instrumentation.rmi.context.server;

import static io.opentelemetry.javaagent.instrumentation.api.rmi.ThreadLocalContext.THREAD_LOCAL_CONTEXT;
import static io.opentelemetry.javaagent.bootstrap.rmi.ThreadLocalContext.THREAD_LOCAL_CONTEXT;
import static io.opentelemetry.javaagent.instrumentation.rmi.context.ContextPayload.GETTER;
import static io.opentelemetry.javaagent.instrumentation.rmi.context.ContextPropagator.CONTEXT_CALL_ID;
import static io.opentelemetry.javaagent.instrumentation.rmi.context.ContextPropagator.PROPAGATOR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

package io.opentelemetry.javaagent.instrumentation.rmi.server;

import static io.opentelemetry.javaagent.bootstrap.rmi.ThreadLocalContext.THREAD_LOCAL_CONTEXT;
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass;
import static io.opentelemetry.javaagent.instrumentation.api.rmi.ThreadLocalContext.THREAD_LOCAL_CONTEXT;
import static io.opentelemetry.javaagent.instrumentation.rmi.server.RmiServerTracer.tracer;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
Expand Down
6 changes: 1 addition & 5 deletions instrumentation/undertow-1.4/bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
plugins {
id("otel.java-conventions")
}

dependencies {
compileOnly("io.opentelemetry:opentelemetry-api")
id("otel.javaagent-bootstrap")
}
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ include(":instrumentation:hibernate:hibernate-procedure-call-4.3:javaagent")
include(":instrumentation:http-url-connection:javaagent")
include(":instrumentation:hystrix-1.4:javaagent")
include(":instrumentation:java-http-client:javaagent")
include(":instrumentation:jaxrs:bootstrap")
include(":instrumentation:jaxrs:jaxrs-1.0:javaagent")
include(":instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-arquillian-testing")
include(":instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-common:javaagent")
Expand Down Expand Up @@ -264,6 +265,7 @@ include(":instrumentation:reactor-netty:reactor-netty-0.9:javaagent")
include(":instrumentation:reactor-netty:reactor-netty-1.0:javaagent")
include(":instrumentation:rediscala-1.8:javaagent")
include(":instrumentation:redisson-3.0:javaagent")
include(":instrumentation:rmi:bootstrap")
include(":instrumentation:rmi:javaagent")
include(":instrumentation:rocketmq-client-4.8:javaagent")
include(":instrumentation:rocketmq-client-4.8:library")
Expand Down

0 comments on commit 4669004

Please sign in to comment.