diff --git a/jaeger-core/src/main/java/com/uber/jaeger/Span.java b/jaeger-core/src/main/java/com/uber/jaeger/Span.java index f48b353d2..4e036dad2 100644 --- a/jaeger-core/src/main/java/com/uber/jaeger/Span.java +++ b/jaeger-core/src/main/java/com/uber/jaeger/Span.java @@ -223,7 +223,8 @@ private boolean handleSpecialTag(String key, Object value) { if (key.equals(Tags.SPAN_KIND.getKey()) && value instanceof String) { isClient = Tags.SPAN_KIND_CLIENT.equals(value); - isRPC = true; + boolean isServer = Tags.SPAN_KIND_SERVER.equals(value); + isRPC = isClient || isServer; return true; } diff --git a/jaeger-core/src/test/java/com/uber/jaeger/SpanTest.java b/jaeger-core/src/test/java/com/uber/jaeger/SpanTest.java index 73064fbd2..605ec9481 100644 --- a/jaeger-core/src/test/java/com/uber/jaeger/SpanTest.java +++ b/jaeger-core/src/test/java/com/uber/jaeger/SpanTest.java @@ -21,6 +21,12 @@ */ package com.uber.jaeger; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import com.uber.jaeger.metrics.InMemoryStatsReporter; import com.uber.jaeger.reporters.InMemoryReporter; import com.uber.jaeger.samplers.ConstSampler; @@ -31,11 +37,6 @@ import java.util.Random; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - public class SpanTest { private Clock clock; private InMemoryReporter reporter; @@ -247,13 +248,23 @@ public void testSpanDetectsLocalComponent() { } @Test - public void testSpanDetectsIsServer() { + public void testSpanDetectsIsClient() { Span span = (Span) tracer.buildSpan("test-service-operation").start(); Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT); + assertTrue(span.isRPC()); assertTrue(span.isRPCClient()); } + @Test + public void testSpanDetectsIsServer() { + Span span = (Span) tracer.buildSpan("test-service-operation").start(); + Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_SERVER); + + assertTrue(span.isRPC()); + assertFalse(span.isRPCClient()); + } + @Test public void testSpanDetectsSamplingPriorityGreaterThanZero() { Span span = (Span) tracer.buildSpan("test-service-operation").start();