Rename mongo modules (#206)

* Rename mongo modules

* Update tracer name
This commit is contained in:
Trask Stalnaker 2020-03-05 14:18:45 -08:00 committed by GitHub
parent 5ecdeba977
commit 2f1b802aad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 46 additions and 38 deletions

View File

@ -17,12 +17,16 @@ testSets {
}
}
// this is needed to force mongo-common test classes to be built first
// so that the dependency below on its test sourceSet will work
compileTestJava.dependsOn tasks.getByPath(':instrumentation:mongo-common:testClasses')
dependencies {
compile(project(':instrumentation:mongo'))
compile(project(':instrumentation:mongo-common'))
compileOnly group: 'org.mongodb', name: 'mongo-java-driver', version: '3.1.0'
testCompile project(':instrumentation:mongo').sourceSets.test.output
testCompile project(':instrumentation:mongo-common').sourceSets.test.output
testCompile group: 'de.flapdoodle.embed', name: 'de.flapdoodle.embed.mongo', version: '1.50.5'
testCompile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.1.0'

View File

@ -17,13 +17,17 @@ testSets {
}
}
// this is needed to force mongo-common test classes to be built first
// so that the dependency below on its test sourceSet will work
compileTestJava.dependsOn tasks.getByPath(':instrumentation:mongo-common:testClasses')
dependencies {
compile(project(':instrumentation:mongo'))
compile(project(':instrumentation:mongo-common'))
// a couple of test attribute verifications don't pass until 3.8.0
compileOnly group: 'org.mongodb', name: 'mongo-java-driver', version: '3.8.0'
testCompile project(':instrumentation:mongo').sourceSets.test.output
testCompile project(':instrumentation:mongo-common').sourceSets.test.output
testCompile group: 'de.flapdoodle.embed', name: 'de.flapdoodle.embed.mongo', version: '1.50.5'
testCompile group: 'org.mongodb', name: 'mongo-java-driver', version: '3.8.0'

View File

@ -24,12 +24,16 @@ testSets {
}
}
// this is needed to force mongo-common test classes to be built first
// so that the dependency below on its test sourceSet will work
compileTestJava.dependsOn tasks.getByPath(':instrumentation:mongo-common:testClasses')
dependencies {
compile(project(':instrumentation:mongo'))
compile(project(':instrumentation:mongo-common'))
compileOnly group: 'org.mongodb', name: 'mongodb-driver-async', version: '3.3.0'
testCompile project(':instrumentation:mongo').sourceSets.test.output
testCompile project(':instrumentation:mongo-common').sourceSets.test.output
testCompile group: 'de.flapdoodle.embed', name: 'de.flapdoodle.embed.mongo', version: '1.50.5'
testCompile group: 'org.mongodb', name: 'mongodb-driver-async', version: '3.3.0'

View File

@ -0,0 +1,7 @@
apply from: "${rootDir}/gradle/java.gradle"
dependencies {
compileOnly group: 'org.mongodb', name: 'mongo-java-driver', version: '3.1.0'
testCompile group: 'de.flapdoodle.embed', name: 'de.flapdoodle.embed.mongo', version: '1.50.5'
}

View File

@ -37,8 +37,9 @@ import org.bson.BsonValue;
public class MongoClientDecorator extends DatabaseClientDecorator<CommandStartedEvent> {
public static final MongoClientDecorator DECORATE = new MongoClientDecorator();
// TODO use tracer names *.mongo-3.1, *.mongo-3.7, *.mongo-async-3.3 respectively in each module
public static final Tracer TRACER =
OpenTelemetry.getTracerFactory().get("io.opentelemetry.auto.mongo-driver-3.1");
OpenTelemetry.getTracerFactory().get("io.opentelemetry.auto.mongo");
@Override
protected String service() {

View File

@ -48,7 +48,17 @@ class MongoBaseTest extends AgentTestRunner {
.net(new Net("localhost", port, Network.localhostIsIPv6()))
.build()
mongodExe = STARTER.prepare(mongodConfig)
// using a system-wide file lock to prevent other modules that may be running in parallel
// from clobbering each other while downloading and extracting mongodb
def lockFile = new File(System.getProperty("java.io.tmpdir"), "prepare-embedded-mongo.lock")
def channel = new RandomAccessFile(lockFile, "rw").getChannel()
def lock = channel.lock()
try {
mongodExe = STARTER.prepare(mongodConfig)
} finally {
lock.release()
channel.close()
}
mongod = mongodExe.start()
}

View File

@ -1,26 +0,0 @@
apply from: "${rootDir}/gradle/java.gradle"
dependencies {
compileOnly group: 'org.mongodb', name: 'mongo-java-driver', version: '3.1.0'
testCompile group: 'de.flapdoodle.embed', name: 'de.flapdoodle.embed.mongo', version: '1.50.5'
}
// Forcing strict test execution order (no parallel execution) to ensure proper mongo executable initialization.
List<Test> testTasks = []
tasks.withType(Test) { Test testTask ->
testTasks.each {
testTask.shouldRunAfter(it)
}
testTasks.add(testTask)
}
subprojects {
afterEvaluate {
tasks.withType(Test) { Test testTask ->
testTasks.each {
testTask.shouldRunAfter(it)
}
testTasks.add(testTask)
}
}
}

View File

@ -108,10 +108,10 @@ include ':instrumentation:log4j-events-2.0'
// FIXME this instrumentation relied on scope listener
// include ':instrumentation:log4j2'
include ':instrumentation:logback-events-1.0'
include ':instrumentation:mongo'
include ':instrumentation:mongo:driver-3.1'
include ':instrumentation:mongo:driver-3.7'
include ':instrumentation:mongo:driver-async-3.3'
include ':instrumentation:mongo-3.1'
include ':instrumentation:mongo-3.7'
include ':instrumentation:mongo-async-3.3'
include ':instrumentation:mongo-common'
include ':instrumentation:netty-4.0'
include ':instrumentation:netty-4.1'
include ':instrumentation:okhttp-3.0'
@ -166,3 +166,7 @@ project(':agent-bootstrap').name = 'auto-bootstrap'
project(':agent-tooling').name = 'auto-tooling'
project(':java-agent').name = 'opentelemetry-auto'
project(':instrumentation:mongo-3.1').projectDir = new File(settingsDir, 'instrumentation/mongo/mongo-3.1')
project(':instrumentation:mongo-3.7').projectDir = new File(settingsDir, 'instrumentation/mongo/mongo-3.7')
project(':instrumentation:mongo-async-3.3').projectDir = new File(settingsDir, 'instrumentation/mongo/mongo-async-3.3')
project(':instrumentation:mongo-common').projectDir = new File(settingsDir, 'instrumentation/mongo/mongo-common')