Skip to content

Commit

Permalink
post 1.3.1 cleanups (#722)
Browse files Browse the repository at this point in the history
* post 1.3.1 cleanups

* spotless

* fix test

* fix test
  • Loading branch information
breedx-splk authored Dec 15, 2023
1 parent a7148e4 commit 037a9d6
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true

# generate the BuildConfig class that contains the app version
version=1.3.1
version=1.4.0
group=com.splunk
7 changes: 4 additions & 3 deletions sample-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ android {
}
}

val otelVersion = "1.32.0-SNAPSHOT"
val otelVersion = "1.33.0-SNAPSHOT"
val otelAlphaVersion = otelVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")
val otelSemconvVersion = "1.23.1-alpha"

dependencies {
api(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:$otelAlphaVersion"))
Expand All @@ -64,7 +65,7 @@ dependencies {

implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.webkit:webkit:1.9.0")
implementation("androidx.browser:browser:1.6.0")
implementation("androidx.browser:browser:1.7.0")
implementation("com.google.android.material:material:1.10.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.navigation:navigation-fragment:2.7.6")
Expand All @@ -74,7 +75,7 @@ dependencies {
implementation("com.android.volley:volley:1.2.1")
implementation("androidx.work:work-runtime:2.9.0")
implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api")
implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv")
implementation("io.opentelemetry.semconv:opentelemetry-semconv:$otelSemconvVersion")

implementation("io.opentelemetry:opentelemetry-api-events")
implementation("io.opentelemetry:opentelemetry-sdk-logs")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.apache.http.conn.ssl.AllowAllHostnameVerifier;

public class FirstFragment extends Fragment {

Expand Down Expand Up @@ -206,7 +205,6 @@ private Call.Factory buildOkHttpClient(SplunkRum splunkRum) {
SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
return splunkRum.createRumOkHttpCallFactory(
builder.sslSocketFactory(sslSocketFactory, (X509TrustManager) trustAllCerts[0])
.hostnameVerifier(new AllowAllHostnameVerifier())
.build());
} catch (NoSuchAlgorithmException | KeyManagementException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {

binding.buttonToCustomTab.setOnClickListener(
v -> {
String url = "https://pmrum.o11ystore.com/";
String url = "https://frontend-us.o11ystore.com/";
customChromeTabTimer =
SplunkRum.getInstance().startWorkflow("Visit to Chrome Custom Tab");
new CustomTabsIntent.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public View onCreateView(
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
String storeUrl = "https://pmrum.o11ystore.com";
String storeUrl = "https://frontend-us.o11ystore.com/";
binding.webView.setWebViewClient(
new WebViewClientCompat() {
@Override
Expand Down
6 changes: 2 additions & 4 deletions splunk-otel-android-volley/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ android {

val otelVersion = "1.32.0-SNAPSHOT"
val otelAlphaVersion = otelVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")
val otelSemconvVersion = "1.21.0-alpha"
val otelSemconvVersion = "1.23.1-alpha"

dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
Expand All @@ -60,11 +60,9 @@ dependencies {
api("io.opentelemetry:opentelemetry-api")
implementation("io.opentelemetry:opentelemetry-sdk")

implementation("io.opentelemetry.semconv:opentelemetry-semconv:$otelSemconvVersion")

implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha"))
implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api")
implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv")
implementation("io.opentelemetry.semconv:opentelemetry-semconv:$otelSemconvVersion")

testImplementation("junit:junit:4.13.2")
testImplementation("org.assertj:assertj-core:3.24.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
import com.android.volley.Header;
import com.android.volley.Request;
import com.android.volley.toolbox.HttpResponse;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesGetter;
import io.opentelemetry.semconv.SemanticAttributes;
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesGetter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -131,11 +130,6 @@ static List<String> headersToList(List<Header> headers, String name) {
return headersList;
}

@Override
public String getTransport(RequestWrapper requestWrapper, HttpResponse httpResponse) {
return SemanticAttributes.NetTransportValues.IP_TCP;
}

@Override
public String getNetworkTransport(RequestWrapper requestWrapper, HttpResponse httpResponse) {
return "tcp";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.semconv.SemanticAttributes;

class VolleyResponseAttributesExtractor
implements AttributesExtractor<RequestWrapper, HttpResponse> {
Expand Down Expand Up @@ -62,6 +63,12 @@ private void onResponse(AttributesBuilder attributes, HttpResponse response) {
attributes.put(LINK_TRACE_ID_KEY, ids[0]);
attributes.put(LINK_SPAN_ID_KEY, ids[1]);
}

String contentLength = getHeader(response, "Content-Length");
if (contentLength != null) {
attributes.put(
SemanticAttributes.HTTP_RESPONSE_BODY_SIZE, Long.parseLong(contentLength));
}
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractorBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor;
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractor;
import io.opentelemetry.instrumentation.api.semconv.http.HttpClientAttributesExtractorBuilder;
import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanNameExtractor;
import io.opentelemetry.instrumentation.api.semconv.http.HttpSpanStatusExtractor;
import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,15 @@ private void verifyAttributes(SpanData span, URL url, Long status, String respon
assertThat(span.getKind()).isEqualTo(SpanKind.CLIENT);

Attributes spanAttributes = span.getAttributes();
assertThat(spanAttributes.get(SemanticAttributes.HTTP_STATUS_CODE)).isEqualTo(status);
assertThat(spanAttributes.get(SemanticAttributes.NET_PEER_PORT)).isEqualTo(url.getPort());
assertThat(spanAttributes.get(SemanticAttributes.NET_PEER_NAME)).isEqualTo(url.getHost());
assertThat(spanAttributes.get(SemanticAttributes.HTTP_URL)).isEqualTo(url.toString());
assertThat(spanAttributes.get(SemanticAttributes.HTTP_METHOD)).isEqualTo("GET");
assertThat(spanAttributes.get(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE))
.isEqualTo(status);
assertThat(spanAttributes.get(SemanticAttributes.SERVER_PORT)).isEqualTo(url.getPort());
assertThat(spanAttributes.get(SemanticAttributes.SERVER_ADDRESS)).isEqualTo(url.getHost());
assertThat(spanAttributes.get(SemanticAttributes.URL_FULL)).isEqualTo(url.toString());
assertThat(spanAttributes.get(SemanticAttributes.HTTP_REQUEST_METHOD)).isEqualTo("GET");

if (responseBody != null) {
assertThat(span.getAttributes().get(SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH))
assertThat(span.getAttributes().get(SemanticAttributes.HTTP_RESPONSE_BODY_SIZE))
.isEqualTo(responseBody.length());
}
}
Expand Down
4 changes: 2 additions & 2 deletions splunk-otel-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ android {
}
}

val otelVersion = "1.32.0"
val otelVersion = "1.33.0-SNAPSHOT"
val otelAlphaVersion = otelVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")
val otelSemconvVersion = "1.21.0-alpha"
val otelSemconvVersion = "1.23.1-alpha"

dependencies {
api(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:$otelAlphaVersion"))
Expand Down

0 comments on commit 037a9d6

Please sign in to comment.