Skip to content

Commit

Permalink
Switch to OpenTelemetry in Nessie Quarkus server
Browse files Browse the repository at this point in the history
  • Loading branch information
snazy committed Dec 2, 2022
1 parent fea0958 commit 0c2ecad
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Expand Up @@ -65,7 +65,7 @@ managed-maven-resolver = ["maven-resolver-connector-basic", "maven-resolver-tran
"maven-resolver-transport-http"]
managed-opentracing = ["opentracing-api", "opentracing-mock", "opentracing-util"]
managed-picocli = ["picocli", "picocli-codegen"]
managed-quarkus = ["quarkus-bom", "quarkus-smallrye-opentracing"]
managed-quarkus = ["quarkus-bom"]
managed-slf4j = ["slf4j-jcl-over-slf4j", "slf4j-log4j-over-slf4j", "slf4j-jcl-over-slf4j"]
managed-testcontainers = ["testcontainers-cockroachdb", "testcontainers-mongodb",
"testcontainers-postgresql", "testcontainers-testcontainers"]
Expand Down Expand Up @@ -177,7 +177,7 @@ protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "p
quarkus-amazon-services-bom = { module = "io.quarkus.platform:quarkus-amazon-services-bom", version.ref = "quarkusAmazon" }
quarkus-bom = { module = "io.quarkus:quarkus-bom", version.ref = "quarkus" }
quarkus-logging-sentry = { module = "io.quarkiverse.loggingsentry:quarkus-logging-sentry", version.ref = "quarkusLoggingSentry" }
quarkus-smallrye-opentracing = { module = "io.quarkus:quarkus-smallrye-opentracing", version.ref = "quarkus" }
quarkus-opentelemetry = { module = "io.quarkus:quarkus-opentelemetry", version.ref = "quarkus" }
rest-assured = { module = "io.rest-assured:rest-assured", version = "5.3.0" }
rocksdb-jni = { module = "org.rocksdb:rocksdbjni", version.ref = "rocksdb" }
scala-library-v212 = { module = "org.scala-lang:scala-library", version = { strictly = "[2.12, 2.13[", prefer = "2.12.17" }}
Expand Down
4 changes: 3 additions & 1 deletion servers/quarkus-server/build.gradle.kts
Expand Up @@ -56,7 +56,7 @@ dependencies {
implementation("io.quarkus:quarkus-smallrye-openapi")
implementation("io.quarkus:quarkus-micrometer")
implementation("io.quarkus:quarkus-core-deployment")
implementation(libs.quarkus.smallrye.opentracing)
implementation(libs.quarkus.opentelemetry)
implementation("io.quarkus:quarkus-container-image-jib")
implementation(libs.quarkus.logging.sentry)
implementation("io.smallrye:smallrye-open-api-jaxrs")
Expand All @@ -77,6 +77,8 @@ dependencies {
}

implementation(libs.guava)
implementation("io.opentelemetry:opentelemetry-opentracing-shim")
implementation(libs.opentracing.util)

openapiSource(project(":nessie-model", "openapiSource"))

Expand Down
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2022 Dremio
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.projectnessie.server.opentracing;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.opentracingshim.OpenTracingShim;
import io.opentracing.Tracer;
import io.opentracing.util.GlobalTracer;
import io.quarkus.runtime.Startup;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Singleton;

@ApplicationScoped
public class OpenTracingSupport {

@Inject OpenTelemetry openTelemetry;

@Produces
@Singleton
@Startup
public Tracer tracerShim() {
Tracer tracer = OpenTracingShim.createTracerShim(openTelemetry);
GlobalTracer.registerIfAbsent(tracer);
return tracer;
}
}
Expand Up @@ -131,6 +131,8 @@ quarkus.oidc.enabled=true
quarkus.swagger-ui.always-include=true
quarkus.swagger-ui.enable=true

quarkus.application.name=Nessie

## Quarkus monitoring and tracing settings
## jaeger specific settings
quarkus.jaeger.service-name=nessie
Expand Down Expand Up @@ -177,6 +179,9 @@ quarkus.micrometer.enabled=true
quarkus.micrometer.export.prometheus.enabled=true
quarkus.micrometer.binder.jvm=true

quarkus.opentelemetry.enabled=true
quarkus.opentelemetry.tracer.enabled=true

# Overrides
## dev overrides - dev is used when running Nessie in dev mode `mvn quarkus:dev`
%dev.quarkus.jaeger.sampler-type=const
Expand Down

0 comments on commit 0c2ecad

Please sign in to comment.