Skip to content

Commit

Permalink
fixes #2161 remove jaeger-tracer module as it is replaced by OpenTele…
Browse files Browse the repository at this point in the history
…metry (#2162)
  • Loading branch information
stevehu authored Feb 28, 2024
1 parent f903fe1 commit edcbfd7
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 128 deletions.
5 changes: 0 additions & 5 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
</dependency>
<dependency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-client</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.bitbucket.b_c</groupId>
<artifactId>jose4j</artifactId>
Expand Down

This file was deleted.

41 changes: 23 additions & 18 deletions client/src/main/java/com/networknt/client/Http2Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.networknt.client.ssl.TLSConfig;
import com.networknt.cluster.Cluster;
import com.networknt.config.Config;
import com.networknt.config.JsonMapper;
import com.networknt.httpstring.AttachmentConstants;
import com.networknt.exception.ClientException;
import com.networknt.httpstring.HttpStringConstants;
Expand All @@ -45,9 +44,6 @@
import com.networknt.utility.ModuleRegistry;
import com.networknt.config.TlsUtil;
import com.networknt.utility.StringUtils;
import io.opentracing.Tracer;
import io.opentracing.propagation.Format;
import io.opentracing.tag.Tags;
import io.undertow.Undertow;
import io.undertow.UndertowOptions;
import io.undertow.client.*;
Expand Down Expand Up @@ -594,6 +590,7 @@ public void addAuthTokenTrace(ClientRequest request, String token, String tracea
* @param token the bearer token
* @param tracer the OpenTracing tracer
*/
/*
public void addAuthTokenTrace(ClientRequest request, String token, Tracer tracer) {
if(token != null && !token.startsWith("Bearer ")) {
if(token.toUpperCase().startsWith("BEARER ")) {
Expand All @@ -611,6 +608,7 @@ public void addAuthTokenTrace(ClientRequest request, String token, Tracer tracer
tracer.inject(tracer.activeSpan().context(), Format.Builtin.HTTP_HEADERS, new ClientRequestCarrier(request));
}
}
*/

/**
* Add Client Credentials token cached in the client for standalone application
Expand Down Expand Up @@ -658,6 +656,11 @@ public Result addCcTokenTrace(ClientRequest request, String traceabilityId) {
*/
public Result propagateHeaders(ClientRequest request, final HttpServerExchange exchange) {
String token = exchange.getRequestHeaders().getFirst(Headers.AUTHORIZATION);
String tid = exchange.getRequestHeaders().getFirst(HttpStringConstants.TRACEABILITY_ID);
String cid = exchange.getRequestHeaders().getFirst(HttpStringConstants.CORRELATION_ID);
return populateHeader(request, token, cid, tid);

/*
boolean injectOpenTracing = config.isInjectOpenTracing();
if(injectOpenTracing) {
Tracer tracer = exchange.getAttachment(AttachmentConstants.EXCHANGE_TRACER);
Expand All @@ -667,6 +670,7 @@ public Result propagateHeaders(ClientRequest request, final HttpServerExchange e
String cid = exchange.getRequestHeaders().getFirst(HttpStringConstants.CORRELATION_ID);
return populateHeader(request, token, cid, tid);
}
*/
}

/**
Expand Down Expand Up @@ -703,19 +707,20 @@ public Result populateHeader(ClientRequest request, String authToken, String cor
return result;
}

/**
* Support API to API calls with scope token. The token is the original token from consumer and
* the client credentials token of caller API is added from cache. This method doesn't have correlationId
* and traceabilityId but has a Tracer for OpenTracing context passing. For standalone client, you create
* the Tracer instance and in the service to service call, the Tracer can be found in the JaegerStartupHookProvider
*
* This method is used in API to API call
*
* @param request the http request
* @param authToken the authorization token
* @param tracer the OpenTracing Tracer
* @return Result when fail to get jwt, it will return a Status.
*/
// /**
// * Support API to API calls with scope token. The token is the original token from consumer and
// * the client credentials token of caller API is added from cache. This method doesn't have correlationId
// * and traceabilityId but has a Tracer for OpenTracing context passing. For standalone client, you create
// * the Tracer instance and in the service to service call, the Tracer can be found in the JaegerStartupHookProvider
// *
// * This method is used in API to API call
// *
// * @param request the http request
// * @param authToken the authorization token
// * @param tracer the OpenTracing Tracer
// * @return Result when fail to get jwt, it will return a Status.
// */
/*
public Result populateHeader(ClientRequest request, String authToken, Tracer tracer) {
Result<Jwt> result = tokenManager.getJwt(request.getPath(), request.getRequestHeaders().getFirst(ClientConfig.SCOPE), request.getRequestHeaders().getFirst(ClientConfig.SERVICE_ID));
if(result.isFailure()) { return Failure.of(result.getError()); }
Expand All @@ -732,7 +737,7 @@ public Result populateHeader(ClientRequest request, String authToken, Tracer tra
}
return result;
}

*/


private static KeyStore loadKeyStore(final String name, final char[] password) throws IOException {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package io.undertow.server.handlers.proxy;

import com.networknt.client.ClientConfig;
import com.networknt.client.ServerExchangeCarrier;
import com.networknt.cluster.Cluster;
import com.networknt.config.ConfigException;
import com.networknt.httpstring.AttachmentConstants;
Expand All @@ -29,10 +28,6 @@
import com.networknt.service.SingletonServiceFactory;
import com.networknt.utility.Constants;
import com.networknt.utility.NetUtils;
import io.opentracing.Span;
import io.opentracing.Tracer;
import io.opentracing.propagation.Format;
import io.opentracing.tag.Tags;
import io.undertow.client.UndertowClient;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.AttachmentKey;
Expand Down Expand Up @@ -288,7 +283,7 @@ protected Host selectHost(HttpServerExchange exchange) {
ProxyConnectionPool.AvailabilityType available = selected.connectionPool.available();
if (available == AVAILABLE) {
// inject the jaeger tracer.
injectTracer(exchange, selected);
// injectTracer(exchange, selected);
return selected;
} else if (available == FULL && full == null) {
full = selected;
Expand All @@ -300,7 +295,7 @@ protected Host selectHost(HttpServerExchange exchange) {
} while (host != startHost);
if (full != null) {
// inject the jaeger tracer.
injectTracer(exchange, full);
// injectTracer(exchange, full);
return full;
}
if (problem != null) {
Expand All @@ -310,6 +305,7 @@ protected Host selectHost(HttpServerExchange exchange) {
return null;
}

/*
private void injectTracer(HttpServerExchange exchange, Host host) {
if(ClientConfig.get().isInjectOpenTracing()) {
Tracer tracer = exchange.getAttachment(AttachmentConstants.EXCHANGE_TRACER);
Expand All @@ -325,6 +321,7 @@ private void injectTracer(HttpServerExchange exchange, Host host) {
}
}
}
*/

/**
* Should only be used for tests
Expand Down
4 changes: 0 additions & 4 deletions http-string/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.networknt.httpstring;

import io.opentracing.Span;
import io.opentracing.Tracer;
import io.undertow.connector.PooledByteBuffer;
import io.undertow.util.AttachmentKey;

Expand All @@ -15,8 +13,9 @@
*/
public class AttachmentConstants {
// The key to the root span for this particular request attachment in exchange.
public static final AttachmentKey<Span> ROOT_SPAN = AttachmentKey.create(Span.class);
public static final AttachmentKey<Tracer> EXCHANGE_TRACER = AttachmentKey.create(Tracer.class);
// public static final AttachmentKey<Span> ROOT_SPAN = AttachmentKey.create(Span.class);
// public static final AttachmentKey<Tracer> EXCHANGE_TRACER = AttachmentKey.create(Tracer.class);

// The key to the audit info attachment in exchange. Allow other handlers to set values.
public static final AttachmentKey<Map> AUDIT_INFO = AttachmentKey.create(Map.class);
public static final AttachmentKey<Object> REQUEST_BODY = AttachmentKey.create(Object.class);
Expand Down
31 changes: 0 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@
<version.sqlserver>7.0.0.jre10</version.sqlserver>
<version.httpclient>4.5.14</version.httpclient>
<version.jsonpath>2.9.0</version.jsonpath>
<version.jaeger>1.8.1</version.jaeger>
<version.thrift>0.18.1</version.thrift>
<version.opentracing>0.33.0</version.opentracing>
<version.org.apache.directory.server>2.0.0-M15</version.org.apache.directory.server>
<version.maven-version>2.7</version.maven-version>
<version.nexus-staging-maven>1.6.8</version.nexus-staging-maven>
Expand Down Expand Up @@ -172,7 +169,6 @@
<module>encode-decode</module>
<module>monad-result</module>
<module>logger-config</module>
<module>jaeger-tracing</module>
<module>http-entity</module>
<module>egress-router</module>
<module>ingress-proxy</module>
Expand Down Expand Up @@ -459,12 +455,6 @@
<artifactId>server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>jaeger-tracing</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>http-entity</artifactId>
Expand Down Expand Up @@ -682,27 +672,6 @@
<artifactId>logback-classic</artifactId>
<version>${version.logback}</version>
</dependency>
<dependency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-client</artifactId>
<version>${version.jaeger}</version>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>${version.thrift}</version>
<exclusions>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<version>${version.opentracing}</version>
</dependency>

<!-- Test dependencies -->
<dependency>
Expand Down

0 comments on commit edcbfd7

Please sign in to comment.