diff --git a/addons-client/folo/client-java/src/main/java/org/commonjava/indy/folo/client/IndyFoloAdminClientModule.java b/addons-client/folo/client-java/src/main/java/org/commonjava/indy/folo/client/IndyFoloAdminClientModule.java
index 99d454e..b70b167 100644
--- a/addons-client/folo/client-java/src/main/java/org/commonjava/indy/folo/client/IndyFoloAdminClientModule.java
+++ b/addons-client/folo/client-java/src/main/java/org/commonjava/indy/folo/client/IndyFoloAdminClientModule.java
@@ -144,8 +144,6 @@ public void clearTrackingRecord( final String trackingId, final StoreType type,
public boolean sealTrackingRecord( String trackingId )
throws IndyClientException
{
- http.connect();
-
HttpPost request = http.newRawPost( UrlUtils.buildUrl( http.getBaseUrl(), "/folo/admin", trackingId, "record" ) );
HttpResources resources = null;
try
diff --git a/core-java/pom.xml b/core-java/pom.xml
index ff3359e..8bd4d9b 100644
--- a/core-java/pom.xml
+++ b/core-java/pom.xml
@@ -37,20 +37,20 @@
jhttpc
- org.commonjava.util
- o11yphant-trace-api
+ io.opentelemetry
+ opentelemetry-api
- org.commonjava.util
- o11yphant-trace-otel
+ io.opentelemetry
+ opentelemetry-sdk
- org.commonjava.util
- o11yphant-trace-helper-jhttpc
+ io.opentelemetry
+ opentelemetry-exporter-logging
- org.commonjava.util
- o11yphant-metrics-common
+ io.opentelemetry
+ opentelemetry-exporter-otlp
org.apache.httpcomponents
@@ -65,9 +65,8 @@
commons-io
- org.commonjava.indy
- indy-test-fixtures-core
- test
+ org.apache.commons
+ commons-lang3
diff --git a/core-java/src/main/java/org/commonjava/indy/client/core/Indy.java b/core-java/src/main/java/org/commonjava/indy/client/core/Indy.java
index ba90769..f0921ed 100644
--- a/core-java/src/main/java/org/commonjava/indy/client/core/Indy.java
+++ b/core-java/src/main/java/org/commonjava/indy/client/core/Indy.java
@@ -22,8 +22,6 @@
import org.commonjava.indy.inject.IndyVersioningProvider;
import org.commonjava.indy.model.core.io.IndyObjectMapper;
import org.commonjava.indy.stats.IndyVersioning;
-import org.commonjava.o11yphant.trace.TraceManager;
-import org.commonjava.o11yphant.trace.TracerConfiguration;
import org.commonjava.util.jhttpc.auth.PasswordManager;
import org.commonjava.util.jhttpc.model.SiteConfig;
@@ -213,10 +211,6 @@ public static final class Builder
private Map mdcCopyMappings;
- private TracerConfiguration existedTraceConfig;
-
- private TraceManager existedTraceManager;
-
private Builder()
{
}
@@ -252,18 +246,6 @@ public Builder setObjectMapper( IndyObjectMapper objectMapper )
return this;
}
- public Builder setExistedTraceConfig( TracerConfiguration existedTraceConfig )
- {
- this.existedTraceConfig = existedTraceConfig;
- return this;
- }
-
- public Builder setExistedTraceManager( TraceManager traceManager )
- {
- this.existedTraceManager = traceManager;
- return this;
- }
-
public Builder setAuthenticator( IndyClientAuthenticator authenticator )
{
this.authenticator = authenticator;
@@ -291,8 +273,6 @@ public Indy build()
.setApiVersion( indy.getApiVersion() )
.setLocation( this.location )
.setPasswordManager( this.passwordManager )
- .setExistedTraceConfig( this.existedTraceConfig )
- .setExistedTraceManager( this.existedTraceManager )
.setMdcCopyMappings( this.mdcCopyMappings )
.setObjectMapper( this.objectMapper )
.build();
diff --git a/core-java/src/main/java/org/commonjava/indy/client/core/IndyClientHttp.java b/core-java/src/main/java/org/commonjava/indy/client/core/IndyClientHttp.java
index 4eb5599..23aa055 100644
--- a/core-java/src/main/java/org/commonjava/indy/client/core/IndyClientHttp.java
+++ b/core-java/src/main/java/org/commonjava/indy/client/core/IndyClientHttp.java
@@ -32,7 +32,6 @@
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
@@ -41,14 +40,12 @@
import org.apache.http.util.VersionInfo;
import org.commonjava.indy.client.core.auth.IndyClientAuthenticator;
import org.commonjava.indy.client.core.helper.HttpResources;
-import org.commonjava.indy.client.core.metric.ClientMetricManager;
-import org.commonjava.indy.client.core.metric.ClientMetrics;
+import org.commonjava.indy.client.core.o11y.metric.ClientMetricManager;
+import org.commonjava.indy.client.core.o11y.metric.ClientMetrics;
+import org.commonjava.indy.client.core.o11y.trace.SpanningHttpFactory;
import org.commonjava.indy.inject.IndyVersioningProvider;
import org.commonjava.indy.model.core.ArtifactStore;
import org.commonjava.indy.model.core.io.IndyObjectMapper;
-import org.commonjava.o11yphant.jhttpc.SpanningHttpFactory;
-import org.commonjava.o11yphant.trace.TraceManager;
-import org.commonjava.o11yphant.trace.TracerConfiguration;
import org.commonjava.util.jhttpc.HttpFactory;
import org.commonjava.util.jhttpc.HttpFactoryIfc;
import org.commonjava.util.jhttpc.JHttpCException;
@@ -69,15 +66,12 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import java.util.function.Supplier;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.commonjava.indy.IndyContentConstants.CHECK_CACHE_ONLY;
import static org.commonjava.indy.client.core.helper.HttpResources.cleanupResources;
import static org.commonjava.indy.client.core.helper.HttpResources.entityToString;
-import static org.commonjava.indy.client.core.metric.ClientMetricConstants.HEADER_CLIENT_API;
-import static org.commonjava.indy.client.core.metric.ClientMetricConstants.HEADER_CLIENT_TRACE_ID;
import static org.commonjava.indy.client.core.util.UrlUtils.buildUrl;
import static org.commonjava.indy.stats.IndyVersioning.HEADER_INDY_API_VERSION;
@@ -121,7 +115,8 @@ public IndyClientHttp( final IndyClientAuthenticator authenticator, final IndyOb
this( mapper, location, apiVersion );
this.mdcCopyMappings = mdcCopyMappings;
metricManager = new ClientMetricManager( location );
- factory = new SpanningHttpFactory( new HttpFactory( authenticator ), metricManager.getTraceManager() );
+ factory = new SpanningHttpFactory( new HttpFactory( authenticator ),
+ metricManager.getTraceManager().orElse( null ) );
}
/**
@@ -135,7 +130,8 @@ public IndyClientHttp( final PasswordManager passwordManager, final IndyObjectMa
this( mapper, location, apiVersion );
metricManager = new ClientMetricManager( location );
- factory = new SpanningHttpFactory( new HttpFactory( passwordManager ), metricManager.getTraceManager() );
+ factory = new SpanningHttpFactory( new HttpFactory( passwordManager ),
+ metricManager.getTraceManager().orElse( null ) );
}
private IndyClientHttp( final IndyObjectMapper mapper, SiteConfig location, String apiVersion )
@@ -166,10 +162,6 @@ public static final class Builder
private String apiVersion;
- private TracerConfiguration existedTraceConfig;
-
- private TraceManager existedTraceManager;
-
private Map mdcCopyMappings;
private Builder()
@@ -206,18 +198,6 @@ public Builder setApiVersion( String apiVersion )
return this;
}
- public Builder setExistedTraceConfig( TracerConfiguration existedTraceConfig )
- {
- this.existedTraceConfig = existedTraceConfig;
- return this;
- }
-
- public Builder setExistedTraceManager( TraceManager traceManager )
- {
- this.existedTraceManager = traceManager;
- return this;
- }
-
public Builder setMdcCopyMappings( Map mdcCopyMappings )
{
this.mdcCopyMappings = mdcCopyMappings;
@@ -257,23 +237,8 @@ public IndyClientHttp build()
factory = new HttpFactory( this.passwordManager );
}
- ClientMetricManager metricManager;
- if ( this.existedTraceManager != null )
- {
- metricManager = new ClientMetricManager( this.existedTraceManager );
- }
- else if ( this.existedTraceConfig != null )
- {
- metricManager = new ClientMetricManager( this.existedTraceConfig );
- }
- else
- {
- metricManager = new ClientMetricManager( location );
- }
-
- client.metricManager = metricManager;
- client.factory = new SpanningHttpFactory( factory, metricManager.getTraceManager() );
-
+ client.metricManager = new ClientMetricManager( location );
+ client.factory = new SpanningHttpFactory( factory, client.metricManager.getTraceManager().orElse( null ) );
return client;
}
}
@@ -289,14 +254,6 @@ private void initUserAgent( final String apiVersion )
String.format( "Indy/%s (api: %s) via %s", indyVersion, apiVersion, hcUserAgent ) );
}
- private String addClientTraceHeader()
- {
- String traceId = UUID.randomUUID().toString();
- addDefaultHeader( HEADER_CLIENT_TRACE_ID, traceId );
- addDefaultHeader( HEADER_CLIENT_API, String.valueOf( true ) );
- return traceId;
- }
-
private void addApiVersionHeader( String apiVersion )
{
if ( isNotBlank( apiVersion ) )
@@ -318,24 +275,6 @@ private void checkBaseUrl( String baseUrl )
}
}
- /**
- * Not used since migration to jHTTPc library
- */
- @Deprecated
- public void connect( final HttpClientConnectionManager connectionManager )
- {
- // NOP, now that we've moved to HttpFactory.
- }
-
- /**
- * Not used since migration to jHTTPc library
- */
- @Deprecated
- public synchronized void connect()
- {
- // NOP, now that we've moved to HttpFactory.
- }
-
public Map head( final String path )
throws IndyClientException
{
@@ -347,7 +286,6 @@ public Map head( final String path, final int... responseCodes )
{
HttpHead request = newJsonHead( buildUrl( baseUrl, path ) );
- connect();
CloseableHttpResponse response = null;
CloseableHttpClient client = null;
ClientMetrics metrics = metricManager.register( request );
@@ -401,8 +339,6 @@ public T get( final String path, final Class type )
HttpGet request = newJsonGet( buildUrl( baseUrl, path ) );
ClientMetrics metrics = metricManager.register( request );
- connect();
-
CloseableHttpResponse response = null;
CloseableHttpClient client = null;
try
@@ -450,7 +386,6 @@ public T get( final String path, final TypeReference typeRef )
HttpGet request = newJsonGet( buildUrl( baseUrl, path ) );
ClientMetrics metrics = metricManager.register( request );
- connect();
CloseableHttpResponse response = null;
CloseableHttpClient client = null;
try
@@ -493,8 +428,6 @@ public HttpResources getRaw( final HttpGet req )
{
ClientMetrics metrics = metricManager.register( req );
- connect();
-
addLoggingMDCToHeaders( req );
CloseableHttpResponse response = null;
try
@@ -529,8 +462,6 @@ public HttpResources getRaw( final String path, final Map header
final HttpGet req = newRawGet( buildUrl( baseUrl, path ) );
ClientMetrics metrics = metricManager.register( req );
- connect();
-
CloseableHttpResponse response = null;
try
{
@@ -570,8 +501,6 @@ public void putWithStream( final String path, final InputStream stream, final in
final HttpPut put = newRawPut( buildUrl( baseUrl, path ) );
ClientMetrics metrics = metricManager.register( put );
- connect();
-
addLoggingMDCToHeaders( put );
final CloseableHttpClient client = newClient();
CloseableHttpResponse response = null;
@@ -625,7 +554,6 @@ public boolean put( final String path, final Object value, final int... response
ClientMetrics metrics = metricManager.register( put );
checkRequestValue( value );
- connect();
CloseableHttpResponse response = null;
CloseableHttpClient client = null;
@@ -664,8 +592,6 @@ public HttpResources execute( HttpRequestBase request )
{
ClientMetrics metrics = metricManager.register( request );
- connect();
-
addLoggingMDCToHeaders( request );
CloseableHttpResponse response = null;
try
@@ -702,7 +628,6 @@ public HttpResources postRaw( final String path, Object value, final Map T postWithResponse( final String path, final Object value, final Clas
checkRequestValue( value );
- connect();
-
CloseableHttpResponse response = null;
CloseableHttpClient client = null;
try
@@ -823,8 +746,6 @@ public T postWithResponse( final String path, final Object value, final Type
checkRequestValue( value );
- connect();
-
CloseableHttpResponse response = null;
CloseableHttpClient client = null;
try
@@ -887,8 +808,6 @@ public void delete( final String path, final int... responseCodes )
HttpDelete delete = newDelete( buildUrl( baseUrl, path ) );
ClientMetrics metrics = metricManager.register( delete );
- connect();
-
CloseableHttpResponse response = null;
CloseableHttpClient client = null;
try
@@ -929,8 +848,6 @@ public void deleteWithChangelog( final String path, final String changelog, fina
HttpDelete delete = newDelete( buildUrl( baseUrl, path ) );
ClientMetrics metrics = metricManager.register( delete );
- connect();
-
CloseableHttpResponse response = null;
CloseableHttpClient client = null;
try
@@ -984,8 +901,6 @@ public boolean exists( final String path, Supplier