Skip to content

Commit

Permalink
adapt to the new constructor for DimensionsSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
kkonstantine committed Sep 1, 2022
1 parent d161d22 commit 65d665a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ public class ExtractTransformTest
private static final MapInputRowParser PARSER = new MapInputRowParser(
new TimeAndDimsParseSpec(
new TimestampSpec("t", "auto", DateTimes.of("2020-01-01")),
new DimensionsSpec(
DimensionsSpec.getDefaultSchemas(ImmutableList.of("topic", "tenant")),
null,
null
)
new DimensionsSpec( DimensionsSpec.getDefaultSchemas(ImmutableList.of("topic", "tenant")))
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

import java.nio.ByteBuffer;
import java.time.Instant;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -54,7 +55,7 @@ public class OpenCensusBenchmark

private static final JSONParseSpec PARSE_SPEC = new JSONParseSpec(
new TimestampSpec("timestamp", "millis", null),
new DimensionsSpec(null, null, null),
new DimensionsSpec(Collections.emptyList()),
new JSONPathSpec(
true,
Lists.newArrayList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class OpenCensusProtobufInputRowParserTest

static final JSONParseSpec PARSE_SPEC = new JSONParseSpec(
new TimestampSpec("timestamp", "millis", null),
new DimensionsSpec(null, null, null),
new DimensionsSpec(Collections.emptyList()),
new JSONPathSpec(
true,
Lists.newArrayList(
Expand All @@ -79,7 +79,7 @@ public class OpenCensusProtobufInputRowParserTest
new DimensionsSpec(ImmutableList.of(
new StringDimensionSchema("foo_key"),
new StringDimensionSchema("env_key")
), null, null),
)),
new JSONPathSpec(
true,
Lists.newArrayList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class OpenTelemetryMetricsProtobufReaderTest
new StringDimensionSchema("descriptor." + METRIC_ATTRIBUTE_FOO_KEY),
new StringDimensionSchema("custom." + RESOURCE_ATTRIBUTE_ENV),
new StringDimensionSchema("custom." + RESOURCE_ATTRIBUTE_COUNTRY)
), null, null);
));

public static final String TOPIC = "telemetry.metrics.otel";
public static final int PARTITION = 2;
Expand Down Expand Up @@ -291,11 +291,11 @@ public void testDimensionSpecExclusions() throws IOException
.setKey(METRIC_ATTRIBUTE_FOO_KEY)
.setValue(AnyValue.newBuilder().setStringValue(METRIC_ATTRIBUTE_FOO_VAL).build()).build()));

DimensionsSpec dimensionsSpecWithExclusions = new DimensionsSpec(null,
DimensionsSpec dimensionsSpecWithExclusions = DimensionsSpec.builder().setDimensionExclusions(
ImmutableList.of(
"descriptor." + METRIC_ATTRIBUTE_COLOR,
"custom." + RESOURCE_ATTRIBUTE_COUNTRY
), null);
)).build();

MetricsData metricsData = metricsDataBuilder.build();
ConsumerRecord consumerRecord = new ConsumerRecord(TOPIC, PARTITION, OFFSET, TS, TSTYPE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public class OpenTelemetryBenchmark
new DimensionsSpec(ImmutableList.of(
new StringDimensionSchema("name"),
new StringDimensionSchema("value"),
new StringDimensionSchema("foo_key")),
null, null),
new StringDimensionSchema("foo_key"))),
null);

private static final OpenTelemetryMetricsProtobufInputFormat INPUT_FORMAT =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class OpenTelemetryMetricsProtobufReaderTest
new StringDimensionSchema("descriptor." + METRIC_ATTRIBUTE_FOO_KEY),
new StringDimensionSchema("custom." + RESOURCE_ATTRIBUTE_ENV),
new StringDimensionSchema("custom." + RESOURCE_ATTRIBUTE_COUNTRY)
), null, null);
));

@Rule
public ExpectedException expectedException = ExpectedException.none();
Expand Down Expand Up @@ -256,11 +256,10 @@ public void testDimensionSpecExclusions()

MetricsData metricsData = metricsDataBuilder.build();

DimensionsSpec dimensionsSpecWithExclusions = new DimensionsSpec(null,
ImmutableList.of(
DimensionsSpec dimensionsSpecWithExclusions = DimensionsSpec.builder().setDimensionExclusions(ImmutableList.of(
"descriptor." + METRIC_ATTRIBUTE_COLOR,
"custom." + RESOURCE_ATTRIBUTE_COUNTRY
), null);
)).build();

CloseableIterator<InputRow> rows = new OpenTelemetryMetricsProtobufReader(
dimensionsSpecWithExclusions,
Expand Down

0 comments on commit 65d665a

Please sign in to comment.