From 32d6a331e87f250e7ee788b6309f684241b99551 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Tue, 9 May 2017 10:42:51 +0200 Subject: [PATCH] Do not truncate reported strings --- .../main/java/com/uber/jaeger/Constants.java | 2 -- .../protocols/JaegerThriftSpanConverter.java | 11 +--------- .../JaegerThriftSpanConverterTest.java | 21 ------------------- .../senders/zipkin/ThriftSpanConverter.java | 10 +-------- 4 files changed, 2 insertions(+), 42 deletions(-) diff --git a/jaeger-core/src/main/java/com/uber/jaeger/Constants.java b/jaeger-core/src/main/java/com/uber/jaeger/Constants.java index 4d813c65a..438e6e354 100644 --- a/jaeger-core/src/main/java/com/uber/jaeger/Constants.java +++ b/jaeger-core/src/main/java/com/uber/jaeger/Constants.java @@ -26,8 +26,6 @@ public class Constants { // TODO these should be configurable public static final String X_UBER_SOURCE = "x-uber-source"; - public static final int MAX_TAG_LENGTH = 256; - /** * Span tag key to describe the type of sampler used on the root span. */ diff --git a/jaeger-core/src/main/java/com/uber/jaeger/reporters/protocols/JaegerThriftSpanConverter.java b/jaeger-core/src/main/java/com/uber/jaeger/reporters/protocols/JaegerThriftSpanConverter.java index e61d329e7..54ca6fb29 100644 --- a/jaeger-core/src/main/java/com/uber/jaeger/reporters/protocols/JaegerThriftSpanConverter.java +++ b/jaeger-core/src/main/java/com/uber/jaeger/reporters/protocols/JaegerThriftSpanConverter.java @@ -22,7 +22,6 @@ package com.uber.jaeger.reporters.protocols; -import com.uber.jaeger.Constants; import com.uber.jaeger.LogData; import com.uber.jaeger.Reference; import com.uber.jaeger.Span; @@ -126,14 +125,6 @@ static Tag buildTag(String tagKey, Object tagValue) { static void buildStringTag(Tag tag, Object tagValue) { tag.setVType(TagType.STRING); - String stringTagValue = String.valueOf(tagValue); - tag.setVStr(truncateString(stringTagValue)); - } - - protected static String truncateString(String s) { - if (s.length() > Constants.MAX_TAG_LENGTH) { - return s.substring(0, Constants.MAX_TAG_LENGTH); - } - return s; + tag.setVStr(String.valueOf(tagValue)); } } diff --git a/jaeger-core/src/test/java/com/uber/jaeger/reporters/protocols/JaegerThriftSpanConverterTest.java b/jaeger-core/src/test/java/com/uber/jaeger/reporters/protocols/JaegerThriftSpanConverterTest.java index 8b126f982..f4221deba 100644 --- a/jaeger-core/src/test/java/com/uber/jaeger/reporters/protocols/JaegerThriftSpanConverterTest.java +++ b/jaeger-core/src/test/java/com/uber/jaeger/reporters/protocols/JaegerThriftSpanConverterTest.java @@ -141,25 +141,4 @@ public void testConvertSpan() { assertEquals("k", thriftTag.getKey()); assertEquals("v", thriftTag.getVStr()); } - - @Test - public void testTruncateString() { - String testString = - "k9bHT50f9JNpPUggw3Qz\n" - + "Q1MUhMobIMPA5ItaB3KD\n" - + "vNUoBPRjOpJw2C46vgn3\n" - + "UisXI5KIIH8Wd8uqJ8Wn\n" - + "Z8NVmrcpIBwxc2Qje5d6\n" - + "1mJdQnPMc3VmX1v75As8\n" - + "pUyoicWVPeGEidRuhHpt\n" - + "R1sIR1YNjwtBIy9Swwdq\n" - + "LUIZXdLcPmCvQVPB3cYw\n" - + "VGAtFXG7D8ksLsKw94eY\n" - + "c7PNm74nEV3jIIvlJ217\n" - + "SLBfUBHW6SEjrHcz553i\n" - + "VSjpBvJYXR6CsoEMGce0\n" - + "LqSypCXJHDAzb0DL1w8B\n" - + "kS9g0wCgregSAlq63OIf"; - assertEquals(256, JaegerThriftSpanConverter.truncateString(testString).length()); - } } diff --git a/jaeger-zipkin/src/main/java/com/uber/jaeger/senders/zipkin/ThriftSpanConverter.java b/jaeger-zipkin/src/main/java/com/uber/jaeger/senders/zipkin/ThriftSpanConverter.java index 45bf6ccce..882be0e2d 100644 --- a/jaeger-zipkin/src/main/java/com/uber/jaeger/senders/zipkin/ThriftSpanConverter.java +++ b/jaeger-zipkin/src/main/java/com/uber/jaeger/senders/zipkin/ThriftSpanConverter.java @@ -27,7 +27,6 @@ import com.twitter.zipkin.thriftjava.BinaryAnnotation; import com.twitter.zipkin.thriftjava.Endpoint; import com.twitter.zipkin.thriftjava.zipkincoreConstants; -import com.uber.jaeger.Constants; import com.uber.jaeger.LogData; import com.uber.jaeger.Span; import com.uber.jaeger.SpanContext; @@ -134,14 +133,7 @@ private static List buildBinaryAnnotations(Span span, Endpoint private static BinaryAnnotation buildBinaryAnnotation(String tagKey, Object tagValue) { BinaryAnnotation banno = new BinaryAnnotation().setKey(tagKey); - - String stringTagValue = tagValue.toString(); - if (stringTagValue.length() > Constants.MAX_TAG_LENGTH) { - tagValue = stringTagValue.substring(0, Constants.MAX_TAG_LENGTH); - } - - banno.setValue(stringTagValue.getBytes(UTF_8)).setAnnotation_type(AnnotationType.STRING); - + banno.setValue(String.valueOf(tagValue).getBytes(UTF_8)).setAnnotation_type(AnnotationType.STRING); return banno; }