Skip to content

Commit

Permalink
Remove Guava dep (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek authored Jul 3, 2023
1 parent d9652c3 commit 2301052
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion splunk-otel-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ dependencies {
testImplementation("org.robolectric:robolectric:4.10.3")
testImplementation("androidx.test:core:1.5.0")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("com.google.guava:guava:32.0.1-jre")

coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import android.app.Application;
import android.content.Context;
import android.os.Looper;
import com.google.common.base.Strings;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.trace.SpanKind;
Expand All @@ -47,6 +46,7 @@
import io.opentelemetry.sdk.trace.export.SpanExporter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -145,7 +145,7 @@ SpanExporter buildFilteringExporter(CurrentNetworkProvider connectionUtil) {
"testEvent",
Attributes.of(
longAttributeKey,
Strings.repeat("a", RumInitializer.MAX_ATTRIBUTE_LENGTH + 1)));
makeString('a', RumInitializer.MAX_ATTRIBUTE_LENGTH + 1)));

splunkRum.flushSpans();
List<SpanData> spans = testExporter.getFinishedSpanItems();
Expand All @@ -154,7 +154,7 @@ SpanExporter buildFilteringExporter(CurrentNetworkProvider connectionUtil) {
SpanData eventSpan = spans.get(0);
assertEquals("testEvent", eventSpan.getName());
String truncatedValue = eventSpan.getAttributes().get(longAttributeKey);
assertEquals(Strings.repeat("a", RumInitializer.MAX_ATTRIBUTE_LENGTH), truncatedValue);
assertEquals(makeString('a', RumInitializer.MAX_ATTRIBUTE_LENGTH), truncatedValue);
}

/** Verify that we have buffering in place in our exporter implementation. */
Expand Down Expand Up @@ -283,4 +283,10 @@ SpanExporter getCoreSpanExporter(String endpoint) {
.EXCEPTION_STACKTRACE))
.hasEvents(emptyList()));
}

private String makeString(char c, int count) {
char[] buf = new char[count];
Arrays.fill(buf, c);
return new String(buf);
}
}

0 comments on commit 2301052

Please sign in to comment.