Skip to content

Commit

Permalink
Prepare for 1.0.0 RC1 (#362)
Browse files Browse the repository at this point in the history
* Prepare for the 0.18 release

* Use the setLocalIpAddressSupplier() method on Zipkin expoerter

* update version to 1.0.0-RC1

* s/RC1/rc.1/

* lowercase and dots

Co-authored-by: Mateusz Rzeszutek <[email protected]>
  • Loading branch information
breedx-splk and Mateusz Rzeszutek authored Sep 27, 2022
1 parent d237fc1 commit e1fe417
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 72 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## Version 1.0.0-rc.1

Release candidate for 1.0.0.

* Updated to OpenTelemetry Java v1.18.0
* Introduced a `SplunkRumBuilder` class and deprecated `Config` (#342)
* Add mobile carrier info to Span attributes (name/mcc/mnc/icc) (#358)
* Improve thread safety of slow rendering detector (#361)

## Version 0.17.0

* Ignore background application starts when measuring AppStart events (#315)
Expand Down
86 changes: 49 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</p>

<p align="center">
<a href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/tag/v1.17.0">
<img alt="OpenTelemetry Instrumentation for Java Version" src="https://img.shields.io/badge/otel-1.17.0-blueviolet?style=for-the-badge">
<a href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/tag/v1.18.0">
<img alt="OpenTelemetry Instrumentation for Java Version" src="https://img.shields.io/badge/otel-1.18.0-blueviolet?style=for-the-badge">
</a>
<a href="https://github.com/signalfx/splunk-otel-android/releases">
<img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/signalfx/splunk-otel-android?include_prereleases&style=for-the-badge">
Expand Down Expand Up @@ -91,7 +91,7 @@ Then, add the latest release as a dependency in your application's build.gradle
```
dependencies {
...
implementation ("com.splunk:splunk-otel-android:0.17.0")
implementation ("com.splunk:splunk-otel-android:1.0.0-rc.1")
...
}
```
Expand Down Expand Up @@ -127,53 +127,65 @@ Then, add the locally built library as a dependency in your application's build.
```
dependencies {
...
implementation ("com.splunk:splunk-otel-android:0.18.0-SNAPSHOT")
implementation ("com.splunk:splunk-otel-android:1.0.0-rc.2-SNAPSHOT")
...
}
```

### Configuration
### Configuration and initialization

In order to configure the Splunk RUM library, you will need to know three things:

* Your Splunk realm.
* The realm can be found in your Splunk Observability UI in the Account Settings page.
* Use the `setRealm(String)` method on the `SplunkRumBuilder` class to set the Splunk realm.
* Your RUM access token.
* You can find or create a RUM access token in the Splunk Observability UI, in your Organization
Settings.
* Important: this access token *must* have the `RUM` authorization scope to work.
* Use the `setRumAccessToken(String)` method on the `SplunkRumBuilder` class to set the RUM
access token.
* The name of your application.
* Use the `setApplicationName(String)` method on the `SplunkRumBuilder` class to set your
application name.

Here is an example of a the very minimal configuration which uses these 3 values:

```java
class MyApplication extends Application {
private final String realm = "<realm>";
private final String rumAccessToken = "<your_RUM_access_token>";
private final Config config = SplunkRum.newConfigBuilder()
.realm(realm)
.rumAccessToken(rumAccessToken)
.applicationName("My Android App")
.build();

@Override
public void onCreate() {
super.onCreate();

SplunkRum.builder()
.setApplicationName("My Android App")
.setRealm(realm)
.setRumAccessToken(rumAccessToken)
.build(this);
}
}
```

There are other options available on the `Config.Builder` instance, including enabling debug mode
There are other options available on the `SplunkRumBuilder` instance, including enabling debug mode
and enabling/disabling various instrumentation features.

### Initialization

To initialize the Splunk RUM monitoring library, from your `android.app.Application` instance,
simply call the static initializer in your `Application.onCreate()` implementation:
call the `build()` method on the `SplunkRumBuilder` instance in your `Application.onCreate()`
implementation:

```java
class MyApplication extends Application {
//...

@Override
public void onCreate() {
super.onCreate();
SplunkRum.initialize(config, this);

SplunkRum.builder()
// configuration ...
.build(this);
}
}
```
Expand Down Expand Up @@ -226,41 +238,41 @@ You can now retrieve the session id in your JS code using `SplunkRumNative.getNa
```
### Advanced Usage

#### Additional `Config.Builder` options.
#### Additional `SplunkRumBuilder` options.

There are a number of optional configuration options that can be specified via the `Config.Builder`
when initializing your instance of the SplunkRum API:
There are a number of optional configuration options that can be specified via
the `SplunkRumBuilder` when initializing your instance of the SplunkRum API:

(Note: full javadoc can be found at [javadoc.io][javadoc-url])

- `deploymentEnvironment(String)` :
- `setDeploymentEnvironment(String)` :
This option will set the Splunk environment attribute on the spans that are generated by the
instrumentation.
- `beaconEndpoint(String)` :
Rather than using the `realm(String)` configuration option, you can use this method to explicitly
- `setBeaconEndpoint(String)` :
Rather than using the `setRealm(String)` configuration option, you can use this method to explicitly
give the full URL of the RUM ingest endpoint.
- `debugEnabled(boolean)` :
Enabling `debug` mode will turn on the opentelemetry logging span exporter, which can be useful
- `enableDebug()` :
Enabling `debug` mode will turn on the OpenTelemetry logging span exporter, which can be useful
when debugging instrumentation issues. Additional logging may also be turned on with this option.
- `crashReportingEnabled(boolean)` :
- `disableCrashReporting()` :
This option can be used to turn off the crash reporting feature.
- `networkMonitorEnabled(boolean)` :
- `disableNetworkMonitor()` :
This option can be used to turn off the network monitoring feature.
- `anrDetectionEnabled(boolean)` :
- `disableAnrDetection()` :
This option can be used to turn off the ANR detection feature.
- `globalAttributes(Attributes)` :
- `disableSlowRenderingDetection()` :
This option can be used to turn off the slow frame render detection feature.
- `setSlowRenderingDetectionPollInterval(Duration)` :
Set/change the default polling interval for slow/frozen render detection.
Default is 1000ms. Value must be positive.
- `setGlobalAttributes(Attributes)` :
This option allows you to add a set of OpenTelemetry Attributes to be appended to every span
generated by the library.
- `filterSpans(Consumer<SpanFilterBuilder>)` :
This can be used to provide customizations of the spans that are emitted by the library. Examples
include: removing spans altogether from export, removing span attributes, changing span attributes
or changing the span name. See the javadoc on the `SpanFilterBuilder` class for more details.
- `slowRenderingDetectionPollInterval(Duration)` :
Set/change the default polling interval for slow/frozen render detection.
Default is 1000ms. Value must be positive.
- `slowRenderingDetectionEnabled(boolean)` :
Disables the detection of slow frame renders. Enabled by default.
- `diskBufferingEnabled(boolean)` :
- `enableDiskBufferingEnabled()` :
Enables the storage-based buffering of telemetry.
This setting is useful when instrumenting applications that might work offline for extended periods of time.
- `limitDiskUsageMegabytes(int)` :
Expand Down Expand Up @@ -304,8 +316,8 @@ when initializing your instance of the SplunkRum API:
#### Detection of slow or frozen renders

By default, Splunk RUM detects and reports slow or frozen screen renders.
To disable this feature, call `.slowRenderingDetectionEnabled(false)` on the
`Config.Builder`.
To disable this feature, call `.disableSlowRenderingDetection()` on the
`SplunkRumBuilder`.

Splunk RUM defines renders as slow or frozen following the [Android Vitals definitions](https://developer.android.com/topic/performance/vitals/frozen):

Expand All @@ -326,7 +338,7 @@ attribute set to the value "Buttercup":
```java
@RumScreenName("Buttercup")
public class MainActivity extends Activity {
...
// ...
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true

version=0.17.0
version=1.0.0-rc.1
group=com.splunk
6 changes: 4 additions & 2 deletions sample-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ android {
}
}

val otelVersion = "1.16.0-alpha"
val otelVersion = "1.18.0"
val otelAlphaVersion = "$otelVersion-alpha"

dependencies {
implementation("androidx.legacy:legacy-support-v4:1.0.0")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.6")
Expand All @@ -65,7 +67,7 @@ dependencies {
implementation(project(":splunk-otel-android-volley"))
implementation("com.android.volley:volley:1.2.1")
implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:$otelVersion")
implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv:$otelVersion")
implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv:$otelAlphaVersion")

testImplementation("junit:junit:4.13.2")
}
2 changes: 1 addition & 1 deletion splunk-otel-android-volley/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ you will also need to add the `splunk-otel-android-volley` dependency to your `b
```gradle
dependencies {
...
implementation("com.splunk:splunk-otel-android-volley:0.16.0")
implementation("com.splunk:splunk-otel-android-volley:1.0.0-rc.1")
...
}
```
Expand Down
2 changes: 1 addition & 1 deletion splunk-otel-android-volley/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ android {
}
}

val otelVersion = "1.17.0"
val otelVersion = "1.18.0"
val otelAlphaVersion = "$otelVersion-alpha"

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion splunk-otel-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
}
}

val otelVersion = "1.17.0"
val otelVersion = "1.18.0"
val otelAlphaVersion = "$otelVersion-alpha"

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.nio.charset.StandardCharsets;
import java.util.List;
import zipkin2.Endpoint;
import zipkin2.Span;
import zipkin2.codec.BytesEncoder;
import zipkin2.codec.Encoding;
Expand Down Expand Up @@ -50,9 +49,6 @@ public int sizeInBytes(Span span) {

@Override
public byte[] encode(Span span) {
Endpoint localEndpoint = Endpoint.newBuilder().serviceName(span.localServiceName()).build();
span = span.toBuilder().localEndpoint(localEndpoint).build();

String properSpanName = span.tags().get(RumAttributeAppender.SPLUNK_OPERATION_KEY.getKey());

// note: this can be optimized, if necessary. Let's keep it simple for now.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ SpanExporter getCoreSpanExporter(String endpoint) {
ZipkinSpanExporter.builder()
.setEncoder(new CustomZipkinEncoder())
.setEndpoint(endpoint)
// remove the local IP address
.setLocalIpAddressSupplier(() -> null)
.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ static ZipkinSpanExporter create(Application application, int maxUsageMegabytes)
return ZipkinSpanExporter.builder()
.setEncoder(new CustomZipkinEncoder())
.setSender(sender)
// remove the local IP address
.setLocalIpAddressSupplier(() -> null)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@

package com.splunk.rum;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;

import io.opentelemetry.api.trace.SpanId;
import io.opentelemetry.api.trace.TraceId;
import org.junit.Test;
import zipkin2.Endpoint;
import zipkin2.Span;

public class CustomZipkinEncoderTest {
Expand All @@ -44,27 +42,4 @@ public void nameReplacement() {
new String(bytes));
assertEquals(bytes.length, encoder.sizeInBytes(span));
}

@Test
public void removeLocalIp() {
Span span =
Span.newBuilder()
.name("test")
.traceId(TraceId.fromLongs(1, 2))
.id(SpanId.fromLong(1))
.localEndpoint(
Endpoint.newBuilder()
.serviceName("test-app")
.ip("127.0.0.1")
.build())
.build();

CustomZipkinEncoder encoder = new CustomZipkinEncoder();

byte[] bytes = encoder.encode(span);
assertThat(new String(bytes))
.contains("\"localEndpoint\":{\"serviceName\":\"test-app\"}")
.doesNotContain(
"\"localEndpoint\":{\"serviceName\":\"test-app\",\"ipv4\":\"127.0.0.1\"}");
}
}

0 comments on commit e1fe417

Please sign in to comment.