|
|
@ -70,13 +70,14 @@ import io.netty.handler.codec.http.HttpResponseStatus; |
|
|
|
import io.opentelemetry.api.GlobalOpenTelemetry; |
|
|
|
import io.opentelemetry.api.GlobalOpenTelemetry; |
|
|
|
import io.opentelemetry.api.baggage.propagation.W3CBaggagePropagator; |
|
|
|
import io.opentelemetry.api.baggage.propagation.W3CBaggagePropagator; |
|
|
|
import io.opentelemetry.api.trace.Span; |
|
|
|
import io.opentelemetry.api.trace.Span; |
|
|
|
|
|
|
|
import io.opentelemetry.api.trace.SpanKind; |
|
|
|
import io.opentelemetry.api.trace.StatusCode; |
|
|
|
import io.opentelemetry.api.trace.StatusCode; |
|
|
|
import io.opentelemetry.api.trace.Tracer; |
|
|
|
import io.opentelemetry.api.trace.Tracer; |
|
|
|
import io.opentelemetry.context.Context; |
|
|
|
import io.opentelemetry.context.Context; |
|
|
|
|
|
|
|
import io.opentelemetry.context.propagation.TextMapGetter; |
|
|
|
import io.opentelemetry.context.propagation.TextMapPropagator; |
|
|
|
import io.opentelemetry.context.propagation.TextMapPropagator; |
|
|
|
import io.opentelemetry.extension.trace.propagation.B3Propagator; |
|
|
|
import io.opentelemetry.extension.trace.propagation.B3Propagator; |
|
|
|
import io.opentelemetry.extension.trace.propagation.JaegerPropagator; |
|
|
|
import io.opentelemetry.extension.trace.propagation.JaegerPropagator; |
|
|
|
import io.opentelemetry.extension.trace.propagation.TraceMultiPropagator; |
|
|
|
|
|
|
|
import io.vertx.core.CompositeFuture; |
|
|
|
import io.vertx.core.CompositeFuture; |
|
|
|
import io.vertx.core.Future; |
|
|
|
import io.vertx.core.Future; |
|
|
|
import io.vertx.core.Handler; |
|
|
|
import io.vertx.core.Handler; |
|
|
@ -114,13 +115,13 @@ public class JsonRpcHttpService { |
|
|
|
private static final String EMPTY_RESPONSE = ""; |
|
|
|
private static final String EMPTY_RESPONSE = ""; |
|
|
|
|
|
|
|
|
|
|
|
private static final TextMapPropagator traceFormats = |
|
|
|
private static final TextMapPropagator traceFormats = |
|
|
|
TraceMultiPropagator.create( |
|
|
|
TextMapPropagator.composite( |
|
|
|
JaegerPropagator.getInstance(), |
|
|
|
JaegerPropagator.getInstance(), |
|
|
|
B3Propagator.getInstance(), |
|
|
|
B3Propagator.injectingSingleHeader(), |
|
|
|
W3CBaggagePropagator.getInstance()); |
|
|
|
W3CBaggagePropagator.getInstance()); |
|
|
|
|
|
|
|
|
|
|
|
private static final TextMapPropagator.Getter<HttpServerRequest> requestAttributesGetter = |
|
|
|
private static final TextMapGetter<HttpServerRequest> requestAttributesGetter = |
|
|
|
new TextMapPropagator.Getter<>() { |
|
|
|
new TextMapGetter<>() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Iterable<String> keys(final HttpServerRequest carrier) { |
|
|
|
public Iterable<String> keys(final HttpServerRequest carrier) { |
|
|
|
return carrier.headers().names(); |
|
|
|
return carrier.headers().names(); |
|
|
@ -142,7 +143,7 @@ public class JsonRpcHttpService { |
|
|
|
private final NatService natService; |
|
|
|
private final NatService natService; |
|
|
|
private final Path dataDir; |
|
|
|
private final Path dataDir; |
|
|
|
private final LabelledMetric<OperationTimer> requestTimer; |
|
|
|
private final LabelledMetric<OperationTimer> requestTimer; |
|
|
|
private final Tracer tracer; |
|
|
|
private Tracer tracer; |
|
|
|
private final int maxActiveConnections; |
|
|
|
private final int maxActiveConnections; |
|
|
|
private final AtomicInteger activeConnectionsCount = new AtomicInteger(); |
|
|
|
private final AtomicInteger activeConnectionsCount = new AtomicInteger(); |
|
|
|
|
|
|
|
|
|
|
@ -210,7 +211,6 @@ public class JsonRpcHttpService { |
|
|
|
this.authenticationService = authenticationService; |
|
|
|
this.authenticationService = authenticationService; |
|
|
|
this.livenessService = livenessService; |
|
|
|
this.livenessService = livenessService; |
|
|
|
this.readinessService = readinessService; |
|
|
|
this.readinessService = readinessService; |
|
|
|
this.tracer = GlobalOpenTelemetry.getTracer("org.hyperledger.besu.jsonrpc", "1.0.0"); |
|
|
|
|
|
|
|
this.maxActiveConnections = config.getMaxActiveConnections(); |
|
|
|
this.maxActiveConnections = config.getMaxActiveConnections(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -226,6 +226,7 @@ public class JsonRpcHttpService { |
|
|
|
public CompletableFuture<?> start() { |
|
|
|
public CompletableFuture<?> start() { |
|
|
|
LOG.info("Starting JSON-RPC service on {}:{}", config.getHost(), config.getPort()); |
|
|
|
LOG.info("Starting JSON-RPC service on {}:{}", config.getHost(), config.getPort()); |
|
|
|
LOG.debug("max number of active connections {}", maxActiveConnections); |
|
|
|
LOG.debug("max number of active connections {}", maxActiveConnections); |
|
|
|
|
|
|
|
this.tracer = GlobalOpenTelemetry.getTracer("org.hyperledger.besu.jsonrpc", "1.0.0"); |
|
|
|
|
|
|
|
|
|
|
|
final CompletableFuture<?> resultFuture = new CompletableFuture<>(); |
|
|
|
final CompletableFuture<?> resultFuture = new CompletableFuture<>(); |
|
|
|
try { |
|
|
|
try { |
|
|
@ -365,7 +366,7 @@ public class JsonRpcHttpService { |
|
|
|
tracer |
|
|
|
tracer |
|
|
|
.spanBuilder(address.host() + ":" + address.port()) |
|
|
|
.spanBuilder(address.host() + ":" + address.port()) |
|
|
|
.setParent(parent) |
|
|
|
.setParent(parent) |
|
|
|
.setSpanKind(Span.Kind.SERVER) |
|
|
|
.setSpanKind(SpanKind.SERVER) |
|
|
|
.startSpan(); |
|
|
|
.startSpan(); |
|
|
|
routingContext.put(SPAN_CONTEXT, Context.current().with(serverSpan)); |
|
|
|
routingContext.put(SPAN_CONTEXT, Context.current().with(serverSpan)); |
|
|
|
|
|
|
|
|
|
|
@ -695,7 +696,7 @@ public class JsonRpcHttpService { |
|
|
|
Span span = |
|
|
|
Span span = |
|
|
|
tracer |
|
|
|
tracer |
|
|
|
.spanBuilder(requestBody.getMethod()) |
|
|
|
.spanBuilder(requestBody.getMethod()) |
|
|
|
.setSpanKind(Span.Kind.INTERNAL) |
|
|
|
.setSpanKind(SpanKind.INTERNAL) |
|
|
|
.setParent(ctx.get(SPAN_CONTEXT)) |
|
|
|
.setParent(ctx.get(SPAN_CONTEXT)) |
|
|
|
.startSpan(); |
|
|
|
.startSpan(); |
|
|
|
try { |
|
|
|
try { |
|
|
|