Skip to content

Commit c1258cc

Browse files
author
Manpreet Singh
committed
Fixed the generation of trace & span Ids
1 parent d9f145f commit c1258cc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/io/opentelemetry/contrib/generator/telemetry/traces/SpansGenerator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ private ByteString[] getTraceIds(int count) {
225225
}
226226

227227
private ByteString getId(boolean isTrace) {
228-
String idString = isTrace ? IdGenerator.random().generateTraceId() : IdGenerator.random().generateSpanId();
228+
int beginIndex = isTrace ? 20 : 10;
229+
String idString = isTrace ? IdGenerator.random().generateTraceId().substring(beginIndex) :
230+
IdGenerator.random().generateSpanId().substring(beginIndex);
229231
return ByteString.copyFrom(Base64.getEncoder().encode(idString.getBytes()));
230232
}
231233

0 commit comments

Comments
 (0)