Skip to content

Commit

Permalink
HPCC4J-647 FileUtility only use otel autosdk without javaagent (hpcc-…
Browse files Browse the repository at this point in the history
…systems#758)

Signed-off-by: James McMullan James.McMullan@lexisnexis.com
  • Loading branch information
jpmcmu authored Sep 18, 2024
1 parent f5ac34a commit 8ff2c62
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class FileUtility
private static final int NUM_DEFAULT_THREADS = 4;
static private final int DEFAULT_ACCESS_EXPIRY_SECONDS = 120;

private static boolean otelInitialized = false;
private static boolean otelNeedsInit = true;

private static class TaskContext
{
Expand Down Expand Up @@ -1973,7 +1973,7 @@ private static void performWrite(String[] args, TaskContext context)
*/
public static JSONArray run(String[] args)
{
if (!otelInitialized)
if (otelNeedsInit)
{
if (Boolean.getBoolean("otel.java.global-autoconfigure.enabled"))
{
Expand All @@ -1989,10 +1989,13 @@ public static JSONArray run(String[] args)
System.out.println(" otel.metrics.exporter: "+ System.getProperty("otel.metrics.exporter"));
System.out.println(" OTEL_METRICS_EXPORTER Env var: " + System.getenv("OTEL_METRICS_EXPORTER"));

OpenTelemetry otel = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk();
if (!org.hpccsystems.ws.client.utils.Utils.isOtelJavaagentUsed())
{
AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk();
}
}

otelInitialized = true;
otelNeedsInit = false;
}

Options options = getTopLevelOptions();
Expand Down

0 comments on commit 8ff2c62

Please sign in to comment.