Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@
import org.hypertrace.core.datamodel.AttributeValue;

public class JaegerHTTagsConverter {
private static final AttributeValue.Builder ATTRIBUTE_VALUE_BUILDER = AttributeValue.newBuilder();

public static AttributeValue createFromJaegerKeyValue(JaegerSpanInternalModel.KeyValue keyValue) {
AttributeValue.Builder valueBuilder = AttributeValue.newBuilder();
// newBuilder() in Avro classes uses SpecificData.getForSchema which uses
// reflection(Class.forName) for loading the class
// This may be too expensive when being done at a large scale(like in the case of
// AttributeValue).
// By using an existing empty builder to create a new builder we are bypassing the reflection
AttributeValue.Builder valueBuilder = AttributeValue.newBuilder(ATTRIBUTE_VALUE_BUILDER);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting to know!

switch (keyValue.getVType()) {
case STRING:
valueBuilder.setValue(keyValue.getVStr());
Expand Down