Skip to content

Commit

Permalink
Jaeger works
Browse files Browse the repository at this point in the history
  • Loading branch information
prdoyle committed Jun 20, 2024
1 parent 9be8075 commit 98d63a8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bosk-mongo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ java {
targetCompatibility = '17'
}

configurations {
otel
}

dependencies {
api project(":bosk-core")
api 'org.mongodb:mongodb-driver-sync:4.1.2'
Expand All @@ -24,8 +28,23 @@ dependencies {

testImplementation project(":bosk-testing")
testImplementation project(":lib-testing")

// OTEL
// implementation 'io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:2.5.0'
// testImplementation 'io.opentelemetry:opentelemetry-sdk:2.5.0'
testImplementation 'io.opentelemetry:opentelemetry-exporter-jaeger:1.34.1'
otel 'io.opentelemetry.javaagent:opentelemetry-javaagent:2.5.0'

}

test {
jvmArgs = [
"-javaagent:${configurations.otel.singleFile.absolutePath}",
"-Dotel.javaagent.configuration-file=${projectDir}/otel.properties"
]
}


pitest {
pitestVersion = '1.15.0'
junit5PluginVersion = '1.2.0'
Expand Down
9 changes: 9 additions & 0 deletions bosk-mongo/otel.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# otel-config.properties
otel.service.name=bosk-mongo-test
otel.resource.attributes=deployment.environment=test

otel.javaagent.logging=simple
otel.logs.exporter=none
otel.metrics.exporter=none

otel.traces.exporter=otlp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.model.changestream.ChangeStreamDocument;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.vena.bosk.BoskDriver;
import io.vena.bosk.BoskInfo;
import io.vena.bosk.Identifier;
Expand Down Expand Up @@ -581,6 +582,7 @@ private MDCScope beginDriverOperation(String description, Object... args) {
return ex;
}

@WithSpan
private <X extends Exception, Y extends Exception> void doRetryableDriverOperation(RetryableOperation<X,Y> operation, String description, Object... args) throws X,Y {
RetryableOperation<X,Y> operationInSession = () -> {
int immediateRetriesLeft = 2;
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/groovy/bosk.development.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ dependencies {
implementation "org.slf4j:slf4j-api:1.7.36"
testImplementation "ch.qos.logback:logback-classic:1.4.14"

implementation 'io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations:2.5.0'

testImplementation 'org.openjdk.jmh:jmh-core:1.37'
testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.37'

Expand Down
15 changes: 15 additions & 0 deletions docker/jaeger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3'

services:
jaeger:
image: jaegertracing/all-in-one:1.58
container_name: jaeger
ports:
- "5775:5775/udp" # UDP port for tchannel, used by the Jaeger agent
- "6831:6831/udp" # UDP port for the Jaeger agent
- "6832:6832/udp" # UDP port for the Jaeger agent
- "5778:5778" # HTTP port for the Jaeger agent's UI
- "16686:16686" # HTTP port for the Jaeger query service UI
- "14268:14268" # HTTP port for the Jaeger collector
- "14250:14250" # gRPC port for the Jaeger collector
- "4318:4318" # OTLP port for the Jaeger collector

0 comments on commit 98d63a8

Please sign in to comment.