diff --git a/src/main/java/io/appform/core/hystrix/CommandFactory.java b/src/main/java/io/appform/core/hystrix/CommandFactory.java index 90ace9c..5f7d1c4 100644 --- a/src/main/java/io/appform/core/hystrix/CommandFactory.java +++ b/src/main/java/io/appform/core/hystrix/CommandFactory.java @@ -30,7 +30,7 @@ public static GenericHystrixCommand create( public static GenericHystrixCommand create( String group, String command) { - return create(group,command, UUID.randomUUID().toString().replaceAll("-", "")); + return create(group,command, UUID.randomUUID().toString().replace("-", "")); } private CommandFactory() {} diff --git a/src/main/java/io/appform/core/hystrix/GenericHystrixCommand.java b/src/main/java/io/appform/core/hystrix/GenericHystrixCommand.java index 72644c1..14e19fa 100644 --- a/src/main/java/io/appform/core/hystrix/GenericHystrixCommand.java +++ b/src/main/java/io/appform/core/hystrix/GenericHystrixCommand.java @@ -59,7 +59,7 @@ protected R run() throws Exception { if (parentMDCContext != null) { MDC.setContextMap(parentMDCContext); } - final Span span = TracingHandler.startChildSpan(tracer, parentActiveSpan, command); + final Span span = TracingHandler.startChildSpan(tracer, parentActiveSpan, commandKey(group, command)); final Scope scope = TracingHandler.activateSpan(tracer, span); MDC.put(TRACE_ID, traceId); diff --git a/src/main/java/io/appform/core/hystrix/TracingHandler.java b/src/main/java/io/appform/core/hystrix/TracingHandler.java index bf68a79..7e0a67b 100644 --- a/src/main/java/io/appform/core/hystrix/TracingHandler.java +++ b/src/main/java/io/appform/core/hystrix/TracingHandler.java @@ -32,14 +32,15 @@ public static Span getParentActiveSpan(final Tracer tracer) { public static Span startChildSpan(final Tracer tracer, final Span parentSpan, - final String command) { + final String commandKey) { try { if (tracer == null || parentSpan == null) { return null; } - return tracer.buildSpan("hystrix:"+command) + + return tracer.buildSpan("hystrix:" + commandKey) .asChildOf(parentSpan) - .withTag("hystrix.command", command) + .withTag("hystrix.command", commandKey) .start(); } catch (Exception e) { log.error("Error while starting child span", e); @@ -73,4 +74,6 @@ public static void closeScopeAndSpan(final Span span, log.error("Error while closing span and scope", e); } } + + private TracingHandler() {} } diff --git a/src/test/java/io/appform/core/hystrix/CommandFactoryTest.java b/src/test/java/io/appform/core/hystrix/CommandFactoryTest.java index 8998161..987f608 100644 --- a/src/test/java/io/appform/core/hystrix/CommandFactoryTest.java +++ b/src/test/java/io/appform/core/hystrix/CommandFactoryTest.java @@ -51,4 +51,4 @@ public void testCreateCollectionCommand() { .execute(); Assert.assertEquals(result, list); } -} \ No newline at end of file +}