Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Do not truncate reported strings #174

Merged
merged 1 commit into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions jaeger-core/src/main/java/com/uber/jaeger/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -134,14 +133,7 @@ private static List<BinaryAnnotation> 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;
}

Expand Down