Skip to content

Commit

Permalink
Merge pull request quarkusio#24163 from knutwannheden/otel-1.12.0
Browse files Browse the repository at this point in the history
Bump OpenTelemetry version from 1.11.0 to 1.12.0
  • Loading branch information
gsmet authored Mar 14, 2022
2 parents fc4151b + 0d10c74 commit 21ef6b5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
4 changes: 2 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<opentracing-jdbc.version>0.2.4</opentracing-jdbc.version>
<opentracing-kafka.version>0.1.15</opentracing-kafka.version>
<opentracing-mongo.version>0.1.5</opentracing-mongo.version>
<opentelemetry.version>1.11.0</opentelemetry.version>
<opentelemetry-alpha.version>1.11.0-alpha</opentelemetry-alpha.version>
<opentelemetry.version>1.12.0</opentelemetry.version>
<opentelemetry-alpha.version>1.12.0-alpha</opentelemetry-alpha.version>
<jaeger.version>1.8.0</jaeger.version>
<quarkus-http.version>4.1.7</quarkus-http.version>
<micrometer.version>1.8.3</micrometer.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public String scheme(final HttpRequest request) {
}

@Override
public String serverName(final HttpRequest request, final HttpResponse response) {
public String serverName(final HttpRequest request) {
return request.remoteAddress().hostName();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import java.util.function.BiConsumer;

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.db.DbSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.db.SqlAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.db.DbClientSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.db.SqlClientAttributesExtractor;
import io.vertx.core.Context;
import io.vertx.core.spi.tracing.SpanKind;
import io.vertx.core.spi.tracing.TagExtractor;
Expand All @@ -21,14 +20,14 @@ public class SqlClientInstrumenterVertxTracer implements
private final Instrumenter<QueryTrace, QueryTrace> sqlClientInstrumenter;

public SqlClientInstrumenterVertxTracer(final OpenTelemetry openTelemetry) {
SqlClientAttributesExtractor sqlClientAttributesExtractor = new SqlClientAttributesExtractor();
SqlClientAttributesGetter sqlClientAttributesGetter = new SqlClientAttributesGetter();

InstrumenterBuilder<QueryTrace, QueryTrace> serverBuilder = Instrumenter.builder(
openTelemetry,
INSTRUMENTATION_NAME, DbSpanNameExtractor.create(sqlClientAttributesExtractor));
INSTRUMENTATION_NAME, DbClientSpanNameExtractor.create(sqlClientAttributesGetter));

this.sqlClientInstrumenter = serverBuilder
.addAttributesExtractor(sqlClientAttributesExtractor)
.addAttributesExtractor(SqlClientAttributesExtractor.create(sqlClientAttributesGetter))
.newClientInstrumenter((queryTrace, key, value) -> {
});
}
Expand Down Expand Up @@ -58,7 +57,6 @@ public <R> OpenTelemetryVertxTracer.SpanOperation sendRequest(
}

@Override
@SuppressWarnings("unchecked")
public <R> void receiveResponse(
final Context context,
final R response,
Expand Down Expand Up @@ -118,34 +116,31 @@ public String connectionString() {
}
}

static class SqlClientAttributesExtractor extends SqlAttributesExtractor<QueryTrace, QueryTrace> {
@Override
protected AttributeKey<String> dbTableAttribute() {
return null;
}
static class SqlClientAttributesGetter implements
io.opentelemetry.instrumentation.api.instrumenter.db.SqlClientAttributesGetter<QueryTrace> {

@Override
protected String rawStatement(final QueryTrace queryTrace) {
public String rawStatement(final QueryTrace queryTrace) {
return queryTrace.rawStatement();
}

@Override
protected String system(final QueryTrace queryTrace) {
public String system(final QueryTrace queryTrace) {
return queryTrace.system();
}

@Override
protected String user(final QueryTrace queryTrace) {
public String user(final QueryTrace queryTrace) {
return queryTrace.user();
}

@Override
protected String name(final QueryTrace queryTrace) {
public String name(final QueryTrace queryTrace) {
return null;
}

@Override
protected String connectionString(final QueryTrace queryTrace) {
public String connectionString(final QueryTrace queryTrace) {
return queryTrace.connectionString();
}
}
Expand Down

0 comments on commit 21ef6b5

Please sign in to comment.