Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

make integrations public #256

Merged
merged 1 commit into from
Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.TestOnly;

final class AnrIntegration implements Integration, Closeable {
/**
* When the UI thread of an Android app is blocked for too long, an "Application Not Responding"
* (ANR) error is triggered. Sends an event if an ANR happens
*/
public final class AnrIntegration implements Integration, Closeable {

private static ANRWatchDog anrWatchDog;

@Override
public void register(IHub hub, SentryOptions options) {
public final void register(IHub hub, SentryOptions options) {
register(hub, (SentryAndroidOptions) options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;

abstract class EnvelopeFileObserverIntegration implements Integration, Closeable {
/** Watches the envelope dir. and send them (events) over. */
public abstract class EnvelopeFileObserverIntegration implements Integration, Closeable {
private @Nullable EnvelopeFileObserver observer;

EnvelopeFileObserverIntegration() {}
Expand All @@ -20,7 +21,7 @@ public static EnvelopeFileObserverIntegration getOutboxFileObserver() {
}

@Override
public void register(IHub hub, SentryOptions options) {
public final void register(IHub hub, SentryOptions options) {
ILogger logger = options.getLogger();
String path = getPath(options);
if (path == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
import io.sentry.core.SentryOptions;
import java.lang.reflect.Method;

final class NdkIntegration implements Integration {
/** Enables the NDK error reporting for Android */
public final class NdkIntegration implements Integration {
private boolean isNdkAvailable() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
}

@Override
public void register(IHub hub, SentryOptions options) {
public final void register(IHub hub, SentryOptions options) {
// Note: `hub` isn't used here because the NDK integration writes files to disk which are picked
// up by another
// integration. The NDK directory watching must happen before this integration runs.
Expand Down
10 changes: 10 additions & 0 deletions sentry-core/src/main/java/io/sentry/core/Integration.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package io.sentry.core;

/**
* Code that provides middlewares, bindings or hooks into certain frameworks or environments, along
* with code that inserts those bindings and activates them.
*/
public interface Integration {
/**
* Registers an integration
*
* @param hub the Hub
* @param options the options
*/
void register(IHub hub, SentryOptions options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import java.util.concurrent.Executors;
import org.jetbrains.annotations.NotNull;

final class SendCachedEventFireAndForgetIntegration implements Integration {
/** Sends cached events over when your App. is starting. */
public final class SendCachedEventFireAndForgetIntegration implements Integration {

private final SendFireAndForgetFactory factory;

Expand All @@ -22,7 +23,7 @@ interface SendFireAndForgetFactory {

@SuppressWarnings("FutureReturnValueIgnored")
@Override
public void register(@NotNull IHub hub, @NotNull SentryOptions options) {
public final void register(@NotNull IHub hub, @NotNull SentryOptions options) {
String cachedDir = options.getCacheDirPath();
if (cachedDir == null) {
options.getLogger().log(SentryLevel.WARNING, "No cache dir path is defined in options.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Sends any uncaught exception to Sentry, then passes the exception on to the pre-existing uncaught
* exception handler.
*/
final class UncaughtExceptionHandlerIntegration
public final class UncaughtExceptionHandlerIntegration
implements Integration, Thread.UncaughtExceptionHandler, Closeable {
/** Reference to the pre-existing uncaught exception handler. */
private Thread.UncaughtExceptionHandler defaultExceptionHandler;
Expand All @@ -36,7 +36,7 @@ final class UncaughtExceptionHandlerIntegration
}

@Override
public void register(IHub hub, SentryOptions options) {
public final void register(IHub hub, SentryOptions options) {
if (registered) {
options
.getLogger()
Expand Down