Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kamal-narayan committed Mar 21, 2023
1 parent 3b41e02 commit b74a499
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@
import org.apache.druid.data.input.InputFormat;
import org.apache.druid.data.input.InputRowSchema;
import org.apache.druid.data.input.opentelemetry.protobuf.Utils;
import org.apache.druid.java.util.common.StringUtils;

import java.io.File;
import java.util.Objects;

public class OpenTelemetryTracesProtobufInputFormat implements InputFormat
{

static String DEFAULT_SPAN_ATTR_PREFIX = "span.attr.";
static String DEFAULT_RESOURCE_ATTR_PREFIX = "resource.";
static String DEFAULT_SPAN_NAME_DIMENSION = "span";
static String DEFAULT_SPAN_ID_DIMENSION = "span_id";
Expand Down Expand Up @@ -119,16 +118,6 @@ private String validateDimensionName(String input, String dimensionName)
{
Preconditions.checkArgument(!input.isEmpty(),
dimensionName + " dimension cannot be empty");

if (!resourceAttributePrefix.isEmpty()) {
Preconditions.checkArgument(!input.startsWith(resourceAttributePrefix),
" cannot start with resourceAttributePrefix");
}

if (!spanAttributePrefix.isEmpty()) {
Preconditions.checkArgument(!input.startsWith(spanAttributePrefix),
" cannot start with spanAttributePrefix");
}
return input;
}

Expand All @@ -146,7 +135,7 @@ public OpenTelemetryTracesProtobufInputFormat(
)
{

this.spanAttributePrefix = spanAttributePrefix == null ? DEFAULT_SPAN_ATTR_PREFIX : spanAttributePrefix;
this.spanAttributePrefix = StringUtils.nullToEmptyNonDruidDataString(spanAttributePrefix);
this.resourceAttributePrefix = resourceAttributePrefix == null ? DEFAULT_RESOURCE_ATTR_PREFIX : resourceAttributePrefix;

this.spanNameDimension = spanNameDimension == null ? DEFAULT_SPAN_NAME_DIMENSION :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testDefaults() throws Exception
null,
null);
assertEquals(OpenTelemetryTracesProtobufInputFormat.DEFAULT_RESOURCE_ATTR_PREFIX, obj.getResourceAttributePrefix());
assertEquals(OpenTelemetryTracesProtobufInputFormat.DEFAULT_SPAN_ATTR_PREFIX, obj.getSpanAttributePrefix());
assertEquals("", obj.getSpanAttributePrefix());
assertEquals(OpenTelemetryTracesProtobufInputFormat.DEFAULT_KIND_DIMENSION, obj.getKindDimension());
assertEquals(OpenTelemetryTracesProtobufInputFormat.DEFAULT_SPAN_NAME_DIMENSION, obj.getSpanNameDimension());
assertEquals(OpenTelemetryTracesProtobufInputFormat.DEFAULT_PARENT_SPAN_ID_DIMENSION, obj.getParentSpanIdDimension());
Expand Down

0 comments on commit b74a499

Please sign in to comment.