-
Notifications
You must be signed in to change notification settings - Fork 34
/
OpenTelemetryRum.java
84 lines (75 loc) · 3.71 KB
/
OpenTelemetryRum.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.android;
import android.app.Application;
import io.opentelemetry.android.config.OtelRumConfig;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.sdk.OpenTelemetrySdk;
import io.opentelemetry.sdk.logs.SdkLoggerProvider;
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
import io.opentelemetry.sdk.trace.SdkTracerProvider;
/**
* Entrypoint for the OpenTelemetry Real User Monitoring library for Android.
*
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public interface OpenTelemetryRum {
/**
* Returns a new {@link OpenTelemetryRumBuilder} for {@link OpenTelemetryRum} with a default
* configuration. Use this version if you would like to configure individual aspects of the
* OpenTelemetry SDK but would still prefer to allow OpenTelemetry RUM to create the SDK for
* you. For additional configuration, call the two-argument version of build and pass it your
* {@link OtelRumConfig} instance. If you would like to "bring your own" SDK, call the
* two-argument version that takes the SDK as a parameter.
*
* @param application The {@link Application} that is being instrumented.
*/
static OpenTelemetryRumBuilder builder(Application application) {
return builder(application, new OtelRumConfig());
}
/**
* Returns a new {@link OpenTelemetryRumBuilder} for {@link OpenTelemetryRum} with the given
* configuration. Use this version if you would like to configure individual aspects of the
* OpenTelemetry SDK but would still prefer to allow OpenTelemetry RUM to create the SDK for
* you. If you would like to "bring your own" SDK, call the two-argument version that takes the
* SDK as a parameter.
*/
static OpenTelemetryRumBuilder builder(Application application, OtelRumConfig config) {
return new OpenTelemetryRumBuilder(application, config);
}
/**
* Returns a new {@link SdkPreconfiguredRumBuilder} for {@link OpenTelemetryRum}. This version
* requires the user to preconfigure and create their own OpenTelemetrySdk instance. If you
* prefer to use the builder to configure individual aspects of the OpenTelemetry SDK and to
* create and manage it for you, call the one-argument version.
*
* <p>Specific consideration should be given to the creation of your provided SDK to ensure that
* the {@link SdkTracerProvider}, {@link SdkMeterProvider}, and {@link SdkLoggerProvider} are
* configured correctly for your target RUM provider.
*
* @param application The {@link Application} that is being instrumented.
* @param openTelemetrySdk The {@link OpenTelemetrySdk} that the user has already created.
*/
static SdkPreconfiguredRumBuilder builder(
Application application, OpenTelemetrySdk openTelemetrySdk) {
return new SdkPreconfiguredRumBuilder(application, openTelemetrySdk);
}
/** Returns a no-op implementation of {@link OpenTelemetryRum}. */
static OpenTelemetryRum noop() {
return NoopOpenTelemetryRum.INSTANCE;
}
/**
* Get a handle to the instance of the {@linkplain OpenTelemetry OpenTelemetry API} that this
* instance is using for instrumentation.
*/
OpenTelemetry getOpenTelemetry();
/**
* Get the client session ID associated with this instance of the RUM instrumentation library.
* Note: this value will change throughout the lifetime of an application instance, so it is
* recommended that you do not cache this value, but always retrieve it from here when needed.
*/
String getRumSessionId();
}