diff --git a/pom.xml b/pom.xml
index 76111f10a..01821f244 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,6 +135,12 @@
io.opentelemetry
opentelemetry-exporter-otlp
+
+
+ io.opentelemetry.instrumentation
+ opentelemetry-instrumentation-annotations
+ 2.6.0
+
io.opentelemetry.semconv
@@ -190,29 +196,29 @@
pom
- org.apache.axis2
- axis2-kernel
- ${axis2.version}
-
-
- org.apache.axis2
- axis2-transport-http
- ${axis2.version}
-
-
- org.apache.axis2
- axis2-transport-local
- ${axis2.version}
-
-
- org.apache.axis2
- axis2-adb
- ${axis2.version}
-
-
- org.apache.axis2
- axis2-jaxws
- ${axis2.version}
+ org.apache.axis2
+ axis2-kernel
+ ${axis2.version}
+
+
+ org.apache.axis2
+ axis2-transport-http
+ ${axis2.version}
+
+
+ org.apache.axis2
+ axis2-transport-local
+ ${axis2.version}
+
+
+ org.apache.axis2
+ axis2-adb
+ ${axis2.version}
+
+
+ org.apache.axis2
+ axis2-jaxws
+ ${axis2.version}
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 2ee1461a9..cca907b2b 100644
--- a/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java
+++ b/wsclient/src/main/java/org/hpccsystems/ws/client/BaseHPCCWsClient.java
@@ -1,7 +1,6 @@
package org.hpccsystems.ws.client;
import java.io.ByteArrayInputStream;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
@@ -43,14 +42,12 @@
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.OpenTelemetry;
-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.instrumentation.annotations.WithSpan;
import io.opentelemetry.semconv.HttpAttributes;
import io.opentelemetry.semconv.ServerAttributes;
@@ -91,6 +88,7 @@ public boolean isTargetHPCCContainerized() throws Exception
return targetsContainerizedHPCC;
}
+ @WithSpan
private boolean getTargetHPCCIsContainerized(Connection conn) throws Exception
{
if (wsconn == null)
@@ -155,6 +153,7 @@ public Version getTargetHPCCBuildVersion()
return targetHPCCBuildVersion;
}
+ @WithSpan
private String getTargetHPCCBuildVersionString() throws Exception
{
if (wsconn == null)
@@ -266,47 +265,29 @@ protected boolean initBaseWsClient(Connection connection, boolean fetchVersionAn
if (fetchVersionAndContainerMode)
{
- Span fetchHPCCVerSpan = getWsClientSpanBuilder("FetchHPCCVersion").setSpanKind(SpanKind.INTERNAL).startSpan();
- try (Scope scope = fetchHPCCVerSpan.makeCurrent())
+ try
{
- try
- {
- targetHPCCBuildVersion = new Version(getTargetHPCCBuildVersionString());
- }
- catch (Exception e)
- {
- initErrMessage = "BaseHPCCWsClient: Could not stablish target HPCC bulid version, review all HPCC connection values";
- if (!e.getLocalizedMessage().isEmpty())
- initErrMessage = initErrMessage + "\n" + e.getLocalizedMessage();
- success = false;
- }
+ targetHPCCBuildVersion = new Version(getTargetHPCCBuildVersionString());
}
- finally
+ catch (Exception e)
{
- fetchHPCCVerSpan.setStatus(success ? StatusCode.OK : StatusCode.ERROR, initErrMessage);
- fetchHPCCVerSpan.end();
+ initErrMessage = "BaseHPCCWsClient: Could not stablish target HPCC bulid version, review all HPCC connection values";
+ if (!e.getLocalizedMessage().isEmpty())
+ initErrMessage = initErrMessage + "\n" + e.getLocalizedMessage();
+ success = false;
}
- Span fetchHPCCContainerMode = getWsClientSpanBuilder("FetchHPCCContainerMode").startSpan();
- try (Scope scope = fetchHPCCContainerMode.makeCurrent())
+ try
{
- try
- {
- targetsContainerizedHPCC = getTargetHPCCIsContainerized(wsconn);
- }
- catch (Exception e)
- {
- initErrMessage = initErrMessage + "\nBaseHPCCWsClient: Could not determine target HPCC Containerization mode, review all HPCC connection values";
- if (!e.getLocalizedMessage().isEmpty())
- initErrMessage = initErrMessage + "\n" + e.getLocalizedMessage();
-
- success = false;
- }
+ targetsContainerizedHPCC = getTargetHPCCIsContainerized(wsconn);
}
- finally
+ catch (Exception e)
{
- fetchHPCCContainerMode.setStatus(success ? StatusCode.OK : StatusCode.ERROR, initErrMessage);
- fetchHPCCContainerMode.end();
+ initErrMessage = initErrMessage + "\nBaseHPCCWsClient: Could not determine target HPCC Containerization mode, review all HPCC connection values";
+ if (!e.getLocalizedMessage().isEmpty())
+ initErrMessage = initErrMessage + "\n" + e.getLocalizedMessage();
+
+ success = false;
}
}
if (!initErrMessage.isEmpty())
diff --git a/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCWsSMCClient.java b/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCWsSMCClient.java
index 777f4f80d..7b52e0189 100644
--- a/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCWsSMCClient.java
+++ b/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCWsSMCClient.java
@@ -35,6 +35,8 @@ HPCC SYSTEMS software Copyright (C) 2021 HPCC Systems®.
import org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper;
import org.hpccsystems.ws.client.wrappers.gen.wssmc.GetBuildInfoResponseWrapper;
+import io.opentelemetry.instrumentation.annotations.WithSpan;
+
/**
* Use as soap client for HPCC WsSMC web service, also known as eclwatch
*/
@@ -209,6 +211,7 @@ private void initWsSMCSoapProxy(Connection conn)
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public String getHPCCBuild() throws Exception
{
String build = null;
@@ -252,6 +255,7 @@ public String getHPCCBuild() throws Exception
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public boolean isContainerized() throws Exception
{
verifyStub();
@@ -297,6 +301,7 @@ public boolean isContainerized() throws Exception
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public GetBuildInfoResponseWrapper getBuildInfo() throws Exception
{
verifyStub();
diff --git a/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCWsWorkUnitsClient.java b/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCWsWorkUnitsClient.java
index 92a27d690..1f9506ba0 100644
--- a/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCWsWorkUnitsClient.java
+++ b/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCWsWorkUnitsClient.java
@@ -102,7 +102,9 @@
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.StatusCode;
+import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
+import io.opentelemetry.instrumentation.annotations.WithSpan;
/**
* Facilitates ECL WorkUnit related actions.
@@ -717,6 +719,7 @@ public WUPublishWorkunitResponse publishWU(WorkunitWrapper wu) throws Exception,
return publishWUWrapped(wu).getRaw();
}
+ @WithSpan
public WUPublishWorkunitResponseWrapper publishWUWrapped(WorkunitWrapper wu) throws Exception, ArrayOfEspExceptionWrapper
{
WUPublishWorkunitResponse publishWUResp = null;
@@ -753,6 +756,7 @@ public WUPublishWorkunitResponseWrapper publishWUWrapped(WorkunitWrapper wu) thr
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public void publishWU(String wuid) throws Exception
{
if (wuid == null || wuid.isEmpty())
@@ -798,6 +802,7 @@ public void publishWU(String wuid) throws Exception
* @throws ArrayOfEspExceptionWrapper a {@link org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper} object.
* the array of esp exception wrapper
*/
+ @WithSpan
public WorkunitWrapper getWUInfo(WUInfoRequestWrapper wuinfodetailsparams) throws Exception, ArrayOfEspExceptionWrapper
{
WorkunitWrapper workunit = null;
@@ -863,6 +868,7 @@ public WorkunitWrapper getWUInfo(String wuid) throws Exception, ArrayOfEspExcept
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public WorkunitWrapper getWUInfo(String wuid, boolean unarchive) throws Exception, ArrayOfEspExceptionWrapper
{
WUInfoRequestWrapper wuinfodetailsparams = new WUInfoRequestWrapper();
@@ -1066,6 +1072,7 @@ public boolean testWUQuery() throws Exception
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public List workUnitUQuery(String wuid, String jobname, String cluster, Boolean archived, WUQueryWrapper.SortBy sortby,
WUState state, Date endDate, Date startDate, Long pageStartFrom, Long pageSize, String owner,
List applicationValues) throws Exception, ArrayOfEspExceptionWrapper
@@ -1101,6 +1108,7 @@ public List workUnitUQuery(String wuid, String jobname, String
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public List workUnitUQuery(WUQueryWrapper info) throws Exception, ArrayOfEspExceptionWrapper
{
verifyStub(); // Throws exception if stub failed
@@ -1220,6 +1228,7 @@ public boolean doesWUContainErrors(String wuid) throws Exception, ArrayOfEspExce
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public WorkunitWrapper createWUFromECL(WorkunitWrapper wu) throws Exception, ArrayOfEspExceptionWrapper
{
WorkunitWrapper createdWU = null;
@@ -1307,6 +1316,7 @@ public WorkunitWrapper createWUFromECL(String archiveOrEcl, int resultLimit, Lis
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public List getWorkunits(String jobName, String owner, String ecl, Boolean archived, String wuid, String cluster, WUState state)
throws Exception, ArrayOfEspExceptionWrapper
{
@@ -1351,6 +1361,7 @@ public List getWorkunits(WUQueryWrapper params) throws Exceptio
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfECLExceptionWrapper
* the array of ECL exception wrapper
*/
+ @WithSpan
public WorkunitWrapper compileWUFromECL(WorkunitWrapper wu) throws Exception, ArrayOfEspExceptionWrapper, ArrayOfECLExceptionWrapper
{
Integer sleeptime = wu.getSleepMillis();
@@ -1394,6 +1405,7 @@ public WorkunitWrapper compileWUFromECL(WorkunitWrapper wu) throws Exception, Ar
* @param wusubmitwrapper a {@link org.hpccsystems.ws.client.wrappers.wsworkunits.WUSubmitWrapper} object.
* @throws Exception a {@link java.lang.Exception} object.
*/
+ @WithSpan
public void submitWU(WUSubmitWrapper wusubmitwrapper) throws Exception
{
if (wusubmitwrapper == null)
@@ -1446,6 +1458,7 @@ public void submitWU(WorkunitWrapper wu) throws Exception, ArrayOfEspExceptionWr
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public void submitWU(String wuid, String cluster) throws Exception, ArrayOfEspExceptionWrapper
{
verifyStub(); // Throws exception if stub failed
@@ -1488,6 +1501,7 @@ public void submitWU(String wuid, String cluster) throws Exception, ArrayOfEspEx
* the array of ECL exception wrapper
* @deprecated use createAndRunWUFromECLWrapped
*/
+ @WithSpan
public WURunResponse createAndRunWUFromECL(WorkunitWrapper wu) throws Exception, ArrayOfEspExceptionWrapper, ArrayOfECLExceptionWrapper
{
return createAndRunWUFromECLWrapped(wu).getRaw();
@@ -1506,6 +1520,7 @@ public WURunResponse createAndRunWUFromECL(WorkunitWrapper wu) throws Exception,
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfECLExceptionWrapper
* the array of ECL exception wrapper
*/
+ @WithSpan
public WURunResponseWrapper createAndRunWUFromECLWrapped(WorkunitWrapper wu) throws Exception, ArrayOfEspExceptionWrapper, ArrayOfECLExceptionWrapper
{
WURunResponse wuRunResponse = null;
@@ -1565,6 +1580,7 @@ public WURunResponseWrapper createAndRunWUFromECLWrapped(WorkunitWrapper wu) thr
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfECLExceptionWrapper
* the array of ECL exception wrapper
*/
+ @WithSpan
public String createAndRunWUFromECLAndGetResults(WorkunitWrapper wu) throws Exception, ArrayOfEspExceptionWrapper, ArrayOfECLExceptionWrapper
{
WURunResponse createAndRunWUFromECL = createAndRunWUFromECL(wu);
@@ -1585,6 +1601,7 @@ public String createAndRunWUFromECLAndGetResults(WorkunitWrapper wu) throws Exce
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfECLExceptionWrapper
* the array of ECL exception wrapper
*/
+ @WithSpan
public String createAndRunWUFromECLAndGetWUID(WorkunitWrapper wu) throws Exception, ArrayOfEspExceptionWrapper, ArrayOfECLExceptionWrapper
{
WURunResponse createAndRunWUFromECL = createAndRunWUFromECL(wu);
@@ -1612,6 +1629,7 @@ public String createAndRunWUFromECLAndGetWUID(WorkunitWrapper wu) throws Excepti
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public String fetchResultsFromLogicalName(String logicalName, int sequence, String cluster, boolean suppressXMLShema, long resultOffset,
int resultCount) throws Exception, ArrayOfEspExceptionWrapper
{
@@ -1644,6 +1662,7 @@ public String fetchResultsFromLogicalName(String logicalName, int sequence, Stri
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public String fetchResults(String wuid, int sequence, String cluster, boolean suppressXMLShema, long resultOffset, int resultCount)
throws Exception, ArrayOfEspExceptionWrapper
{
@@ -1676,6 +1695,7 @@ public String fetchResults(String wuid, int sequence, String cluster, boolean su
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public WUResultResponse fetchRawResults(String wuidorlogicalname, boolean useWuid, int sequence, String cluster, boolean suppressXMLShema,
long resultOffset, int resultCount) throws Exception
{
@@ -1735,6 +1755,7 @@ public static boolean looksLikeAWuid(String wuid)
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public WUResultResponse fetchRawResults(WUResult parameters) throws Exception
{
verifyStub(); // Throws exception if stub failed
@@ -1776,6 +1797,7 @@ private void refreshWU(boolean full, WorkunitWrapper wu) throws Exception, Array
* @throws ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
private void monitorWUToCompletion(WorkunitWrapper wu) throws Exception, ArrayOfEspExceptionWrapper
{
int timerTickCount = 0;
@@ -1837,6 +1859,7 @@ else if (timerTickCount < 120 && timerTickCount % 30 == 0)
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public ArrayOfECLExceptionWrapper syntaxCheckECL(String ecl, String cluster, Integer timeout) throws Exception
{
verifyStub(); // Throws exception if stub failed
@@ -1868,6 +1891,7 @@ public ArrayOfECLExceptionWrapper syntaxCheckECL(String ecl, String cluster, Int
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public WUQuerySetDetailsResponse getQueriesDetail(String querySetName, String clusterName, String filter) throws Exception
{
verifyStub(); // Throws exception if stub failed
@@ -1888,6 +1912,7 @@ public WUQuerySetDetailsResponse getQueriesDetail(String querySetName, String cl
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public void abortWU(String wuid) throws Exception
{
verifyStub(); // Throws exception if stub failed
@@ -1910,6 +1935,7 @@ public void abortWU(String wuid) throws Exception
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public void deleteWU(String wuid) throws Exception, ArrayOfEspExceptionWrapper
{
verifyStub(); // Throws exception if stub failed
@@ -1937,6 +1963,7 @@ public void deleteWU(String wuid) throws Exception, ArrayOfEspExceptionWrapper
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public void resubmitWU(String wuid, boolean restart, boolean clone) throws Exception
{
verifyStub(); // Throws exception if stub failed
@@ -2002,6 +2029,7 @@ public WUResultResponse getWorkunitResult(WUResult wur) throws Exception, ArrayO
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public String getWorkunitResult(String wuid, String resultname) throws Exception, ArrayOfEspExceptionWrapper
{
WUResult params = new WUResult();
@@ -2033,6 +2061,7 @@ public String getWorkunitResult(String wuid, String resultname) throws Exception
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public WUResultResponse getWorkunitResult(WUResult wur, boolean unarchive) throws Exception, ArrayOfEspExceptionWrapper
{
// get the object first to make sure it's not archived
@@ -2061,6 +2090,7 @@ public WUResultResponse getWorkunitResult(WUResult wur, boolean unarchive) throw
* @throws org.hpccsystems.ws.client.wrappers.ArrayOfEspExceptionWrapper
* the array of esp exception wrapper
*/
+ @WithSpan
public boolean doWorkunitAction(String wuid, ECLWUActions action) throws RemoteException, Exception, ArrayOfEspExceptionWrapper
{
verifyStub(); // Throws exception if stub failed
@@ -2139,6 +2169,7 @@ private String getEclWatchUrl() throws Exception
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public WorkunitWrapper createWorkunit() throws Exception
{
WUCreateRequestWrapper params = new WUCreateRequestWrapper();
@@ -2159,6 +2190,7 @@ public WorkunitWrapper createWorkunit() throws Exception
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public WorkunitWrapper protectWorkunit(String wuid) throws Exception
{
final WUUpdateRequestWrapper params = new WUUpdateRequestWrapper();
@@ -2191,6 +2223,7 @@ public WorkunitWrapper protectWorkunit(String wuid) throws Exception
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public WULogFileWrapper getWorkunitFile(String wuid, String filename, WUFileType filetype, String description, String ipaddr, boolean entirefile)
throws Exception
{
@@ -2230,6 +2263,7 @@ public WULogFileWrapper getWorkunitFile(String wuid, String filename, WUFileType
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public WorkunitWrapper runWorkunit(String wuid, HashMap namedvalues, HashMap appvalues, Integer timeout,
Boolean cloneWorkunit, String appsource) throws Exception
{
@@ -2304,6 +2338,7 @@ public WorkunitWrapper runWorkunit(String wuid, HashMap namedval
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public List searchQueries(QuerySetFilterType filtertype, String filtervalue, String querySetName, String clustername)
throws Exception
{
@@ -2362,6 +2397,7 @@ public List searchQueries(QuerySetFilterType filtertype, Str
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public List listQueries(String queryid, String queryname, String clustername, String querysetname, Integer pageSize,
Integer pageStartFrom, Boolean activated, String filename, Boolean descending) throws Exception
{
@@ -2425,6 +2461,7 @@ public List listQueries(String queryid, String queryname, St
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public List getQueryFiles(String queryname, String cluster) throws Exception
{
final WUQueryFiles request = new WUQueryFiles();
@@ -2462,6 +2499,7 @@ public List getQueryFiles(String queryname, String cluster) th
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public QueryResultWrapper activateQuery(String queryId, String cluster) throws Exception
{
final WUQuerysetQueryAction queryAction = new WUQuerysetQueryAction();
@@ -2505,6 +2543,7 @@ public QueryResultWrapper activateQuery(String queryId, String cluster) throws E
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public List deleteQueries(Set querynames, String cluster) throws Exception
{
verifyStub(); // Throws exception if stub failed
@@ -2553,29 +2592,20 @@ public List deleteQueries(Set querynames, String clu
* @throws java.lang.Exception
* the exception
*/
+ @WithSpan
public boolean ping() throws Exception
{
- Span span = getWsClientSpanBuilder("WsWUClient_Ping").startSpan();
- try (Scope scope = span.makeCurrent())
- {
- verifyStub(); // must be called within span scope for proper context propagation
+ verifyStub(); // must be called within span scope for proper context propagation
- Ping request = new Ping();
- try
- {
- ((WsWorkunitsStub) stub).ping(request);
- span.setStatus(StatusCode.OK);
- }
- catch (Exception e)
- {
- span.recordException(e);
- log.error(e.getLocalizedMessage());
- return false;
- }
+ Ping request = new Ping();
+ try
+ {
+ ((WsWorkunitsStub) stub).ping(request);
}
- finally
+ catch (Exception e)
{
- span.end();
+ log.error(e.getLocalizedMessage());
+ return false;
}
return true;
diff --git a/wsclient/src/main/java/org/hpccsystems/ws/client/platform/Platform.java b/wsclient/src/main/java/org/hpccsystems/ws/client/platform/Platform.java
index 6a283027d..8565e19e9 100644
--- a/wsclient/src/main/java/org/hpccsystems/ws/client/platform/Platform.java
+++ b/wsclient/src/main/java/org/hpccsystems/ws/client/platform/Platform.java
@@ -50,6 +50,8 @@
import org.hpccsystems.ws.client.wrappers.wsworkunits.WUQueryWrapper;
import org.hpccsystems.ws.client.wrappers.wsworkunits.WorkunitWrapper;
+import io.opentelemetry.instrumentation.annotations.WithSpan;
+
public class Platform extends DataSingleton
{
public static final String API_ID = "org.hpccsystems.ws.client"; //$NON-NLS-1$
@@ -86,6 +88,7 @@ public static Platform get(Connection conn)
* the pass
* @return the platform
*/
+ @WithSpan
public static Platform get(String protocol, String ip, int port, String user, String pass)
{
if (ip == null || ip.isEmpty() || port <= 0)
@@ -208,6 +211,7 @@ private enum SERVER_EXISTS
* @param hpccconn
* the hpccconn
*/
+ //@WithSpan
protected Platform(Connection hpccconn)
{
this(hpccconn, HPCCWsClientPool.DEFAULT_EXPIRE_MILLIS);
@@ -221,6 +225,7 @@ protected Platform(Connection hpccconn)
* @param pooltimeoutmillis
* the pooltimeoutmillis
*/
+ //@WithSpan
protected Platform(Connection hpccconn, long pooltimeoutmillis)
{
hpccClientPool = new HPCCWsClientPool(hpccconn, pooltimeoutmillis);
diff --git a/wsclient/src/main/java/org/hpccsystems/ws/client/utils/Connection.java b/wsclient/src/main/java/org/hpccsystems/ws/client/utils/Connection.java
index c5acac2e7..ee11305ca 100644
--- a/wsclient/src/main/java/org/hpccsystems/ws/client/utils/Connection.java
+++ b/wsclient/src/main/java/org/hpccsystems/ws/client/utils/Connection.java
@@ -24,6 +24,8 @@
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.StatusCode;
import io.opentelemetry.context.Scope;
+import io.opentelemetry.instrumentation.annotations.SpanAttribute;
+import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.opentelemetry.semconv.HttpAttributes;
import io.opentelemetry.semconv.ServerAttributes;
@@ -1055,21 +1057,22 @@ public String sendGetRequest(String uri) throws Exception
* @throws Exception a {@link java.lang.Exception} object.
* @return a {@link java.lang.String} object.
*/
- public String sendHTTPRequest(String uri, String method) throws Exception
+ @WithSpan
+ public String sendHTTPRequest(@SpanAttribute String uri, @SpanAttribute String method) throws Exception
{
if (method == null || method.isEmpty())
throw new Exception ("Must provide valid HTTP method");
URL url = new URL (getBaseUrl() + (uri != null && uri.startsWith("/") ? "" : "/") + uri);
- Span sendHTTPReqSpan = GlobalOpenTelemetry.get().getTracer(BaseHPCCWsClient.PROJECT_NAME)
+ /*Span sendHTTPReqSpan = GlobalOpenTelemetry.get().getTracer(BaseHPCCWsClient.PROJECT_NAME)
.spanBuilder(method.toUpperCase() + " " + url.toExternalForm())
.setAttribute(ServerAttributes.SERVER_ADDRESS, getHost())
.setAttribute(ServerAttributes.SERVER_PORT, Long.getLong(getPort()))
.setAttribute(HttpAttributes.HTTP_REQUEST_METHOD, method)
.setSpanKind(SpanKind.CLIENT)
.startSpan();
-
+*/
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); //throws IOException
Connection.log.info("Sending HTTP " + method + "Request to:" + url.toString());
@@ -1077,20 +1080,20 @@ public String sendHTTPRequest(String uri, String method) throws Exception
if (hasCredentials())
{
httpURLConnection.setRequestProperty("Authorization", getBasicAuthString());
- sendHTTPReqSpan.setAttribute("hasCredentials", true);
- }
- else
- {
- sendHTTPReqSpan.setAttribute("hasCredentials", false);
+ //sendHTTPReqSpan.setAttribute("hasCredentials", true);
}
+ //else
+ //{
+ //sendHTTPReqSpan.setAttribute("hasCredentials", false);
+ //}
- try (Scope scope = sendHTTPReqSpan.makeCurrent())
+ //try (Scope scope = sendHTTPReqSpan.makeCurrent())
{
httpURLConnection.setRequestProperty("traceparent", Utils.getCurrentSpanTraceParentHeader());
httpURLConnection.setRequestMethod(method); //throws ProtocolException
int responseCode = httpURLConnection.getResponseCode(); //throws IOException
- sendHTTPReqSpan.setAttribute("http.response.status_code", responseCode);
+ //sendHTTPReqSpan.setAttribute("http.response.status_code", responseCode);
Connection.log.info("HTTP Response code: " + responseCode);
if (responseCode == HttpURLConnection.HTTP_OK) //success
@@ -1105,18 +1108,18 @@ public String sendHTTPRequest(String uri, String method) throws Exception
}
in.close(); //throws IOException
- sendHTTPReqSpan.setStatus(StatusCode.OK);
+ // sendHTTPReqSpan.setStatus(StatusCode.OK);
return response.toString();
}
else
{
- sendHTTPReqSpan.setStatus(StatusCode.ERROR);
+ //sendHTTPReqSpan.setStatus(StatusCode.ERROR);
throw new IOException("HTTP request failed! Code (" + responseCode + ") " + httpURLConnection.getResponseMessage() );
}
}
- finally
- {
- sendHTTPReqSpan.end();
- }
+ //finally
+ //{
+ // sendHTTPReqSpan.end();
+ //}
}
}
diff --git a/wsclient/src/test/java/org/hpccsystems/ws/client/WSStoreClientTest.java b/wsclient/src/test/java/org/hpccsystems/ws/client/WSStoreClientTest.java
index 334033488..03bb46db9 100644
--- a/wsclient/src/test/java/org/hpccsystems/ws/client/WSStoreClientTest.java
+++ b/wsclient/src/test/java/org/hpccsystems/ws/client/WSStoreClientTest.java
@@ -38,6 +38,8 @@ HPCC SYSTEMS software Copyright (C) 2019 HPCC Systems®.
import org.junit.Test;
import org.junit.runners.MethodSorters;
+import io.opentelemetry.instrumentation.annotations.WithSpan;
+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class WSStoreClientTest extends BaseRemoteTest
{
@@ -106,21 +108,25 @@ public void printMetaData(int tabs, Properties props)
System.out.println(tabstr);
}
+ @WithSpan
public Properties fetchKeyMetaData(String storename, String namespace, String key, boolean global) throws Exception, ArrayOfEspExceptionWrapper
{
return client.fetchKeyMetaData(storename, namespace, key, global);
}
+ @WithSpan
public String fetchvalue(String storename, String namespace, String key, boolean global) throws Exception, ArrayOfEspExceptionWrapper
{
return client.fetchValue(storename, namespace, key, global);
}
+ @WithSpan
public String fetchvalueEncrypted(String storename, String namespace, String key, boolean global, String secretKey) throws Exception, ArrayOfEspExceptionWrapper
{
return client.fetchValueEncrypted(storename, namespace, key, global, secretKey);
}
+ @WithSpan
public void listNamespaceKeys(String store, String namespace, boolean global) throws Exception, ArrayOfEspExceptionWrapper
{
System.out.println("Listing Namespace Keys for default." + namespace + "...");
@@ -141,6 +147,7 @@ public void getContainerizedModeTest() throws Exception
}
@Test
+ @WithSpan
public void listNamespaces()
{
try
@@ -176,6 +183,7 @@ public void listNamespaces()
}
@Test
+ @WithSpan
public void a3fetchAllNSKeysTest()
{
try
@@ -196,6 +204,7 @@ public void a3fetchAllNSKeysTest()
}
@Test
+ @WithSpan
public void a2setTest() throws Exception, ArrayOfEspExceptionWrapper
{
try
@@ -218,6 +227,7 @@ public void a2setTest() throws Exception, ArrayOfEspExceptionWrapper
}
@Test
+ @WithSpan
public void a3setEncryptedTest() throws Exception, ArrayOfEspExceptionWrapper
{
try
@@ -265,6 +275,7 @@ public void a3setEncryptedTest() throws Exception, ArrayOfEspExceptionWrapper
}
@Test
+ @WithSpan
public void a3setEncryptedCustomTest()
{
//Generating random data as key content, client must keep track of this key in order to decrypt
@@ -342,6 +353,7 @@ public void a3setEncryptedCustomTest()
}
@Test
+ @WithSpan
public void a4deleteTest() throws Exception, ArrayOfEspExceptionWrapper
{
try
@@ -358,6 +370,7 @@ public void a4deleteTest() throws Exception, ArrayOfEspExceptionWrapper
}
@Test
+ @WithSpan
public void a1createStoreTest() throws Exception, ArrayOfEspExceptionWrapper
{
try
@@ -374,6 +387,7 @@ public void a1createStoreTest() throws Exception, ArrayOfEspExceptionWrapper
}
@Test
+ @WithSpan
public void z91deleteNSTest() throws Exception, ArrayOfEspExceptionWrapper
{
try
@@ -388,6 +402,7 @@ public void z91deleteNSTest() throws Exception, ArrayOfEspExceptionWrapper
}
@Test
+ @WithSpan
public void b1createEncodedStoreTest() throws Exception, ArrayOfEspExceptionWrapper
{
Assume.assumeNotNull(encodedUserClient);
@@ -405,6 +420,7 @@ public void b1createEncodedStoreTest() throws Exception, ArrayOfEspExceptionWrap
}
@Test
+ @WithSpan
public void zz91deleteEncodedNSTest() throws Exception, ArrayOfEspExceptionWrapper
{
Assume.assumeNotNull(encodedUserClient);
@@ -420,6 +436,7 @@ public void zz91deleteEncodedNSTest() throws Exception, ArrayOfEspExceptionWrapp
}
@Test
+ @WithSpan
public void a3fetchInvalidKeyTest()
{
try
@@ -440,6 +457,7 @@ public void a3fetchInvalidKeyTest()
}
@Test
+ @WithSpan
public void b4fetchAllEncodedNSKeysTest()
{
Assume.assumeNotNull(encodedUserClient);
@@ -461,6 +479,7 @@ public void b4fetchAllEncodedNSKeysTest()
}
@Test
+ @WithSpan
public void b4fetchEncodedNSKeysAttributesTest()
{
Assume.assumeNotNull(encodedUserClient);
@@ -482,6 +501,7 @@ public void b4fetchEncodedNSKeysAttributesTest()
}
@Test
+ @WithSpan
public void b4fetchEncodedKeyTest()
{
Assume.assumeNotNull(encodedUserClient);
@@ -509,6 +529,7 @@ public void b4fetchEncodedKeyTest()
}
@Test
+ @WithSpan
public void b3setEncodedTest() throws Exception, ArrayOfEspExceptionWrapper
{
Assume.assumeNotNull(encodedUserClient);
@@ -534,6 +555,7 @@ public void b3setEncodedTest() throws Exception, ArrayOfEspExceptionWrapper
}
@Test
+ @WithSpan
public void b4setEncryptedTest() throws Exception, ArrayOfEspExceptionWrapper
{
try
@@ -581,6 +603,7 @@ public void b4setEncryptedTest() throws Exception, ArrayOfEspExceptionWrapper
}
@Test
+ @WithSpan
public void b4setEncryptedCustomTest()
{
//Generating random data as key content, client must keep track of this key in order to decrypt
@@ -658,6 +681,7 @@ public void b4setEncryptedCustomTest()
}
@Test
+ @WithSpan
public void b5deleteTest() throws Exception, ArrayOfEspExceptionWrapper
{
try
diff --git a/wsclient/src/test/java/org/hpccsystems/ws/client/WSWorkunitsTest.java b/wsclient/src/test/java/org/hpccsystems/ws/client/WSWorkunitsTest.java
index 5457ba293..a6c80dbea 100644
--- a/wsclient/src/test/java/org/hpccsystems/ws/client/WSWorkunitsTest.java
+++ b/wsclient/src/test/java/org/hpccsystems/ws/client/WSWorkunitsTest.java
@@ -42,6 +42,7 @@ HPCC SYSTEMS software Copyright (C) 2019 HPCC Systems®.
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.StatusCode;
import io.opentelemetry.context.Scope;
+import io.opentelemetry.instrumentation.annotations.WithSpan;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class WSWorkunitsTest extends BaseRemoteTest
@@ -62,6 +63,7 @@ public static void setup() throws Exception
}
@Test
+ @WithSpan
public void testMultipleWsWUInits() throws InterruptedException
{
Callable callableTask = () ->
@@ -74,6 +76,7 @@ public void testMultipleWsWUInits() throws InterruptedException
}
@Test
+ @WithSpan
public void testSharedWsWUgets() throws InterruptedException
{
Callable callableTask = () -> {
@@ -87,30 +90,18 @@ public void testSharedWsWUgets() throws InterruptedException
@Test
public void stageA_ping() throws Exception
{
- Span pingSpan = getRemoteTestTraceBuilder("WsWUTests-PingTest").setSpanKind(SpanKind.CLIENT).startSpan();
-
- try (Scope innerScope = pingSpan.makeCurrent())
+ try
+ {
+ Assert.assertTrue(client.ping());
+ }
+ catch (AxisFault e)
{
- try
- {
- Assert.assertTrue(client.ping());
- pingSpan.setStatus(StatusCode.OK);
- }
- catch (AxisFault e)
- {
- pingSpan.recordException(e);
- e.printStackTrace();
- Assert.fail();
- }
- catch (Exception e)
- {
- pingSpan.recordException(e);
- Assert.fail(e.toString());
- }
+ e.printStackTrace();
+ Assert.fail();
}
- finally
+ catch (Exception e)
{
- pingSpan.end();
+ Assert.fail(e.toString());
}
}