public interface IHub
Modifier and Type | Method and Description |
---|---|
default void |
addBreadcrumb(@NotNull Breadcrumb breadcrumb)
Adds a breadcrumb to the current Scope
|
void |
addBreadcrumb(@NotNull Breadcrumb breadcrumb,
@Nullable java.lang.Object hint)
Adds a breadcrumb to the current Scope
|
default void |
addBreadcrumb(@NotNull java.lang.String message)
Adds a breadcrumb to the current Scope
|
default void |
addBreadcrumb(@NotNull java.lang.String message,
@NotNull java.lang.String category)
Adds a breadcrumb to the current Scope
|
void |
bindClient(@NotNull ISentryClient client)
Binds a different client to the hub
|
default @NotNull SentryId |
captureEnvelope(@NotNull SentryEnvelope envelope)
Captures an envelope.
|
@NotNull SentryId |
captureEnvelope(@NotNull SentryEnvelope envelope,
@Nullable java.lang.Object hint)
Captures an envelope.
|
default @NotNull SentryId |
captureEvent(@NotNull SentryEvent event)
Captures the event.
|
@NotNull SentryId |
captureEvent(@NotNull SentryEvent event,
@Nullable java.lang.Object hint)
Captures the event.
|
default @NotNull SentryId |
captureException(@NotNull java.lang.Throwable throwable)
Captures the exception.
|
@NotNull SentryId |
captureException(@NotNull java.lang.Throwable throwable,
@Nullable java.lang.Object hint)
Captures the exception.
|
default @NotNull SentryId |
captureMessage(@NotNull java.lang.String message)
Captures the message.
|
@NotNull SentryId |
captureMessage(@NotNull java.lang.String message,
@NotNull SentryLevel level)
Captures the message.
|
default @NotNull SentryId |
captureTransaction(@NotNull SentryTransaction transaction,
@Nullable java.lang.Object hint) |
default @NotNull SentryId |
captureTransaction(@NotNull SentryTransaction transaction,
@Nullable TraceState traceState)
Captures the transaction and enqueues it for sending to Sentry server.
|
@NotNull SentryId |
captureTransaction(@NotNull SentryTransaction transaction,
@Nullable TraceState traceState,
@Nullable java.lang.Object hint)
Captures the transaction and enqueues it for sending to Sentry server.
|
void |
captureUserFeedback(@NotNull UserFeedback userFeedback)
Captures a manually created user feedback and sends it to Sentry.
|
void |
clearBreadcrumbs()
Deletes current breadcrumbs from the current scope.
|
@NotNull IHub |
clone()
Clones the Hub
|
void |
close()
Flushes out the queue for up to timeout seconds and disable the Hub.
|
void |
configureScope(@NotNull ScopeCallback callback)
Configures the scope through the callback.
|
void |
endSession()
Ends the current session
|
void |
flush(long timeoutMillis)
Flushes events queued up, but keeps the Hub enabled.
|
@NotNull SentryId |
getLastEventId()
Last event id recorded in the current scope
|
@NotNull SentryOptions |
getOptions()
Gets the
SentryOptions attached to current scope. |
@Nullable ISpan |
getSpan()
Gets the current active transaction or span.
|
boolean |
isEnabled()
Check if the Hub is enabled/active.
|
void |
popScope()
Removes the first scope
|
void |
pushScope()
Pushes a new scope while inheriting the current scope's data.
|
void |
removeExtra(@NotNull java.lang.String key)
Removes the extra key to an arbitrary value to the current Scope
|
void |
removeTag(@NotNull java.lang.String key)
Removes the tag to a string value to the current Scope
|
void |
setExtra(@NotNull java.lang.String key,
@NotNull java.lang.String value)
Sets the extra key to an arbitrary value to the current Scope, overwriting a potential previous
value
|
void |
setFingerprint(@NotNull java.util.List<java.lang.String> fingerprint)
Sets the fingerprint to group specific events together to the current Scope.
|
void |
setLevel(@Nullable SentryLevel level)
Sets the level of all events sent within current Scope
|
void |
setSpanContext(@NotNull java.lang.Throwable throwable,
@NotNull ISpan span,
@NotNull java.lang.String transactionName)
Associates
ISpan and the transaction name with the Throwable . |
void |
setTag(@NotNull java.lang.String key,
@NotNull java.lang.String value)
Sets the tag to a string value to the current Scope, overwriting a potential previous value
|
void |
setTransaction(@Nullable java.lang.String transaction)
Sets the name of the current transaction to the current Scope.
|
void |
setUser(@Nullable User user)
Shallow merges user configuration (email, username, etc) to the current Scope.
|
void |
startSession()
Starts a new session.
|
default @NotNull ITransaction |
startTransaction(@NotNull java.lang.String name,
@NotNull java.lang.String operation)
Creates a Transaction and returns the instance.
|
default @NotNull ITransaction |
startTransaction(@NotNull java.lang.String name,
@NotNull java.lang.String operation,
boolean bindToScope)
Creates a Transaction and returns the instance.
|
default @NotNull ITransaction |
startTransaction(@NotNull java.lang.String name,
@NotNull java.lang.String operation,
@Nullable CustomSamplingContext customSamplingContext)
Creates a Transaction and returns the instance.
|
default @NotNull ITransaction |
startTransaction(@NotNull java.lang.String name,
@NotNull java.lang.String operation,
@Nullable CustomSamplingContext customSamplingContext,
boolean bindToScope)
Creates a Transaction and returns the instance.
|
default @NotNull ITransaction |
startTransaction(@NotNull java.lang.String name,
@NotNull java.lang.String operation,
@Nullable java.util.Date startTimestamp,
boolean waitForChildren,
@Nullable TransactionFinishedCallback transactionFinishedCallback) |
default @NotNull ITransaction |
startTransaction(@NotNull TransactionContext transactionContexts)
Creates a Transaction and returns the instance.
|
default @NotNull ITransaction |
startTransaction(@NotNull TransactionContext transactionContexts,
boolean bindToScope)
Creates a Transaction and returns the instance.
|
default @NotNull ITransaction |
startTransaction(@NotNull TransactionContext transactionContexts,
@Nullable CustomSamplingContext customSamplingContext)
Creates a Transaction and returns the instance.
|
@NotNull ITransaction |
startTransaction(@NotNull TransactionContext transactionContexts,
@Nullable CustomSamplingContext customSamplingContext,
boolean bindToScope)
Creates a Transaction and returns the instance.
|
@NotNull ITransaction |
startTransaction(@NotNull TransactionContext transactionContexts,
@Nullable CustomSamplingContext customSamplingContext,
boolean bindToScope,
@Nullable java.util.Date startTimestamp) |
@NotNull ITransaction |
startTransaction(@NotNull TransactionContext transactionContexts,
@Nullable CustomSamplingContext customSamplingContext,
boolean bindToScope,
@Nullable java.util.Date startTimestamp,
boolean waitForChildren,
@Nullable TransactionFinishedCallback transactionFinishedCallback) |
@Nullable SentryTraceHeader |
traceHeaders()
Returns trace header of active transaction or
null if no transaction is active. |
void |
withScope(@NotNull ScopeCallback callback)
Runs the callback with a new scope which gets dropped at the end
|
boolean isEnabled()
@NotNull @NotNull SentryId captureEvent(@NotNull @NotNull SentryEvent event, @Nullable @Nullable java.lang.Object hint)
event
- the eventhint
- SDK specific but provides high level information about the origin of the event@NotNull default @NotNull SentryId captureEvent(@NotNull @NotNull SentryEvent event)
event
- the event@NotNull default @NotNull SentryId captureMessage(@NotNull @NotNull java.lang.String message)
message
- The message to send.@NotNull @NotNull SentryId captureMessage(@NotNull @NotNull java.lang.String message, @NotNull @NotNull SentryLevel level)
message
- The message to send.level
- The message level.@NotNull @NotNull SentryId captureEnvelope(@NotNull @NotNull SentryEnvelope envelope, @Nullable @Nullable java.lang.Object hint)
envelope
- the SentryEnvelope to send.hint
- SDK specific but provides high level information about the origin of the event@NotNull default @NotNull SentryId captureEnvelope(@NotNull @NotNull SentryEnvelope envelope)
envelope
- the SentryEnvelope to send.@NotNull @NotNull SentryId captureException(@NotNull @NotNull java.lang.Throwable throwable, @Nullable @Nullable java.lang.Object hint)
throwable
- The exception.hint
- SDK specific but provides high level information about the origin of the event@NotNull default @NotNull SentryId captureException(@NotNull @NotNull java.lang.Throwable throwable)
throwable
- The exception.void captureUserFeedback(@NotNull @NotNull UserFeedback userFeedback)
userFeedback
- The user feedback to send to Sentry.void startSession()
void endSession()
void close()
void addBreadcrumb(@NotNull @NotNull Breadcrumb breadcrumb, @Nullable @Nullable java.lang.Object hint)
breadcrumb
- the breadcrumbhint
- SDK specific but provides high level information about the origin of the eventdefault void addBreadcrumb(@NotNull @NotNull Breadcrumb breadcrumb)
breadcrumb
- the breadcrumbdefault void addBreadcrumb(@NotNull @NotNull java.lang.String message)
message
- rendered as text and the whitespace is preserved.default void addBreadcrumb(@NotNull @NotNull java.lang.String message, @NotNull @NotNull java.lang.String category)
message
- rendered as text and the whitespace is preserved.category
- Categories are dotted strings that indicate what the crumb is or where it comes
from.void setLevel(@Nullable @Nullable SentryLevel level)
level
- the Sentry levelvoid setTransaction(@Nullable @Nullable java.lang.String transaction)
transaction
- the transactionvoid setUser(@Nullable @Nullable User user)
user
- the uservoid setFingerprint(@NotNull @NotNull java.util.List<java.lang.String> fingerprint)
fingerprint
- the fingerprintsvoid clearBreadcrumbs()
void setTag(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)
key
- the keyvalue
- the valuevoid removeTag(@NotNull @NotNull java.lang.String key)
key
- the keyvoid setExtra(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)
key
- the keyvalue
- the valuevoid removeExtra(@NotNull @NotNull java.lang.String key)
key
- the key@NotNull @NotNull SentryId getLastEventId()
void pushScope()
void popScope()
void withScope(@NotNull @NotNull ScopeCallback callback)
callback
- the callbackvoid configureScope(@NotNull @NotNull ScopeCallback callback)
callback
- The configure scope callback.void bindClient(@NotNull @NotNull ISentryClient client)
client
- the client.void flush(long timeoutMillis)
timeoutMillis
- time in milliseconds@NotNull @NotNull IHub clone()
@ApiStatus.Internal @NotNull @NotNull SentryId captureTransaction(@NotNull @NotNull SentryTransaction transaction, @Nullable @Nullable TraceState traceState, @Nullable @Nullable java.lang.Object hint)
transaction
- the transactiontraceState
- the trace statehint
- the hint@ApiStatus.Internal @NotNull default @NotNull SentryId captureTransaction(@NotNull @NotNull SentryTransaction transaction, @Nullable @Nullable java.lang.Object hint)
@ApiStatus.Internal @NotNull default @NotNull SentryId captureTransaction(@NotNull @NotNull SentryTransaction transaction, @Nullable @Nullable TraceState traceState)
transaction
- the transactiontraceState
- the trace state@NotNull default @NotNull ITransaction startTransaction(@NotNull @NotNull TransactionContext transactionContexts)
transactionContexts
- the transaction contexts@NotNull default @NotNull ITransaction startTransaction(@NotNull @NotNull TransactionContext transactionContexts, boolean bindToScope)
transactionContexts
- the transaction contextsbindToScope
- if transaction should be bound to scope@NotNull default @NotNull ITransaction startTransaction(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String operation, @Nullable @Nullable CustomSamplingContext customSamplingContext)
TracesSampler
.name
- the transaction nameoperation
- the operationcustomSamplingContext
- the sampling context@NotNull default @NotNull ITransaction startTransaction(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String operation, @Nullable @Nullable CustomSamplingContext customSamplingContext, boolean bindToScope)
TracesSampler
.name
- the transaction nameoperation
- the operationcustomSamplingContext
- the sampling contextbindToScope
- if transaction should be bound to scope@NotNull default @NotNull ITransaction startTransaction(@NotNull @NotNull TransactionContext transactionContexts, @Nullable @Nullable CustomSamplingContext customSamplingContext)
TracesSampler
.transactionContexts
- the transaction contextcustomSamplingContext
- the sampling context@NotNull @NotNull ITransaction startTransaction(@NotNull @NotNull TransactionContext transactionContexts, @Nullable @Nullable CustomSamplingContext customSamplingContext, boolean bindToScope)
TracesSampler
.transactionContexts
- the transaction contextcustomSamplingContext
- the sampling contextbindToScope
- if transaction should be bound to scope@ApiStatus.Internal @NotNull @NotNull ITransaction startTransaction(@NotNull @NotNull TransactionContext transactionContexts, @Nullable @Nullable CustomSamplingContext customSamplingContext, boolean bindToScope, @Nullable @Nullable java.util.Date startTimestamp)
@ApiStatus.Internal @NotNull @NotNull ITransaction startTransaction(@NotNull @NotNull TransactionContext transactionContexts, @Nullable @Nullable CustomSamplingContext customSamplingContext, boolean bindToScope, @Nullable @Nullable java.util.Date startTimestamp, boolean waitForChildren, @Nullable @Nullable TransactionFinishedCallback transactionFinishedCallback)
@NotNull default @NotNull ITransaction startTransaction(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String operation)
SentryOptions.getTracesSampleRate()
the decision if transaction is sampled will be taken by
TracesSampler
.name
- the transaction nameoperation
- the operation@ApiStatus.Internal @NotNull default @NotNull ITransaction startTransaction(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String operation, @Nullable @Nullable java.util.Date startTimestamp, boolean waitForChildren, @Nullable @Nullable TransactionFinishedCallback transactionFinishedCallback)
@NotNull default @NotNull ITransaction startTransaction(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String operation, boolean bindToScope)
SentryOptions.getTracesSampleRate()
the decision if transaction is sampled will be taken by
TracesSampler
.name
- the transaction nameoperation
- the operationbindToScope
- if transaction should be bound to scope@Nullable @Nullable SentryTraceHeader traceHeaders()
null
if no transaction is active.@ApiStatus.Internal void setSpanContext(@NotNull @NotNull java.lang.Throwable throwable, @NotNull @NotNull ISpan span, @NotNull @NotNull java.lang.String transactionName)
ISpan
and the transaction name with the Throwable
. Used to determine
in which trace the exception has been thrown in framework integrations.throwable
- the throwablespan
- the span contexttransactionName
- the transaction name@Nullable @Nullable ISpan getSpan()
@NotNull @NotNull SentryOptions getOptions()
SentryOptions
attached to current scope.