diff --git a/pom.xml b/pom.xml
index 4762a4faf..643ee26ff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,6 +63,7 @@
org.hpccsystems.commons.annotations.BaseTests
1.0.0
false
+ 2.4.0-alpha
@@ -99,7 +100,48 @@
+
+
+
+ io.opentelemetry
+ opentelemetry-bom
+ 1.38.0
+ pom
+ import
+
+
+
+
+ io.opentelemetry
+ opentelemetry-api
+
+
+ io.opentelemetry
+ opentelemetry-sdk
+
+
+ io.opentelemetry
+ opentelemetry-exporter-logging
+
+
+ io.opentelemetry
+ opentelemetry-sdk-extension-autoconfigure
+
+
+ io.opentelemetry
+ opentelemetry-sdk-extension-autoconfigure-spi
+
+
+ io.opentelemetry
+ opentelemetry-exporter-otlp
+
+
+
+ io.opentelemetry.semconv
+ opentelemetry-semconv
+ 1.25.0-alpha
+
junit
junit
diff --git a/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java b/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java
index 2a856a5a2..58a5f3a21 100644
--- a/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java
+++ b/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java
@@ -4,6 +4,11 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.rmi.RemoteException;
+import java.text.Format;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.IntConsumer;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
@@ -27,6 +32,11 @@
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.hpccsystems.ws.client.gen.axis2.wsworkunits.latest.ECLWorkunit;
+import org.hpccsystems.ws.client.gen.axis2.wsworkunits.latest.EspSoapFault;
+import org.hpccsystems.ws.client.gen.axis2.wsworkunits.latest.WUQuery;
+import org.hpccsystems.ws.client.gen.axis2.wsworkunits.latest.WUQueryResponse;
+import org.hpccsystems.ws.client.gen.axis2.wsworkunits.latest.WsWorkunits;
import org.hpccsystems.ws.client.platform.Version;
import org.hpccsystems.ws.client.utils.Connection;
import org.hpccsystems.ws.client.utils.DataSingleton;
@@ -36,10 +46,36 @@
import org.hpccsystems.ws.client.wrappers.ArrayOfECLExceptionWrapper;
import org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper;
import org.hpccsystems.ws.client.wrappers.EspSoapFaultWrapper;
+import org.hpccsystems.ws.client.wrappers.WUState;
+import org.hpccsystems.ws.client.wrappers.wsworkunits.WorkunitWrapper;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import io.opentelemetry.api.GlobalOpenTelemetry;
+import io.opentelemetry.api.OpenTelemetry;
+import io.opentelemetry.api.common.Attributes;
+import io.opentelemetry.api.trace.Span;
+import io.opentelemetry.api.trace.SpanBuilder;
+import io.opentelemetry.api.trace.SpanKind;
+import io.opentelemetry.api.trace.StatusCode;
+import io.opentelemetry.api.trace.Tracer;
+import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator;
+import io.opentelemetry.context.Context;
+import io.opentelemetry.context.Scope;
+import io.opentelemetry.context.propagation.ContextPropagators;
+import io.opentelemetry.context.propagation.TextMapPropagator;
+import io.opentelemetry.context.propagation.TextMapSetter;
+import io.opentelemetry.sdk.OpenTelemetrySdk;
+import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;
+import io.opentelemetry.sdk.metrics.SdkMeterProvider;
+import io.opentelemetry.sdk.resources.Resource;
+import io.opentelemetry.sdk.trace.SdkTracerProvider;
+import io.opentelemetry.sdk.trace.export.BatchSpanProcessor;
+import io.opentelemetry.sdk.trace.samplers.Sampler;
+import io.opentelemetry.semconv.HttpAttributes;
+import io.opentelemetry.semconv.ServerAttributes;
+
/**
* Defines functionality common to all HPCC Systmes web service clients.
*
@@ -47,6 +83,8 @@
*/
public abstract class BaseHPCCWsClient extends DataSingleton
{
+ public static final String INSTRUMENTED_LIBRARY_NAME = "WsClient";
+ private Tracer tracer = null;
/** Constant log
*/
protected static final Logger log = LogManager.getLogger(BaseHPCCWsClient.class);
/** Constant DEAFULTECLWATCHPORT="8010"
*/
@@ -164,6 +202,89 @@ private String getTargetHPCCBuildVersionString() throws Exception
}
+ public SpanBuilder getSpanBuilder(String spanName)
+ {
+ Tracer tracer = getTracer(INSTRUMENTED_LIBRARY_NAME);
+ SpanBuilder spanBuilder = tracer.spanBuilder(spanName)
+ .setAttribute(ServerAttributes.SERVER_ADDRESS, wsconn.getHost())
+ .setAttribute(ServerAttributes.SERVER_PORT, Long.getLong(wsconn.getPort()))
+ .setAttribute(HttpAttributes.HTTP_REQUEST_METHOD, HttpAttributes.HttpRequestMethodValues.GET)
+ .setSpanKind(SpanKind.CLIENT);
+ //.startSpan();
+
+ return spanBuilder;
+ }
+
+ public void injectTraceParentHeader(Span currentSpan)
+ {
+ injectTraceParentHeader(stub._getServiceClient().getOptions(), currentSpan);
+ }
+
+ static public void injectTraceParentHeader(Options options, Span currentSpan)
+ {
+ if (options != null)
+ {
+ if (currentSpan != null && currentSpan.getSpanContext().isValid())
+ W3CTraceContextPropagator.getInstance().inject(Context.current(), options, Options::setProperty);
+ }
+ }
+
+ static public void injectCurrentSpanTraceParentHeader(Stub clientStub)
+ {
+ if (clientStub != null)
+ {
+ injectCurrentSpanTraceParentHeader(clientStub._getServiceClient().getOptions());
+ }
+ }
+
+ static public void injectCurrentSpanTraceParentHeader(Options options)
+ {
+ if (options != null)
+ {
+ injectTraceParentHeader(options, Span.current());
+ }
+ }
+
+ static public String getTraceParentHeader()
+ {
+ String traceparent = null;
+ Span currentSpan = Span.current();
+ if (currentSpan != null && currentSpan.getSpanContext().isValid())
+ {
+ Map carrier = new HashMap<>();
+ TextMapSetter