[Breaking Change] Rename getEmpty() to empty() (#2831)
This commit is contained in:
parent
43f1ecf7ed
commit
20a1601089
|
@ -27,7 +27,7 @@ final class ArrayBasedTraceStateBuilder implements TraceStateBuilder {
|
||||||
private final ArrayBasedTraceState parent;
|
private final ArrayBasedTraceState parent;
|
||||||
@Nullable private List<String> entries;
|
@Nullable private List<String> entries;
|
||||||
|
|
||||||
static TraceState getEmpty() {
|
static TraceState empty() {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public interface TraceState {
|
||||||
* @return the default {@code TraceState} with no entries.
|
* @return the default {@code TraceState} with no entries.
|
||||||
*/
|
*/
|
||||||
static TraceState getDefault() {
|
static TraceState getDefault() {
|
||||||
return ArrayBasedTraceStateBuilder.getEmpty();
|
return ArrayBasedTraceStateBuilder.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns an empty {@code TraceStateBuilder}. */
|
/** Returns an empty {@code TraceStateBuilder}. */
|
||||||
|
|
|
@ -259,8 +259,8 @@ class OtlpGrpcMetricExporterTest {
|
||||||
long startNs = TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
|
long startNs = TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
|
||||||
long endNs = startNs + TimeUnit.MILLISECONDS.toNanos(900);
|
long endNs = startNs + TimeUnit.MILLISECONDS.toNanos(900);
|
||||||
return MetricData.createLongSum(
|
return MetricData.createLongSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
|
|
@ -121,7 +121,7 @@ class TraceMarshalerTest {
|
||||||
testSpanDataWithInstrumentationLibrary(InstrumentationLibraryInfo.create("name", "")),
|
testSpanDataWithInstrumentationLibrary(InstrumentationLibraryInfo.create("name", "")),
|
||||||
testSpanDataWithInstrumentationLibrary(
|
testSpanDataWithInstrumentationLibrary(
|
||||||
InstrumentationLibraryInfo.create("name", "version")),
|
InstrumentationLibraryInfo.create("name", "version")),
|
||||||
testSpanDataWithInstrumentationLibrary(InstrumentationLibraryInfo.getEmpty()),
|
testSpanDataWithInstrumentationLibrary(InstrumentationLibraryInfo.empty()),
|
||||||
testSpanDataWithInstrumentationLibrary(InstrumentationLibraryInfo.create("", ""))));
|
testSpanDataWithInstrumentationLibrary(InstrumentationLibraryInfo.create("", ""))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,8 +211,8 @@ class MetricAdapterTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
MetricAdapter.toProtoMetric(
|
MetricAdapter.toProtoMetric(
|
||||||
MetricData.createLongSum(
|
MetricData.createLongSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
@ -246,8 +246,8 @@ class MetricAdapterTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
MetricAdapter.toProtoMetric(
|
MetricAdapter.toProtoMetric(
|
||||||
MetricData.createDoubleSum(
|
MetricData.createDoubleSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
@ -286,8 +286,8 @@ class MetricAdapterTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
MetricAdapter.toProtoMetric(
|
MetricAdapter.toProtoMetric(
|
||||||
MetricData.createLongSum(
|
MetricData.createLongSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
@ -321,8 +321,8 @@ class MetricAdapterTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
MetricAdapter.toProtoMetric(
|
MetricAdapter.toProtoMetric(
|
||||||
MetricData.createDoubleSum(
|
MetricData.createDoubleSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
@ -361,8 +361,8 @@ class MetricAdapterTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
MetricAdapter.toProtoMetric(
|
MetricAdapter.toProtoMetric(
|
||||||
MetricData.createLongGauge(
|
MetricData.createLongGauge(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
@ -392,8 +392,8 @@ class MetricAdapterTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
MetricAdapter.toProtoMetric(
|
MetricAdapter.toProtoMetric(
|
||||||
MetricData.createDoubleGauge(
|
MetricData.createDoubleGauge(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
@ -428,8 +428,8 @@ class MetricAdapterTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
MetricAdapter.toProtoMetric(
|
MetricAdapter.toProtoMetric(
|
||||||
MetricData.createDoubleSummary(
|
MetricData.createDoubleSummary(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
@ -529,7 +529,7 @@ class MetricAdapterTest {
|
||||||
Collections.singletonList(
|
Collections.singletonList(
|
||||||
DoublePointData.create(123, 456, Labels.of("k", "v"), 5.0)))),
|
DoublePointData.create(123, 456, Labels.of("k", "v"), 5.0)))),
|
||||||
MetricData.createDoubleSum(
|
MetricData.createDoubleSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
instrumentationLibraryInfo,
|
instrumentationLibraryInfo,
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -540,8 +540,8 @@ class MetricAdapterTest {
|
||||||
Collections.singletonList(
|
Collections.singletonList(
|
||||||
DoublePointData.create(123, 456, Labels.of("k", "v"), 5.0)))),
|
DoublePointData.create(123, 456, Labels.of("k", "v"), 5.0)))),
|
||||||
MetricData.createDoubleSum(
|
MetricData.createDoubleSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
|
|
@ -54,7 +54,7 @@ class ResourceAdapterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toProtoResource_Empty() {
|
void toProtoResource_Empty() {
|
||||||
assertThat(ResourceAdapter.toProtoResource(Resource.getEmpty()))
|
assertThat(ResourceAdapter.toProtoResource(Resource.empty()))
|
||||||
.isEqualTo(io.opentelemetry.proto.resource.v1.Resource.newBuilder().build());
|
.isEqualTo(io.opentelemetry.proto.resource.v1.Resource.newBuilder().build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ class OpenTelemetrySdkTest {
|
||||||
.addSpanProcessor(SimpleSpanProcessor.create(mock(SpanExporter.class)))
|
.addSpanProcessor(SimpleSpanProcessor.create(mock(SpanExporter.class)))
|
||||||
.setClock(mock(Clock.class))
|
.setClock(mock(Clock.class))
|
||||||
.setIdGenerator(mock(IdGenerator.class))
|
.setIdGenerator(mock(IdGenerator.class))
|
||||||
.setResource(Resource.getEmpty())
|
.setResource(Resource.empty())
|
||||||
.setSpanLimits(newConfig)
|
.setSpanLimits(newConfig)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public abstract class InstrumentationLibraryInfo {
|
||||||
*
|
*
|
||||||
* @return an "empty" {@code InstrumentationLibraryInfo}.
|
* @return an "empty" {@code InstrumentationLibraryInfo}.
|
||||||
*/
|
*/
|
||||||
public static InstrumentationLibraryInfo getEmpty() {
|
public static InstrumentationLibraryInfo empty() {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public abstract class Resource {
|
||||||
*
|
*
|
||||||
* @return an empty {@code Resource}.
|
* @return an empty {@code Resource}.
|
||||||
*/
|
*/
|
||||||
public static Resource getEmpty() {
|
public static Resource empty() {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ class InstrumentationLibraryInfoTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void emptyLibraryInfo() {
|
void emptyLibraryInfo() {
|
||||||
assertThat(InstrumentationLibraryInfo.getEmpty().getName()).isEmpty();
|
assertThat(InstrumentationLibraryInfo.empty().getName()).isEmpty();
|
||||||
assertThat(InstrumentationLibraryInfo.getEmpty().getVersion()).isNull();
|
assertThat(InstrumentationLibraryInfo.empty().getVersion()).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -24,7 +24,7 @@ public enum TestSdk {
|
||||||
@Override
|
@Override
|
||||||
Meter build() {
|
Meter build() {
|
||||||
MeterProviderSharedState meterProviderSharedState =
|
MeterProviderSharedState meterProviderSharedState =
|
||||||
MeterProviderSharedState.create(SystemClock.getInstance(), Resource.getEmpty());
|
MeterProviderSharedState.create(SystemClock.getInstance(), Resource.empty());
|
||||||
InstrumentationLibraryInfo instrumentationLibraryInfo =
|
InstrumentationLibraryInfo instrumentationLibraryInfo =
|
||||||
InstrumentationLibraryInfo.create("io.opentelemetry.sdk.metrics", null);
|
InstrumentationLibraryInfo.create("io.opentelemetry.sdk.metrics", null);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class DoubleMinMaxSumCountBenchmark {
|
||||||
AggregatorFactory.minMaxSumCount()
|
AggregatorFactory.minMaxSumCount()
|
||||||
.create(
|
.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class LongMinMaxSumCountBenchmark {
|
||||||
AggregatorFactory.minMaxSumCount()
|
AggregatorFactory.minMaxSumCount()
|
||||||
.create(
|
.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
|
|
@ -28,8 +28,7 @@ class InstrumentRegistryTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void register() {
|
void register() {
|
||||||
MeterSharedState meterSharedState =
|
MeterSharedState meterSharedState = MeterSharedState.create(InstrumentationLibraryInfo.empty());
|
||||||
MeterSharedState.create(InstrumentationLibraryInfo.getEmpty());
|
|
||||||
TestInstrument testInstrument = new TestInstrument(INSTRUMENT_DESCRIPTOR);
|
TestInstrument testInstrument = new TestInstrument(INSTRUMENT_DESCRIPTOR);
|
||||||
assertThat(meterSharedState.getInstrumentRegistry().register(testInstrument))
|
assertThat(meterSharedState.getInstrumentRegistry().register(testInstrument))
|
||||||
.isSameAs(testInstrument);
|
.isSameAs(testInstrument);
|
||||||
|
@ -44,8 +43,7 @@ class InstrumentRegistryTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void register_OtherDescriptor() {
|
void register_OtherDescriptor() {
|
||||||
MeterSharedState meterSharedState =
|
MeterSharedState meterSharedState = MeterSharedState.create(InstrumentationLibraryInfo.empty());
|
||||||
MeterSharedState.create(InstrumentationLibraryInfo.getEmpty());
|
|
||||||
TestInstrument testInstrument = new TestInstrument(INSTRUMENT_DESCRIPTOR);
|
TestInstrument testInstrument = new TestInstrument(INSTRUMENT_DESCRIPTOR);
|
||||||
assertThat(meterSharedState.getInstrumentRegistry().register(testInstrument))
|
assertThat(meterSharedState.getInstrumentRegistry().register(testInstrument))
|
||||||
.isSameAs(testInstrument);
|
.isSameAs(testInstrument);
|
||||||
|
@ -61,8 +59,7 @@ class InstrumentRegistryTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void register_OtherInstance() {
|
void register_OtherInstance() {
|
||||||
MeterSharedState meterSharedState =
|
MeterSharedState meterSharedState = MeterSharedState.create(InstrumentationLibraryInfo.empty());
|
||||||
MeterSharedState.create(InstrumentationLibraryInfo.getEmpty());
|
|
||||||
TestInstrument testInstrument = new TestInstrument(INSTRUMENT_DESCRIPTOR);
|
TestInstrument testInstrument = new TestInstrument(INSTRUMENT_DESCRIPTOR);
|
||||||
assertThat(meterSharedState.getInstrumentRegistry().register(testInstrument))
|
assertThat(meterSharedState.getInstrumentRegistry().register(testInstrument))
|
||||||
.isSameAs(testInstrument);
|
.isSameAs(testInstrument);
|
||||||
|
|
|
@ -25,14 +25,14 @@ import org.junit.jupiter.api.Test;
|
||||||
class SdkMeterRegistryTest {
|
class SdkMeterRegistryTest {
|
||||||
private final TestClock testClock = TestClock.create();
|
private final TestClock testClock = TestClock.create();
|
||||||
private final SdkMeterProvider meterProvider =
|
private final SdkMeterProvider meterProvider =
|
||||||
SdkMeterProvider.builder().setClock(testClock).setResource(Resource.getEmpty()).build();
|
SdkMeterProvider.builder().setClock(testClock).setResource(Resource.empty()).build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void builder_HappyPath() {
|
void builder_HappyPath() {
|
||||||
assertThat(
|
assertThat(
|
||||||
SdkMeterProvider.builder()
|
SdkMeterProvider.builder()
|
||||||
.setClock(mock(Clock.class))
|
.setClock(mock(Clock.class))
|
||||||
.setResource(Resource.getEmpty())
|
.setResource(Resource.empty())
|
||||||
.build())
|
.build())
|
||||||
.isNotNull();
|
.isNotNull();
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ class SdkMeterRegistryTest {
|
||||||
assertThat(meterProvider.collectAllMetrics())
|
assertThat(meterProvider.collectAllMetrics())
|
||||||
.containsExactlyInAnyOrder(
|
.containsExactlyInAnyOrder(
|
||||||
MetricData.createLongSum(
|
MetricData.createLongSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
sdkMeter1.getInstrumentationLibraryInfo(),
|
sdkMeter1.getInstrumentationLibraryInfo(),
|
||||||
"testLongCounter",
|
"testLongCounter",
|
||||||
"",
|
"",
|
||||||
|
@ -99,7 +99,7 @@ class SdkMeterRegistryTest {
|
||||||
LongPointData.create(
|
LongPointData.create(
|
||||||
testClock.now(), testClock.now(), Labels.empty(), 10)))),
|
testClock.now(), testClock.now(), Labels.empty(), 10)))),
|
||||||
MetricData.createLongSum(
|
MetricData.createLongSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
sdkMeter2.getInstrumentationLibraryInfo(),
|
sdkMeter2.getInstrumentationLibraryInfo(),
|
||||||
"testLongCounter",
|
"testLongCounter",
|
||||||
"",
|
"",
|
||||||
|
|
|
@ -26,8 +26,7 @@ public class SynchronousInstrumentAccumulatorTest {
|
||||||
private final TestClock testClock = TestClock.create();
|
private final TestClock testClock = TestClock.create();
|
||||||
private final Aggregator<Long> aggregator =
|
private final Aggregator<Long> aggregator =
|
||||||
AggregatorFactory.lastValue()
|
AggregatorFactory.lastValue()
|
||||||
.create(
|
.create(Resource.empty(), InstrumentationLibraryInfo.create("test", "1.0"), DESCRIPTOR);
|
||||||
Resource.getEmpty(), InstrumentationLibraryInfo.create("test", "1.0"), DESCRIPTOR);
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void sameAggregator_ForSameLabelSet() {
|
void sameAggregator_ForSameLabelSet() {
|
||||||
|
|
|
@ -22,7 +22,7 @@ class AggregatorFactoryTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
count.create(
|
count.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -33,7 +33,7 @@ class AggregatorFactoryTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
count.create(
|
count.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -49,7 +49,7 @@ class AggregatorFactoryTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
lastValue.create(
|
lastValue.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -60,7 +60,7 @@ class AggregatorFactoryTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
lastValue.create(
|
lastValue.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -76,7 +76,7 @@ class AggregatorFactoryTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
minMaxSumCount.create(
|
minMaxSumCount.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -87,7 +87,7 @@ class AggregatorFactoryTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
minMaxSumCount.create(
|
minMaxSumCount.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -103,7 +103,7 @@ class AggregatorFactoryTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
sum.create(
|
sum.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -114,7 +114,7 @@ class AggregatorFactoryTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
sum.create(
|
sum.create(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
|
|
@ -25,7 +25,7 @@ class CountAggregatorTest {
|
||||||
private static final CountAggregator cumulativeAggregator =
|
private static final CountAggregator cumulativeAggregator =
|
||||||
new CountAggregator(
|
new CountAggregator(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -36,7 +36,7 @@ class CountAggregatorTest {
|
||||||
private static final CountAggregator deltaAggregator =
|
private static final CountAggregator deltaAggregator =
|
||||||
new CountAggregator(
|
new CountAggregator(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -87,7 +87,7 @@ class CountAggregatorTest {
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
MetricData.createLongSum(
|
MetricData.createLongSum(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
@ -112,7 +112,7 @@ class CountAggregatorTest {
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
MetricData.createLongSum(
|
MetricData.createLongSum(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
|
|
@ -24,7 +24,7 @@ class DoubleLastValueAggregatorTest {
|
||||||
private static final DoubleLastValueAggregator aggregator =
|
private static final DoubleLastValueAggregator aggregator =
|
||||||
new DoubleLastValueAggregator(
|
new DoubleLastValueAggregator(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -76,7 +76,7 @@ class DoubleLastValueAggregatorTest {
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
MetricData.createDoubleGauge(
|
MetricData.createDoubleGauge(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"unit",
|
"unit",
|
||||||
|
|
|
@ -29,7 +29,7 @@ class DoubleMinMaxSumCountAggregatorTest {
|
||||||
private static final DoubleMinMaxSumCountAggregator aggregator =
|
private static final DoubleMinMaxSumCountAggregator aggregator =
|
||||||
new DoubleMinMaxSumCountAggregator(
|
new DoubleMinMaxSumCountAggregator(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
|
|
@ -25,7 +25,7 @@ class DoubleSumAggregatorTest {
|
||||||
private static final DoubleSumAggregator aggregator =
|
private static final DoubleSumAggregator aggregator =
|
||||||
new DoubleSumAggregator(
|
new DoubleSumAggregator(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name", "description", "unit", InstrumentType.COUNTER, InstrumentValueType.DOUBLE),
|
"name", "description", "unit", InstrumentType.COUNTER, InstrumentValueType.DOUBLE),
|
||||||
/* stateful= */ true);
|
/* stateful= */ true);
|
||||||
|
@ -89,7 +89,7 @@ class DoubleSumAggregatorTest {
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
MetricData.createDoubleSum(
|
MetricData.createDoubleSum(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"unit",
|
"unit",
|
||||||
|
|
|
@ -24,7 +24,7 @@ class LongLastValueAggregatorTest {
|
||||||
private static final LongLastValueAggregator aggregator =
|
private static final LongLastValueAggregator aggregator =
|
||||||
new LongLastValueAggregator(
|
new LongLastValueAggregator(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
@ -76,7 +76,7 @@ class LongLastValueAggregatorTest {
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
MetricData.createLongGauge(
|
MetricData.createLongGauge(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"unit",
|
"unit",
|
||||||
|
|
|
@ -29,7 +29,7 @@ class LongMinMaxSumCountAggregatorTest {
|
||||||
private static final LongMinMaxSumCountAggregator aggregator =
|
private static final LongMinMaxSumCountAggregator aggregator =
|
||||||
new LongMinMaxSumCountAggregator(
|
new LongMinMaxSumCountAggregator(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
|
|
|
@ -25,7 +25,7 @@ class LongSumAggregatorTest {
|
||||||
private static final LongSumAggregator aggregator =
|
private static final LongSumAggregator aggregator =
|
||||||
new LongSumAggregator(
|
new LongSumAggregator(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
InstrumentDescriptor.create(
|
InstrumentDescriptor.create(
|
||||||
"name", "description", "unit", InstrumentType.COUNTER, InstrumentValueType.LONG),
|
"name", "description", "unit", InstrumentType.COUNTER, InstrumentValueType.LONG),
|
||||||
/* stateful= */ true);
|
/* stateful= */ true);
|
||||||
|
@ -91,7 +91,7 @@ class LongSumAggregatorTest {
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
MetricData.createLongSum(
|
MetricData.createLongSum(
|
||||||
Resource.getDefault(),
|
Resource.getDefault(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"unit",
|
"unit",
|
||||||
|
|
|
@ -45,8 +45,8 @@ class MetricDataTest {
|
||||||
void metricData_Getters() {
|
void metricData_Getters() {
|
||||||
MetricData metricData =
|
MetricData metricData =
|
||||||
MetricData.createDoubleGauge(
|
MetricData.createDoubleGauge(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"metric_name",
|
"metric_name",
|
||||||
"metric_description",
|
"metric_description",
|
||||||
"ms",
|
"ms",
|
||||||
|
@ -55,9 +55,9 @@ class MetricDataTest {
|
||||||
assertThat(metricData.getDescription()).isEqualTo("metric_description");
|
assertThat(metricData.getDescription()).isEqualTo("metric_description");
|
||||||
assertThat(metricData.getUnit()).isEqualTo("ms");
|
assertThat(metricData.getUnit()).isEqualTo("ms");
|
||||||
assertThat(metricData.getType()).isEqualTo(MetricDataType.DOUBLE_GAUGE);
|
assertThat(metricData.getType()).isEqualTo(MetricDataType.DOUBLE_GAUGE);
|
||||||
assertThat(metricData.getResource()).isEqualTo(Resource.getEmpty());
|
assertThat(metricData.getResource()).isEqualTo(Resource.empty());
|
||||||
assertThat(metricData.getInstrumentationLibraryInfo())
|
assertThat(metricData.getInstrumentationLibraryInfo())
|
||||||
.isEqualTo(InstrumentationLibraryInfo.getEmpty());
|
.isEqualTo(InstrumentationLibraryInfo.empty());
|
||||||
assertThat(metricData.isEmpty()).isTrue();
|
assertThat(metricData.isEmpty()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ class MetricDataTest {
|
||||||
assertThat(LONG_POINT.getValue()).isEqualTo(LONG_VALUE);
|
assertThat(LONG_POINT.getValue()).isEqualTo(LONG_VALUE);
|
||||||
MetricData metricData =
|
MetricData metricData =
|
||||||
MetricData.createLongGauge(
|
MetricData.createLongGauge(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"metric_name",
|
"metric_name",
|
||||||
"metric_description",
|
"metric_description",
|
||||||
"ms",
|
"ms",
|
||||||
|
@ -80,8 +80,8 @@ class MetricDataTest {
|
||||||
assertThat(metricData.getLongGaugeData().getPoints()).containsExactly(LONG_POINT);
|
assertThat(metricData.getLongGaugeData().getPoints()).containsExactly(LONG_POINT);
|
||||||
metricData =
|
metricData =
|
||||||
MetricData.createLongSum(
|
MetricData.createLongSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"metric_name",
|
"metric_name",
|
||||||
"metric_description",
|
"metric_description",
|
||||||
"ms",
|
"ms",
|
||||||
|
@ -102,8 +102,8 @@ class MetricDataTest {
|
||||||
assertThat(DOUBLE_POINT.getValue()).isEqualTo(DOUBLE_VALUE);
|
assertThat(DOUBLE_POINT.getValue()).isEqualTo(DOUBLE_VALUE);
|
||||||
MetricData metricData =
|
MetricData metricData =
|
||||||
MetricData.createDoubleGauge(
|
MetricData.createDoubleGauge(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"metric_name",
|
"metric_name",
|
||||||
"metric_description",
|
"metric_description",
|
||||||
"ms",
|
"ms",
|
||||||
|
@ -112,8 +112,8 @@ class MetricDataTest {
|
||||||
assertThat(metricData.getDoubleGaugeData().getPoints()).containsExactly(DOUBLE_POINT);
|
assertThat(metricData.getDoubleGaugeData().getPoints()).containsExactly(DOUBLE_POINT);
|
||||||
metricData =
|
metricData =
|
||||||
MetricData.createDoubleSum(
|
MetricData.createDoubleSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"metric_name",
|
"metric_name",
|
||||||
"metric_description",
|
"metric_description",
|
||||||
"ms",
|
"ms",
|
||||||
|
@ -137,8 +137,8 @@ class MetricDataTest {
|
||||||
.isEqualTo(Arrays.asList(MINIMUM_VALUE, MAXIMUM_VALUE));
|
.isEqualTo(Arrays.asList(MINIMUM_VALUE, MAXIMUM_VALUE));
|
||||||
MetricData metricData =
|
MetricData metricData =
|
||||||
MetricData.createDoubleSummary(
|
MetricData.createDoubleSummary(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"metric_name",
|
"metric_name",
|
||||||
"metric_description",
|
"metric_description",
|
||||||
"ms",
|
"ms",
|
||||||
|
@ -150,8 +150,8 @@ class MetricDataTest {
|
||||||
void metricData_GetDefault() {
|
void metricData_GetDefault() {
|
||||||
MetricData metricData =
|
MetricData metricData =
|
||||||
MetricData.createDoubleSummary(
|
MetricData.createDoubleSummary(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"metric_name",
|
"metric_name",
|
||||||
"metric_description",
|
"metric_description",
|
||||||
"ms",
|
"ms",
|
||||||
|
@ -164,8 +164,8 @@ class MetricDataTest {
|
||||||
|
|
||||||
metricData =
|
metricData =
|
||||||
MetricData.createDoubleGauge(
|
MetricData.createDoubleGauge(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"metric_name",
|
"metric_name",
|
||||||
"metric_description",
|
"metric_description",
|
||||||
"ms",
|
"ms",
|
||||||
|
|
|
@ -42,7 +42,7 @@ class IntervalMetricReaderTest {
|
||||||
|
|
||||||
private static final MetricData METRIC_DATA =
|
private static final MetricData METRIC_DATA =
|
||||||
MetricData.createLongSum(
|
MetricData.createLongSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.create("IntervalMetricReaderTest", null),
|
InstrumentationLibraryInfo.create("IntervalMetricReaderTest", null),
|
||||||
"my metric",
|
"my metric",
|
||||||
"my metric description",
|
"my metric description",
|
||||||
|
|
|
@ -37,13 +37,13 @@ public abstract class TestSpanData implements SpanData {
|
||||||
return new AutoValue_TestSpanData.Builder()
|
return new AutoValue_TestSpanData.Builder()
|
||||||
.setSpanContext(SpanContext.getInvalid())
|
.setSpanContext(SpanContext.getInvalid())
|
||||||
.setParentSpanContext(SpanContext.getInvalid())
|
.setParentSpanContext(SpanContext.getInvalid())
|
||||||
.setInstrumentationLibraryInfo(InstrumentationLibraryInfo.getEmpty())
|
.setInstrumentationLibraryInfo(InstrumentationLibraryInfo.empty())
|
||||||
.setLinks(Collections.emptyList())
|
.setLinks(Collections.emptyList())
|
||||||
.setTotalRecordedLinks(0)
|
.setTotalRecordedLinks(0)
|
||||||
.setAttributes(Attributes.empty())
|
.setAttributes(Attributes.empty())
|
||||||
.setEvents(Collections.emptyList())
|
.setEvents(Collections.emptyList())
|
||||||
.setTotalRecordedEvents(0)
|
.setTotalRecordedEvents(0)
|
||||||
.setResource(Resource.getEmpty())
|
.setResource(Resource.empty())
|
||||||
.setTotalAttributeCount(0);
|
.setTotalAttributeCount(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,12 +159,11 @@ class OpenTelemetryAssertionsTest {
|
||||||
.isInstanceOf(AssertionError.class);
|
.isInstanceOf(AssertionError.class);
|
||||||
assertThatThrownBy(() -> assertThat(SPAN1).hasParentSpanId("foo"))
|
assertThatThrownBy(() -> assertThat(SPAN1).hasParentSpanId("foo"))
|
||||||
.isInstanceOf(AssertionError.class);
|
.isInstanceOf(AssertionError.class);
|
||||||
assertThatThrownBy(() -> assertThat(SPAN1).hasResource(Resource.getEmpty()))
|
assertThatThrownBy(() -> assertThat(SPAN1).hasResource(Resource.empty()))
|
||||||
.isInstanceOf(AssertionError.class);
|
.isInstanceOf(AssertionError.class);
|
||||||
assertThatThrownBy(
|
assertThatThrownBy(
|
||||||
() ->
|
() ->
|
||||||
assertThat(SPAN1)
|
assertThat(SPAN1).hasInstrumentationLibraryInfo(InstrumentationLibraryInfo.empty()))
|
||||||
.hasInstrumentationLibraryInfo(InstrumentationLibraryInfo.getEmpty()))
|
|
||||||
.isInstanceOf(AssertionError.class);
|
.isInstanceOf(AssertionError.class);
|
||||||
assertThatThrownBy(() -> assertThat(SPAN1).hasName("foo")).isInstanceOf(AssertionError.class);
|
assertThatThrownBy(() -> assertThat(SPAN1).hasName("foo")).isInstanceOf(AssertionError.class);
|
||||||
assertThatThrownBy(() -> assertThat(SPAN1).hasKind(SpanKind.SERVER))
|
assertThatThrownBy(() -> assertThat(SPAN1).hasKind(SpanKind.SERVER))
|
||||||
|
|
|
@ -29,8 +29,8 @@ class InMemoryMetricExporterTest {
|
||||||
long startNs = TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
|
long startNs = TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
|
||||||
long endNs = startNs + TimeUnit.MILLISECONDS.toNanos(900);
|
long endNs = startNs + TimeUnit.MILLISECONDS.toNanos(900);
|
||||||
return MetricData.createLongSum(
|
return MetricData.createLongSum(
|
||||||
Resource.getEmpty(),
|
Resource.empty(),
|
||||||
InstrumentationLibraryInfo.getEmpty(),
|
InstrumentationLibraryInfo.empty(),
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description",
|
||||||
"1",
|
"1",
|
||||||
|
|
|
@ -36,7 +36,7 @@ class TestSpanDataTest {
|
||||||
assertThat(spanData.getEvents()).isEqualTo(emptyList());
|
assertThat(spanData.getEvents()).isEqualTo(emptyList());
|
||||||
assertThat(spanData.getLinks()).isEqualTo(emptyList());
|
assertThat(spanData.getLinks()).isEqualTo(emptyList());
|
||||||
assertThat(spanData.getInstrumentationLibraryInfo())
|
assertThat(spanData.getInstrumentationLibraryInfo())
|
||||||
.isSameAs(InstrumentationLibraryInfo.getEmpty());
|
.isSameAs(InstrumentationLibraryInfo.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -70,7 +70,7 @@ class RecordEventsReadableSpanTest {
|
||||||
private final String parentSpanId = idsGenerator.generateSpanId();
|
private final String parentSpanId = idsGenerator.generateSpanId();
|
||||||
private final SpanContext spanContext =
|
private final SpanContext spanContext =
|
||||||
SpanContext.create(traceId, spanId, TraceFlags.getDefault(), TraceState.getDefault());
|
SpanContext.create(traceId, spanId, TraceFlags.getDefault(), TraceState.getDefault());
|
||||||
private final Resource resource = Resource.getEmpty();
|
private final Resource resource = Resource.empty();
|
||||||
private final InstrumentationLibraryInfo instrumentationLibraryInfo =
|
private final InstrumentationLibraryInfo instrumentationLibraryInfo =
|
||||||
InstrumentationLibraryInfo.create("theName", null);
|
InstrumentationLibraryInfo.create("theName", null);
|
||||||
private final Map<AttributeKey, Object> attributes = new HashMap<>();
|
private final Map<AttributeKey, Object> attributes = new HashMap<>();
|
||||||
|
|
Loading…
Reference in New Issue