Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now publish all instrumentations as well. #565

Merged
merged 8 commits into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/collect_libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ set -e
LIBS_DIR=./libs/
mkdir -p $LIBS_DIR >/dev/null 2>&1

cp workspace/java-agent/build/libs/*.jar $LIBS_DIR/
cp workspace/opentelemetry-javaagent/build/libs/*.jar $LIBS_DIR/
cp workspace/auto-exporters/*/build/libs/*.jar $LIBS_DIR/
2 changes: 1 addition & 1 deletion benchmark/benchmark.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jmh {
jmhVersion = '1.23' // Specifies JMH version
}

tasks.jmh.dependsOn(':opentelemetry-auto:shadowJar')
tasks.jmh.dependsOn(':opentelemetry-javaagent:shadowJar')

/*
If using libasyncProfiler, use the following to generate nice svg flamegraphs.
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ release {
def isCI = System.getenv("CI") != null

allprojects {
group = 'io.opentelemetry.auto'
group = 'io.opentelemetry.instrumentation.auto'

if (isCI) {
buildDir = "$rootDir/workspace/${projectDir.path.replace(rootDir.path, '')}/build/"
Expand All @@ -42,7 +42,7 @@ repositories {
mavenCentral()
}

description = 'trace-java'
description = 'OpenTelemetry instrumentations for Java'

wrapper {
distributionType = Wrapper.DistributionType.ALL
Expand Down
5 changes: 4 additions & 1 deletion gradle/instrumentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ byteBuddy {
}

apply from: "$rootDir/gradle/java.gradle"
if (project.ext.find("skipPublish") != true) {
apply from: "$rootDir/gradle/publish.gradle"
}

tasks.withType(Test) {
forkEvery = 1
Expand Down Expand Up @@ -43,7 +46,7 @@ afterEvaluate {
testImplementation project(':instrumentation:java-concurrent')
// FIXME: we should enable this, but currently this fails tests for google http client
//testImplementation project(':instrumentation:http-url-connection')
testImplementation project(':instrumentation:java-class-loader')
testImplementation project(':instrumentation:java-classloader')

testImplementation project(':testing')
testAnnotationProcessor deps.autoservice
Expand Down
2 changes: 1 addition & 1 deletion gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply from: "$rootDir/gradle/spotbugs.gradle"
def applyCodeCoverage = !(
project.path.startsWith(":smoke-tests") ||
//TODO why some tests fail on java 11 if jacoco is present?
project.path == ":opentelemetry-auto" ||
project.path == ":opentelemetry-javaagent" ||
project.path == ":load-generator" ||
project.path.startsWith(":benchmark") ||
project.path.startsWith(":instrumentation"))
Expand Down
23 changes: 20 additions & 3 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ publishing {
}
publications {
maven(MavenPublication) {
artifact javadocJar
artifact sourcesJar
artifact shadowJar
if (project.tasks.findByName("shadowJar") != null) {
project.shadow.component(it)
//These two are here just to satisfy Maven Central
artifact sourcesJar
artifact javadocJar
} else {
from components.java
}

artifactId = artifactPrefix(project) + artifactId

pom {
name = 'OpenTelemetry Instrumentation for Java'
Expand Down Expand Up @@ -50,6 +57,16 @@ publishing {
}
}

private String artifactPrefix(Project p){
if(p.name.startsWith("opentelemetry")){
return ''
}
if(p.group == 'io.opentelemetry.instrumentation.auto'){
return 'opentelemetry-auto-'
}
return 'opentelemetry-'
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_API_KEY')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ ext {
minJavaVersionForTests = JavaVersion.VERSION_1_8
}

group = 'io.opentelemetry.instrumentation'

apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/publish.gradle"
apply plugin: 'org.unbroken-dome.test-sets'

testSets {
Expand Down
1 change: 1 addition & 0 deletions instrumentation/cdi-testing/cdi-testing.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ext.skipPublish = true
apply from: "$rootDir/gradle/instrumentation.gradle"
apply plugin: 'org.unbroken-dome.test-sets'

Expand Down
3 changes: 2 additions & 1 deletion instrumentation/dropwizard-testing/dropwizard-testing.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ext.skipPublish = true
apply from: "$rootDir/gradle/instrumentation.gradle"

//apply plugin: 'org.unbroken-dome.test-sets'
Expand All @@ -10,7 +11,7 @@ apply from: "$rootDir/gradle/instrumentation.gradle"

dependencies {
testCompile project(':instrumentation:jaxrs:jaxrs-2.0')
testCompile project(':instrumentation:servlet:request-3.0')
testCompile project(':instrumentation:servlet:servlet-3.0')

// First version with DropwizardTestSupport:
testCompile group: 'io.dropwizard', name: 'dropwizard-testing', version: '0.8.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ext.skipPublish = true
apply from: "$rootDir/gradle/instrumentation.gradle"

dependencies {
testCompile project(':instrumentation:java-class-loader')
testCompile project(':instrumentation:java-classloader')

testCompile group: 'org.jboss.modules', name: 'jboss-modules', version: '1.3.10.Final'
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ext.skipPublish = true
apply from: "$rootDir/gradle/instrumentation.gradle"

dependencies {
testCompile project(':instrumentation:java-class-loader')
testCompile project(':instrumentation:java-classloader')

// TODO: we should separate core and Eclipse tests at some point,
// but right now core-specific tests are quite dump and are run with
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ext.skipPublish = true

apply from: "$rootDir/gradle/instrumentation.gradle"
apply plugin: 'org.unbroken-dome.test-sets'

Expand All @@ -17,7 +19,7 @@ testSets {
}

dependencies {
testCompile project(':instrumentation:java-class-loader')
testCompile project(':instrumentation:java-classloader')

//This seems to be the earliest version that has org.apache.catalina.loader.WebappClassLoaderBase
//Older versions would require slightly different instrumentation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Set properties before any plugins get loaded
ext {
minJavaVersionForTests = JavaVersion.VERSION_1_8
skipPublish = true
}

apply from: "$rootDir/gradle/instrumentation.gradle"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ext.skipPublish = true
apply from: "$rootDir/gradle/instrumentation.gradle"
apply from: "$rootDir/gradle/test-with-scala.gradle"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ext.skipPublish = true
apply from: "$rootDir/gradle/instrumentation.gradle"
apply from: "$rootDir/gradle/test-with-kotlin.gradle"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ext.skipPublish = true
apply from: "$rootDir/gradle/instrumentation.gradle"
apply from: "$rootDir/gradle/test-with-scala.gradle"

Expand Down
2 changes: 1 addition & 1 deletion instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ testSets {
dependencies {
compileOnly group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0'

testCompile project(':instrumentation:servlet:request-3.0')
testCompile project(':instrumentation:servlet:servlet-3.0')
testCompile project(':instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-jersey-2.0')
testCompile project(':instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-resteasy-3.0')
testCompile project(':instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-resteasy-3.1')
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/jsp-2.3/jsp-2.3.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
compileOnly group: 'javax.servlet.jsp', name: 'javax.servlet.jsp-api', version: '2.3.0'
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'

testCompile project(':instrumentation:servlet:request-3.0')
testCompile project(':instrumentation:servlet:servlet-3.0')
// using tomcat 7.0.37 because there seems to be some issues with Tomcat's jar scanning in versions < 7.0.37
// https://stackoverflow.com/questions/23484098/org-apache-tomcat-util-bcel-classfile-classformatexception-invalid-byte-tag-in
testCompile group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '7.0.37'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
ext {
maxJavaVersionForTests = JavaVersion.VERSION_1_8
skipPublish = true
}

apply from: "$rootDir/gradle/instrumentation.gradle"
apply plugin: 'org.unbroken-dome.test-sets'


testSets {
latestDepTest {
dirName = 'test'
}
}

dependencies {
testCompile project(':instrumentation:servlet:request-3.0')
testCompile project(':instrumentation:servlet:servlet-3.0')
testCompile project(':instrumentation:grizzly-2.0')

testCompile group: 'org.glassfish.main.extras', name: 'glassfish-embedded-all', version: '4.0'
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/servlet/servlet.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
testCompile group: 'javax.servlet', name: 'servlet-api', version: '2.3'

// servlet request instrumentation required for linking request to response.
testCompile project(':instrumentation:servlet:request-2.3')
testCompile project(':instrumentation:servlet:servlet-2.3')

// Don't want to conflict with jetty from the test server.
testImplementation(project(':testing')) {
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/spring-webmvc-3.1/spring-webmvc-3.1.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {

// Include servlet instrumentation for verifying the tomcat requests
testCompile project(':instrumentation:servlet')
testCompile project(':instrumentation:servlet:request-3.0')
testCompile project(':instrumentation:servlet:servlet-3.0')

testCompile group: 'javax.validation', name: 'validation-api', version: '1.1.0.Final'
testCompile group: 'org.hibernate', name: 'hibernate-validator', version: '5.4.2.Final'
Expand Down
4 changes: 2 additions & 2 deletions load-generator/load-generator.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ dependencies {
}

task launch(type: JavaExec) {
dependsOn ':opentelemetry-auto:shadowJar'
dependsOn ':opentelemetry-javaagent:shadowJar'
doFirst {
classpath = sourceSets.main.runtimeClasspath
main = 'io.opentelemetry.loadgenerator.LoadGenerator'
jvmArgs = ["-javaagent:${project(':opentelemetry-auto').shadowJar.archivePath}"]
jvmArgs = ["-javaagent:${project(':opentelemetry-javaagent').shadowJar.archivePath}"]
systemProperties System.properties
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id "com.github.johnrengelman.shadow"
}

description = 'opentelemetry-auto'
description = 'Auto instrumentation agent'

apply from: "$rootDir/gradle/java.gradle"
apply from: "$rootDir/gradle/version.gradle"
Expand Down Expand Up @@ -46,7 +46,6 @@ shadowJar {

//Includes instrumentations, but not exporters
task lightShadow(type: ShadowJar) {
archiveClassifier = ''
from sourceSets.main.output

def sourceTasks = [project(':instrumentation').tasks.shadowJar]
Expand All @@ -61,6 +60,7 @@ publishing {
}
}
}

tasks.withType(ShadowJar).configureEach {
configurations = [project.configurations.shadowInclude]
mergeServiceFiles()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public static String getAgentVersion() throws IOException {
try (final BufferedReader reader =
new BufferedReader(
new InputStreamReader(
thisClass.getResourceAsStream("/opentelemetry-auto.version"),
thisClass.getResourceAsStream("/opentelemetry-javaagent.version"),
StandardCharsets.UTF_8))) {

for (int c = reader.read(); c != -1; c = reader.read()) {
Expand Down
19 changes: 9 additions & 10 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gradleEnterprise {
rootProject.name = 'opentelemetry-java-instrumentation'

// agent projects
include ':java-agent'
include ':opentelemetry-javaagent'
include ':opentelemetry-sdk-shaded-for-testing'
include ':opentelemetry-api-beta-shaded-for-instrumenting'
include ':logback-shaded-for-instrumenting'
Expand Down Expand Up @@ -74,10 +74,10 @@ include ':instrumentation:hibernate:hibernate-4.3'
include ':instrumentation:hibernate:hibernate-common'
include ':instrumentation:http-url-connection'
include ':instrumentation:hystrix-1.4'
include ':instrumentation:java-class-loader'
include ':instrumentation:java-class-loader:jboss-testing'
include ':instrumentation:java-class-loader:osgi-testing'
include ':instrumentation:java-class-loader:tomcat-testing'
include ':instrumentation:java-classloader'
include ':instrumentation:java-classloader:jboss-testing'
include ':instrumentation:java-classloader:osgi-testing'
include ':instrumentation:java-classloader:tomcat-testing'
include ':instrumentation:java-concurrent'
include ':instrumentation:java-concurrent:java-completablefuture'
include ':instrumentation:java-concurrent:kotlin-testing'
Expand Down Expand Up @@ -126,7 +126,7 @@ include ':instrumentation:play-ws:play-ws-1.0'
include ':instrumentation:play-ws:play-ws-2.0'
include ':instrumentation:play-ws:play-ws-2.1'
include ':instrumentation:play-ws:play-ws-common'
include ':instrumentation:rabbitmq-amqp-2.7'
include ':instrumentation:rabbitmq-2.7'
include ':instrumentation:ratpack-1.5'
include ':instrumentation:reactor-3.1'
include ':instrumentation:rediscala-1.8'
Expand All @@ -135,11 +135,11 @@ include ':instrumentation:rxjava-1.0'
include ':instrumentation:servlet'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #586 to track what to do with the :instrumentation:servlet module

include ':instrumentation:servlet:glassfish-testing'
include ':instrumentation:servlet:servlet-common'
include ':instrumentation:servlet:request-2.3'
include ':instrumentation:servlet:request-3.0'
include ':instrumentation:servlet:servlet-2.3'
include ':instrumentation:servlet:servlet-3.0'
// FIXME this instrumentation relied on scope listener
// include ':instrumentation:slf4j-mdc'
include ':instrumentation:sparkjava-2.3'
include ':instrumentation:spark-web-framework-2.3'
include ':instrumentation:spring-data-1.8'
include ':instrumentation:spring-scheduling-3.1'
include ':instrumentation:spring-webmvc-3.1'
Expand Down Expand Up @@ -179,7 +179,6 @@ rootProject.children.each {

project(':agent-bootstrap').name = 'auto-bootstrap'
project(':agent-tooling').name = 'auto-tooling'
project(':java-agent').name = 'opentelemetry-auto'
project(':auto-exporters:jaeger').name = 'opentelemetry-auto-exporter-jaeger'
project(':auto-exporters:logging').name = 'opentelemetry-auto-exporter-logging'
project(':auto-exporters:otlp').name = 'opentelemetry-auto-exporter-otlp'
Expand Down
4 changes: 2 additions & 2 deletions smoke-tests/smoke-tests.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ dependencies {

subprojects { subProject ->
subProject.tasks.withType(Test).configureEach {
dependsOn = [':opentelemetry-auto:shadowJar', ':auto-exporters:opentelemetry-auto-exporter-logging:shadowJar']
dependsOn = [':opentelemetry-javaagent:shadowJar', ':auto-exporters:opentelemetry-auto-exporter-logging:shadowJar']

doFirst {
// Tests depend on this to know where to run things and what agent jar to use
jvmArgs "-Dio.opentelemetry.smoketest.builddir=${buildDir}"
jvmArgs "-Dio.opentelemetry.smoketest.agent.shadowJar.path=${project(':opentelemetry-auto').tasks.shadowJar.archivePath}"
jvmArgs "-Dio.opentelemetry.smoketest.agent.shadowJar.path=${project(':opentelemetry-javaagent').tasks.shadowJar.archivePath}"
jvmArgs "-Dota.exporter.jar=${project(':auto-exporters:opentelemetry-auto-exporter-logging').tasks.shadowJar.archivePath}"
}
}
Expand Down