Package io.sentry

Class SentryOptions

java.lang.Object
io.sentry.SentryOptions
Direct Known Subclasses:
SentryProperties, SentryProperties

public class SentryOptions extends Object
Sentry SDK options
  • Field Details

    • DEFAULT_PROPAGATION_TARGETS

      @Internal @NotNull public static final @NotNull String DEFAULT_PROPAGATION_TARGETS
      See Also:
  • Constructor Details

    • SentryOptions

      public SentryOptions()
      SentryOptions ctor It adds and set default things
  • Method Details

    • addEventProcessor

      public void addEventProcessor(@NotNull @NotNull EventProcessor eventProcessor)
      Adds an event processor
      Parameters:
      eventProcessor - the event processor
    • getEventProcessors

      @NotNull public @NotNull List<EventProcessor> getEventProcessors()
      Returns the list of event processors
      Returns:
      the event processor list
    • addIntegration

      public void addIntegration(@NotNull @NotNull Integration integration)
      Adds an integration
      Parameters:
      integration - the integration
    • getIntegrations

      @NotNull public @NotNull List<Integration> getIntegrations()
      Returns the list of integrations
      Returns:
      the integration list
    • getDsn

      @Nullable public @Nullable String getDsn()
      Returns the DSN
      Returns:
      the DSN or null if not set
    • setDsn

      public void setDsn(@Nullable @Nullable String dsn)
      Sets the DSN
      Parameters:
      dsn - the DSN
    • isDebug

      public boolean isDebug()
      Check if debug mode is ON Default is OFF
      Returns:
      true if ON or false otherwise
    • setDebug

      public void setDebug(boolean debug)
      Sets the debug mode to ON or OFF Default is OFF
      Parameters:
      debug - true if ON or false otherwise
    • getLogger

      @NotNull public @NotNull ILogger getLogger()
      Returns the Logger interface
      Returns:
      the logger
    • setLogger

      public void setLogger(@Nullable @Nullable ILogger logger)
      Sets the Logger interface if null, logger will be NoOp
      Parameters:
      logger - the logger interface
    • getDiagnosticLevel

      @NotNull public @NotNull SentryLevel getDiagnosticLevel()
      Returns the minimum LogLevel
      Returns:
      the log level
    • setDiagnosticLevel

      public void setDiagnosticLevel(@Nullable @Nullable SentryLevel diagnosticLevel)
      Sets the minimum LogLevel if null, it uses the default min. LogLevel Default is DEBUG
      Parameters:
      diagnosticLevel - the log level
    • getSerializer

      @NotNull public @NotNull ISerializer getSerializer()
      Returns the Serializer interface
      Returns:
      the serializer
    • setSerializer

      public void setSerializer(@Nullable @Nullable ISerializer serializer)
      Sets the Serializer interface if null, Serializer will be NoOp
      Parameters:
      serializer - the serializer
    • getMaxDepth

      public int getMaxDepth()
      Returns the max depth for when serializing object graphs using reflection.
      Returns:
      the max depth
    • setMaxDepth

      public void setMaxDepth(int maxDepth)
      Set the max depth for when serializing object graphs using reflection.
      Parameters:
      maxDepth - the max depth
    • getEnvelopeReader

      @NotNull public @NotNull IEnvelopeReader getEnvelopeReader()
    • setEnvelopeReader

      public void setEnvelopeReader(@Nullable @Nullable IEnvelopeReader envelopeReader)
    • getShutdownTimeout

      @ScheduledForRemoval @Deprecated public long getShutdownTimeout()
      Deprecated.
      Returns the shutdown timeout in Millis
      Returns:
      the timeout in Millis
    • getShutdownTimeoutMillis

      public long getShutdownTimeoutMillis()
      Returns the shutdown timeout in Millis
      Returns:
      the timeout in Millis
    • setShutdownTimeout

      @ScheduledForRemoval @Deprecated public void setShutdownTimeout(long shutdownTimeoutMillis)
      Deprecated.
      Sets the shutdown timeout in Millis Default is 2000 = 2s
      Parameters:
      shutdownTimeoutMillis - the shutdown timeout in millis
    • setShutdownTimeoutMillis

      public void setShutdownTimeoutMillis(long shutdownTimeoutMillis)
      Sets the shutdown timeout in Millis Default is 2000 = 2s
      Parameters:
      shutdownTimeoutMillis - the shutdown timeout in millis
    • getSentryClientName

      @Nullable public @Nullable String getSentryClientName()
      Returns the Sentry client name
      Returns:
      the Sentry client name or null if not set
    • setSentryClientName

      public void setSentryClientName(@Nullable @Nullable String sentryClientName)
      Sets the Sentry client name
      Parameters:
      sentryClientName - the Sentry client name
    • getBeforeSend

      @Nullable public @Nullable SentryOptions.BeforeSendCallback getBeforeSend()
      Returns the BeforeSend callback
      Returns:
      the beforeSend callback or null if not set
    • setBeforeSend

      public void setBeforeSend(@Nullable @Nullable SentryOptions.BeforeSendCallback beforeSend)
      Sets the beforeSend callback
      Parameters:
      beforeSend - the beforeSend callback
    • getBeforeSendTransaction

      @Nullable public @Nullable SentryOptions.BeforeSendTransactionCallback getBeforeSendTransaction()
      Returns the BeforeSendTransaction callback
      Returns:
      the beforeSendTransaction callback or null if not set
    • setBeforeSendTransaction

      public void setBeforeSendTransaction(@Nullable @Nullable SentryOptions.BeforeSendTransactionCallback beforeSendTransaction)
      Sets the beforeSendTransaction callback
      Parameters:
      beforeSendTransaction - the beforeSendTransaction callback
    • getBeforeBreadcrumb

      @Nullable public @Nullable SentryOptions.BeforeBreadcrumbCallback getBeforeBreadcrumb()
      Returns the beforeBreadcrumb callback
      Returns:
      the beforeBreadcrumb callback or null if not set
    • setBeforeBreadcrumb

      public void setBeforeBreadcrumb(@Nullable @Nullable SentryOptions.BeforeBreadcrumbCallback beforeBreadcrumb)
      Sets the beforeBreadcrumb callback
      Parameters:
      beforeBreadcrumb - the beforeBreadcrumb callback
    • getCacheDirPath

      @Nullable public @Nullable String getCacheDirPath()
      Returns the cache dir. path if set
      Returns:
      the cache dir. path or null if not set
    • getOutboxPath

      @Nullable public @Nullable String getOutboxPath()
      Returns the outbox path if cacheDirPath is set
      Returns:
      the outbox path or null if not set
    • setCacheDirPath

      public void setCacheDirPath(@Nullable @Nullable String cacheDirPath)
      Sets the cache dir. path
      Parameters:
      cacheDirPath - the cache dir. path
    • getMaxBreadcrumbs

      public int getMaxBreadcrumbs()
      Returns the max Breadcrumbs Default is 100
      Returns:
      the max breadcrumbs
    • setMaxBreadcrumbs

      public void setMaxBreadcrumbs(int maxBreadcrumbs)
      Sets the max breadcrumbs Default is 100
      Parameters:
      maxBreadcrumbs - the max breadcrumbs
    • getRelease

      @Nullable public @Nullable String getRelease()
      Returns the release
      Returns:
      the release or null if not set
    • setRelease

      public void setRelease(@Nullable @Nullable String release)
      Sets the release
      Parameters:
      release - the release
    • getEnvironment

      @Nullable public @Nullable String getEnvironment()
      Returns the environment
      Returns:
      the environment or 'production' if not set
    • setEnvironment

      public void setEnvironment(@Nullable @Nullable String environment)
      Sets the environment
      Parameters:
      environment - the environment
    • getProxy

      @Nullable public @Nullable SentryOptions.Proxy getProxy()
      Returns the proxy if set
      Returns:
      the proxy or null if not set
    • setProxy

      public void setProxy(@Nullable @Nullable SentryOptions.Proxy proxy)
      Sets the proxy
      Parameters:
      proxy - the proxy
    • getSampleRate

      @Nullable public @Nullable Double getSampleRate()
      Returns the sample rate Default is null (disabled)
      Returns:
      the sample rate
    • setSampleRate

      public void setSampleRate(Double sampleRate)
      Sets the sampleRate Can be anything between 0.0 and 1.0 or null (default), to disable it.
      Parameters:
      sampleRate - the sample rate
    • getEnableTracing

      @Nullable public @Nullable Boolean getEnableTracing()
      Whether generation of transactions and propagation of trace data is enabled.

      NOTE: There is also isTracingEnabled() which checks other options as well.

      Returns:
      true if enabled, false if disabled, null can mean enabled if getTracesSampleRate() or getTracesSampler() are set.
    • setEnableTracing

      public void setEnableTracing(@Nullable @Nullable Boolean enableTracing)
      Enables generation of transactions and propagation of trace data.
    • getTracesSampleRate

      @Nullable public @Nullable Double getTracesSampleRate()
      Returns the traces sample rate Default is null (disabled)
      Returns:
      the sample rate
    • setTracesSampleRate

      public void setTracesSampleRate(@Nullable @Nullable Double tracesSampleRate)
      Sets the tracesSampleRate Can be anything between 0.0 and 1.0 or null (default), to disable it.
      Parameters:
      tracesSampleRate - the sample rate
    • getTracesSampler

      @Nullable public @Nullable SentryOptions.TracesSamplerCallback getTracesSampler()
      Returns the callback used to determine if transaction is sampled.
      Returns:
      the callback
    • setTracesSampler

      public void setTracesSampler(@Nullable @Nullable SentryOptions.TracesSamplerCallback tracesSampler)
      Sets the callback used to determine if transaction is sampled.
      Parameters:
      tracesSampler - the callback
    • getInAppExcludes

      @NotNull public @NotNull List<String> getInAppExcludes()
      the list of inApp excludes
      Returns:
      the inApp excludes list
    • addInAppExclude

      public void addInAppExclude(@NotNull @NotNull String exclude)
      Adds an inApp exclude
      Parameters:
      exclude - the inApp exclude module/package
    • getInAppIncludes

      @NotNull public @NotNull List<String> getInAppIncludes()
      Returns the inApp includes list
      Returns:
      the inApp includes list
    • addInAppInclude

      public void addInAppInclude(@NotNull @NotNull String include)
      Adds an inApp include
      Parameters:
      include - the inApp include module/package
    • getTransportFactory

      @NotNull public @NotNull ITransportFactory getTransportFactory()
      Returns the TransportFactory interface
      Returns:
      the transport factory
    • setTransportFactory

      public void setTransportFactory(@Nullable @Nullable ITransportFactory transportFactory)
      Sets the TransportFactory interface
      Parameters:
      transportFactory - the transport factory
    • getDist

      @Nullable public @Nullable String getDist()
      Sets the distribution
      Returns:
      the distribution or null if not set
    • setDist

      public void setDist(@Nullable @Nullable String dist)
      Sets the distribution
      Parameters:
      dist - the distribution
    • getTransportGate

      @NotNull public @NotNull ITransportGate getTransportGate()
      Returns the TransportGate interface
      Returns:
      the transport gate
    • setTransportGate

      public void setTransportGate(@Nullable @Nullable ITransportGate transportGate)
      Sets the TransportGate interface
      Parameters:
      transportGate - the transport gate
    • isAttachStacktrace

      public boolean isAttachStacktrace()
      Checks if the AttachStacktrace is enabled or not
      Returns:
      true if enabled or false otherwise
    • setAttachStacktrace

      public void setAttachStacktrace(boolean attachStacktrace)
      Sets the attachStacktrace to enabled or disabled
      Parameters:
      attachStacktrace - true if enabled or false otherwise
    • isAttachThreads

      public boolean isAttachThreads()
      Checks if the AttachThreads is enabled or not
      Returns:
      true if enabled or false otherwise
    • setAttachThreads

      public void setAttachThreads(boolean attachThreads)
      Sets the attachThreads to enabled or disabled
      Parameters:
      attachThreads - true if enabled or false otherwise
    • isEnableAutoSessionTracking

      public boolean isEnableAutoSessionTracking()
      Returns if the automatic session tracking is enabled or not
      Returns:
      true if enabled or false otherwise
    • setEnableAutoSessionTracking

      public void setEnableAutoSessionTracking(boolean enableAutoSessionTracking)
      Enable or disable the automatic session tracking
      Parameters:
      enableAutoSessionTracking - true if enabled or false otherwise
    • getServerName

      @Nullable public @Nullable String getServerName()
      Gets the default server name to be used in Sentry events.
      Returns:
      the default server name or null if none set
    • setServerName

      public void setServerName(@Nullable @Nullable String serverName)
      Sets the default server name to be used in Sentry events.
      Parameters:
      serverName - the default server name or null if none should be used
    • isAttachServerName

      public boolean isAttachServerName()
      Returns if SDK automatically resolves and attaches server name to events.
      Returns:
      true if enabled false if otherwise
    • setAttachServerName

      public void setAttachServerName(boolean attachServerName)
      Sets if SDK should automatically resolve and attache server name to events.
      Parameters:
      attachServerName - true if enabled false if otherwise
    • getSessionTrackingIntervalMillis

      public long getSessionTrackingIntervalMillis()
      Returns the session tracking interval in millis
      Returns:
      the interval in millis
    • setSessionTrackingIntervalMillis

      public void setSessionTrackingIntervalMillis(long sessionTrackingIntervalMillis)
      Sets the session tracking interval in millis
      Parameters:
      sessionTrackingIntervalMillis - the interval in millis
    • getDistinctId

      @Internal @Nullable public @Nullable String getDistinctId()
      Returns the distinct Id
      Returns:
      the distinct Id
    • setDistinctId

      @Internal public void setDistinctId(@Nullable @Nullable String distinctId)
      Sets the distinct Id
      Parameters:
      distinctId - the distinct Id
    • getFlushTimeoutMillis

      public long getFlushTimeoutMillis()
      Returns the flush timeout in millis
      Returns:
      the timeout in millis
    • setFlushTimeoutMillis

      public void setFlushTimeoutMillis(long flushTimeoutMillis)
      Sets the flush timeout in millis
      Parameters:
      flushTimeoutMillis - the timeout in millis
    • isEnableUncaughtExceptionHandler

      public boolean isEnableUncaughtExceptionHandler()
      Checks if the default UncaughtExceptionHandlerIntegration is enabled or not.
      Returns:
      true if enabled or false otherwise.
    • setEnableUncaughtExceptionHandler

      public void setEnableUncaughtExceptionHandler(boolean enableUncaughtExceptionHandler)
      Enable or disable the default UncaughtExceptionHandlerIntegration.
      Parameters:
      enableUncaughtExceptionHandler - true if enabled or false otherwise.
    • isPrintUncaughtStackTrace

      public boolean isPrintUncaughtStackTrace()
      Checks if printing exceptions by UncaughtExceptionHandler is enabled or disabled.
      Returns:
      true if enabled or false otherwise.
    • setPrintUncaughtStackTrace

      public void setPrintUncaughtStackTrace(boolean printUncaughtStackTrace)
      Enable or disable printing exceptions in UncaughtExceptionHandler
      Parameters:
      printUncaughtStackTrace - true if enabled or false otherwise.
    • getExecutorService

      @Internal @NotNull public @NotNull ISentryExecutorService getExecutorService()
      Returns the SentryExecutorService
      Returns:
      the SentryExecutorService
    • setExecutorService

      @Internal @TestOnly public void setExecutorService(@NotNull @NotNull ISentryExecutorService executorService)
      Sets the SentryExecutorService
      Parameters:
      executorService - the SentryExecutorService
    • getConnectionTimeoutMillis

      public int getConnectionTimeoutMillis()
      Returns the connection timeout in milliseconds.
      Returns:
      the connectionTimeoutMillis
    • setConnectionTimeoutMillis

      public void setConnectionTimeoutMillis(int connectionTimeoutMillis)
      Sets the connection timeout in milliseconds.
      Parameters:
      connectionTimeoutMillis - the connectionTimeoutMillis
    • getReadTimeoutMillis

      public int getReadTimeoutMillis()
      Returns the read timeout in milliseconds
      Returns:
      the readTimeoutMillis
    • setReadTimeoutMillis

      public void setReadTimeoutMillis(int readTimeoutMillis)
      Sets the read timeout in milliseconds
      Parameters:
      readTimeoutMillis - the readTimeoutMillis
    • getEnvelopeDiskCache

      @NotNull public @NotNull IEnvelopeCache getEnvelopeDiskCache()
      Returns the EnvelopeCache interface
      Returns:
      the EnvelopeCache object
    • setEnvelopeDiskCache

      public void setEnvelopeDiskCache(@Nullable @Nullable IEnvelopeCache envelopeDiskCache)
      Sets the EnvelopeCache interface
      Parameters:
      envelopeDiskCache - the EnvelopeCache object
    • getMaxQueueSize

      public int getMaxQueueSize()
      Returns the Max queue size
      Returns:
      the max queue size
    • setMaxQueueSize

      public void setMaxQueueSize(int maxQueueSize)
      Sets the max queue size if maxQueueSize is bigger than 0
      Parameters:
      maxQueueSize - max queue size
    • getSdkVersion

      @Nullable public @Nullable SdkVersion getSdkVersion()
      Returns the SdkVersion object
      Returns:
      the SdkVersion object or null
    • getSslSocketFactory

      @Nullable public @Nullable SSLSocketFactory getSslSocketFactory()
      Returns SSLSocketFactory
      Returns:
      SSLSocketFactory object or null
    • setSslSocketFactory

      public void setSslSocketFactory(@Nullable @Nullable SSLSocketFactory sslSocketFactory)
      Set custom SSLSocketFactory that is trusted to self-signed certificates
      Parameters:
      sslSocketFactory - SSLSocketFactory object
    • setSdkVersion

      @Internal public void setSdkVersion(@Nullable @Nullable SdkVersion sdkVersion)
      Sets the SdkVersion object
      Parameters:
      sdkVersion - the SdkVersion object or null
    • isSendDefaultPii

      public boolean isSendDefaultPii()
    • setSendDefaultPii

      public void setSendDefaultPii(boolean sendDefaultPii)
    • addScopeObserver

      public void addScopeObserver(@NotNull @NotNull IScopeObserver observer)
      Adds a Scope observer
      Parameters:
      observer - the Observer
    • getScopeObservers

      @NotNull public @NotNull List<IScopeObserver> getScopeObservers()
      Returns the list of Scope observers
      Returns:
      the Scope observer list
    • addOptionsObserver

      public void addOptionsObserver(@NotNull @NotNull IOptionsObserver observer)
      Adds a SentryOptions observer
      Parameters:
      observer - the Observer
    • getOptionsObservers

      @NotNull public @NotNull List<IOptionsObserver> getOptionsObservers()
      Returns the list of SentryOptions observers
      Returns:
      the SentryOptions observer list
    • isEnableExternalConfiguration

      public boolean isEnableExternalConfiguration()
      Returns if loading properties from external sources is enabled.
      Returns:
      true if enabled or false otherwise
    • setEnableExternalConfiguration

      public void setEnableExternalConfiguration(boolean enableExternalConfiguration)
      Enables loading options from external sources like sentry.properties file or environment variables, system properties.
      Parameters:
      enableExternalConfiguration - true if enabled or false otherwise
    • getTags

      @NotNull public @NotNull Map<String,String> getTags()
      Returns tags applied to all events and transactions.
      Returns:
      the tags map
    • setTag

      public void setTag(@NotNull @NotNull String key, @NotNull @NotNull String value)
      Sets a tag that is applied to all events and transactions.
      Parameters:
      key - the key
      value - the value
    • getMaxAttachmentSize

      public long getMaxAttachmentSize()
      Returns the maximum attachment size for each attachment in MiB.
      Returns:
      the maximum attachment size in MiB.
    • setMaxAttachmentSize

      public void setMaxAttachmentSize(long maxAttachmentSize)
      Sets the max attachment size for each attachment in bytes. Default is 20 MiB. Please also check the maximum attachment size of Relay to make sure your attachments don't get discarded there: https://docs.sentry.io/product/relay/options/
      Parameters:
      maxAttachmentSize - the max attachment size in bytes.
    • isEnableDeduplication

      public boolean isEnableDeduplication()
      Returns if event deduplication is turned on.
      Returns:
      if event deduplication is turned on.
    • setEnableDeduplication

      public void setEnableDeduplication(boolean enableDeduplication)
      Enables or disables event deduplication.
      Parameters:
      enableDeduplication - true if enabled false otherwise
    • isTracingEnabled

      public boolean isTracingEnabled()
      Returns if tracing should be enabled. If tracing is disabled, starting transactions returns NoOpTransaction.
      Returns:
      if tracing is enabled.
    • getIgnoredExceptionsForType

      @NotNull public @NotNull Set<Class<? extends Throwable>> getIgnoredExceptionsForType()
      Returns the list of exception classes that once captured will not be sent to Sentry as SentryEvent.
      Returns:
      the list of exception classes that once captured will not be sent to Sentry as SentryEvent.
    • addIgnoredExceptionForType

      public void addIgnoredExceptionForType(@NotNull @NotNull Class<? extends Throwable> exceptionType)
      Adds exception type to the list of ignored exceptions.
      Parameters:
      exceptionType - - the exception type
    • getMaxSpans

      @Experimental public int getMaxSpans()
      Returns the maximum number of spans that can be attached to single transaction.
      Returns:
      the maximum number of spans that can be attached to single transaction.
    • setMaxSpans

      @Experimental public void setMaxSpans(int maxSpans)
      Sets the maximum number of spans that can be attached to single transaction.
      Parameters:
      maxSpans - maximum number of spans that can be attached to single transaction.
    • isEnableShutdownHook

      public boolean isEnableShutdownHook()
      True if ShutdownHookIntegration is enabled, false otherwise.
      Returns:
      true if enabled or false otherwise.
    • setEnableShutdownHook

      public void setEnableShutdownHook(boolean enableShutdownHook)
      Enables or disable ShutdownHookIntegration.
      Parameters:
      enableShutdownHook - true if enabled or false otherwise.
    • getMaxCacheItems

      public int getMaxCacheItems()
      The max cache items for capping the number of events Default is 30
      Returns:
      the maxCacheItems
    • setMaxCacheItems

      public void setMaxCacheItems(int maxCacheItems)
      Sets the max cache items for capping the number of events
      Parameters:
      maxCacheItems - the maxCacheItems
    • getMaxRequestBodySize

      @NotNull public @NotNull SentryOptions.RequestSize getMaxRequestBodySize()
    • setMaxRequestBodySize

      public void setMaxRequestBodySize(@NotNull @NotNull SentryOptions.RequestSize maxRequestBodySize)
    • isTraceSampling

      @Experimental public boolean isTraceSampling()
      Returns whether the `baggage` header is attached to HTTP client integrations and the `trace` header is attached to envelopes.

      Note: this is an experimental API and will be removed without notice.

      Returns:
      true if enabled
    • setTraceSampling

      @Deprecated public void setTraceSampling(boolean traceSampling)
      Deprecated.
      Controls if the `baggage` header is attached HTTP client integrations and if the `trace` header is attached to envelopes. Defaults to false.

      Note: this is an experimental API and will be removed without notice.

      Parameters:
      traceSampling - - if trace sampling should be enabled
    • getMaxTraceFileSize

      public long getMaxTraceFileSize()
      Returns the maximum trace file size for each envelope item in bytes.
      Returns:
      the maximum attachment size in bytes.
    • setMaxTraceFileSize

      public void setMaxTraceFileSize(long maxTraceFileSize)
      Sets the max trace file size for each envelope item in bytes. Default is 5 Mb.
      Parameters:
      maxTraceFileSize - the max trace file size in bytes.
    • getTransactionProfiler

      @NotNull public @NotNull ITransactionProfiler getTransactionProfiler()
      Returns the listener interface to perform operations when a transaction is started or ended.
      Returns:
      the listener interface to perform operations when a transaction is started or ended.
    • setTransactionProfiler

      public void setTransactionProfiler(@Nullable @Nullable ITransactionProfiler transactionProfiler)
      Sets the listener interface to perform operations when a transaction is started or ended. It only has effect if no profiler was already set.
      Parameters:
      transactionProfiler - - the listener for operations when a transaction is started or ended
    • isProfilingEnabled

      public boolean isProfilingEnabled()
      Returns if profiling is enabled for transactions.
      Returns:
      if profiling is enabled for transactions.
    • setProfilingEnabled

      @Deprecated public void setProfilingEnabled(boolean profilingEnabled)
      Deprecated.
      Sets whether profiling is enabled for transactions.
      Parameters:
      profilingEnabled - - whether profiling is enabled for transactions
    • getProfilesSampler

      @Nullable public @Nullable SentryOptions.ProfilesSamplerCallback getProfilesSampler()
      Returns the callback used to determine if a profile is sampled.
      Returns:
      the callback
    • setProfilesSampler

      public void setProfilesSampler(@Nullable @Nullable SentryOptions.ProfilesSamplerCallback profilesSampler)
      Sets the callback used to determine if a profile is sampled.
      Parameters:
      profilesSampler - the callback
    • getProfilesSampleRate

      @Nullable public @Nullable Double getProfilesSampleRate()
      Returns the profiles sample rate. Default is null (disabled).
      Returns:
      the sample rate
    • setProfilesSampleRate

      public void setProfilesSampleRate(@Nullable @Nullable Double profilesSampleRate)
      Sets the profilesSampleRate. Can be anything between 0.0 and 1.0 or null (default), to disable it. It's dependent on the {setTracesSampleRate(Double) } If a transaction is sampled, then a profile could be sampled with a probability given by profilesSampleRate.
      Parameters:
      profilesSampleRate - the sample rate
    • getProfilingTracesDirPath

      @Nullable public @Nullable String getProfilingTracesDirPath()
      Returns the profiling traces dir. path if set
      Returns:
      the profiling traces dir. path or null if not set
    • getTracingOrigins

      @Deprecated @NotNull public @NotNull List<String> getTracingOrigins()
      Deprecated.
      Returns a list of origins to which `sentry-trace` header should be sent in HTTP integrations.
      Returns:
      the list of origins
    • addTracingOrigin

      @Deprecated public void addTracingOrigin(@NotNull @NotNull String tracingOrigin)
      Adds an origin to which `sentry-trace` header should be sent in HTTP integrations.
      Parameters:
      tracingOrigin - - the tracing origin
    • setTracingOrigins

      @Deprecated @Internal public void setTracingOrigins(@Nullable @Nullable List<String> tracingOrigins)
      Deprecated.
    • getTracePropagationTargets

      @NotNull public @NotNull List<String> getTracePropagationTargets()
      Returns a list of origins to which `sentry-trace` header should be sent in HTTP integrations.
      Returns:
      the list of targets
    • setTracePropagationTargets

      @Internal public void setTracePropagationTargets(@Nullable @Nullable List<String> tracePropagationTargets)
    • getProguardUuid

      @Nullable public @Nullable String getProguardUuid()
      Returns a Proguard UUID.
      Returns:
      the Proguard UUIDs.
    • setProguardUuid

      public void setProguardUuid(@Nullable @Nullable String proguardUuid)
      Sets a Proguard UUID.
      Parameters:
      proguardUuid - - the Proguard UUID
    • addBundleId

      public void addBundleId(@Nullable @Nullable String bundleId)
      Adds a bundle ID (also known as debugId) representing a source bundle that contains sources for this application. These sources will be used to source code for frames of an exceptions stack trace.
      Parameters:
      bundleId - Bundle ID generated by sentry-cli or the sentry-android-gradle-plugin
    • getBundleIds

      @NotNull public @NotNull Set<String> getBundleIds()
      Returns all configured bundle IDs referencing source code bundles.
      Returns:
      list of bundle IDs
    • getContextTags

      @NotNull public @NotNull List<String> getContextTags()
      Returns Context tags names applied to Sentry events as Sentry tags.
      Returns:
      context tags
    • addContextTag

      public void addContextTag(@NotNull @NotNull String contextTag)
      Adds context tag name that is applied to Sentry events as Sentry tag.
      Parameters:
      contextTag - - the context tag
    • getIdleTimeout

      @Nullable public @Nullable Long getIdleTimeout()
      Returns the idle timeout.
      Returns:
      the idle timeout in millis or null.
    • setIdleTimeout

      public void setIdleTimeout(@Nullable @Nullable Long idleTimeout)
      Sets the idle timeout.
      Parameters:
      idleTimeout - the idle timeout in millis or null.
    • isSendClientReports

      public boolean isSendClientReports()
      Returns whether sending of client reports has been enabled.
      Returns:
      true if enabled; false if disabled
    • setSendClientReports

      public void setSendClientReports(boolean sendClientReports)
      Enables / disables sending of client reports.
      Parameters:
      sendClientReports - true enables client reports; false disables them
    • isEnableUserInteractionTracing

      public boolean isEnableUserInteractionTracing()
    • setEnableUserInteractionTracing

      public void setEnableUserInteractionTracing(boolean enableUserInteractionTracing)
    • isEnableUserInteractionBreadcrumbs

      public boolean isEnableUserInteractionBreadcrumbs()
    • setEnableUserInteractionBreadcrumbs

      public void setEnableUserInteractionBreadcrumbs(boolean enableUserInteractionBreadcrumbs)
    • setInstrumenter

      public void setInstrumenter(@NotNull @NotNull Instrumenter instrumenter)
      Sets the instrumenter used for performance instrumentation.

      If you set this to something other than Instrumenter.SENTRY Sentry will not create any transactions automatically nor will it create transactions if you call startTransaction(...), nor will it create child spans if you call startChild(...)

      Parameters:
      instrumenter - - the instrumenter to use
    • getInstrumenter

      @NotNull public @NotNull Instrumenter getInstrumenter()
      Returns the instrumenter used for performance instrumentation
      Returns:
      the configured instrumenter
    • getClientReportRecorder

      @Internal @NotNull public @NotNull IClientReportRecorder getClientReportRecorder()
      Returns a ClientReportRecorder or a NoOp if sending of client reports has been disabled.
      Returns:
      a client report recorder or NoOp
    • getModulesLoader

      @Internal @NotNull public @NotNull io.sentry.internal.modules.IModulesLoader getModulesLoader()
      Returns a ModulesLoader to load external modules (dependencies/packages) of the program.
      Returns:
      a modules loader or no-op
    • setModulesLoader

      @Internal public void setModulesLoader(@Nullable @Nullable io.sentry.internal.modules.IModulesLoader modulesLoader)
    • getDebugMetaLoader

      @Internal @NotNull public @NotNull io.sentry.internal.debugmeta.IDebugMetaLoader getDebugMetaLoader()
      Returns a DebugMetaLoader to load sentry-debug-meta.properties containing ProGuard UUID, source bundle IDs etc.
      Returns:
      a loader or no-op
    • setDebugMetaLoader

      @Internal public void setDebugMetaLoader(@Nullable @Nullable io.sentry.internal.debugmeta.IDebugMetaLoader debugMetaLoader)
    • getGestureTargetLocators

      public List<io.sentry.internal.gestures.GestureTargetLocator> getGestureTargetLocators()
      Returns a list of all GestureTargetLocator instances used to determine which UiElement was part of an user interaction.
      Returns:
      a list of GestureTargetLocator
    • setGestureTargetLocators

      public void setGestureTargetLocators(@NotNull @NotNull List<io.sentry.internal.gestures.GestureTargetLocator> locators)
      Sets the list of GestureTargetLocator being used to determine relevant UiElement for user interactions.
      Parameters:
      locators - a list of GestureTargetLocator
    • getViewHierarchyExporters

      @NotNull public final @NotNull List<io.sentry.internal.viewhierarchy.ViewHierarchyExporter> getViewHierarchyExporters()
      Returns a list of all ViewHierarchyExporter instances used to export view hierarchy information.
      Returns:
      a list of ViewHierarchyExporter
    • setViewHierarchyExporters

      public void setViewHierarchyExporters(@NotNull @NotNull List<io.sentry.internal.viewhierarchy.ViewHierarchyExporter> exporters)
      Sets the list of ViewHierarchyExporter being used to export the view hierarchy.
      Parameters:
      exporters - a list of ViewHierarchyExporter
    • getMainThreadChecker

      @NotNull public @NotNull IMainThreadChecker getMainThreadChecker()
    • setMainThreadChecker

      public void setMainThreadChecker(@NotNull @NotNull IMainThreadChecker mainThreadChecker)
    • getTransactionPerformanceCollector

      @Internal @NotNull public @NotNull TransactionPerformanceCollector getTransactionPerformanceCollector()
      Gets the performance collector used to collect performance stats while transactions run.
      Returns:
      the performance collector.
    • setTransactionPerformanceCollector

      @Internal public void setTransactionPerformanceCollector(@NotNull @NotNull TransactionPerformanceCollector transactionPerformanceCollector)
      Sets the performance collector used to collect performance stats while transactions run.
      Parameters:
      transactionPerformanceCollector - the performance collector.
    • isEnableTimeToFullDisplayTracing

      public boolean isEnableTimeToFullDisplayTracing()
      Gets if the time-to-full-display spans is tracked in navigation transactions.
      Returns:
      if the time-to-full-display is tracked.
    • setEnableTimeToFullDisplayTracing

      public void setEnableTimeToFullDisplayTracing(boolean enableTimeToFullDisplayTracing)
      Sets if the time-to-full-display spans should be tracked in navigation transactions.
      Parameters:
      enableTimeToFullDisplayTracing - if the time-to-full-display spans should be tracked.
    • getFullyDisplayedReporter

      @Internal @NotNull public @NotNull FullyDisplayedReporter getFullyDisplayedReporter()
      Gets the reporter to call when a screen is fully loaded, used for time-to-full-display spans.
      Returns:
      The reporter to call when a screen is fully loaded.
    • isTraceOptionsRequests

      public boolean isTraceOptionsRequests()
      Whether OPTIONS requests should be traced.
      Returns:
      true if OPTIONS requests should be traced
    • setTraceOptionsRequests

      public void setTraceOptionsRequests(boolean traceOptionsRequests)
      Whether OPTIONS requests should be traced.
      Parameters:
      traceOptionsRequests - true if OPTIONS requests should be traced
    • isEnabled

      public boolean isEnabled()
      Whether Sentry is enabled.
      Returns:
      true if Sentry should be enabled
    • setEnabled

      public void setEnabled(boolean enabled)
      Whether Sentry should be enabled.
      Parameters:
      enabled - true if Sentry should be enabled
    • isEnablePrettySerializationOutput

      public boolean isEnablePrettySerializationOutput()
      Whether to format serialized data, e.g. events logged to console in debug mode
      Returns:
      true if data should be pretty printed
    • isSendModules

      public boolean isSendModules()
      Whether to send modules containing information about versions.
      Returns:
      true if modules should be sent.
    • setEnablePrettySerializationOutput

      public void setEnablePrettySerializationOutput(boolean enablePrettySerializationOutput)
      Whether to format serialized data, e.g. events logged to console in debug mode
      Parameters:
      enablePrettySerializationOutput - true if output should be pretty printed
    • isEnableAppStartProfiling

      public boolean isEnableAppStartProfiling()
      Whether to profile app launches, depending on profilesSampler or profilesSampleRate. Depends on isProfilingEnabled()
      Returns:
      true if app launches should be profiled.
    • setEnableAppStartProfiling

      public void setEnableAppStartProfiling(boolean enableAppStartProfiling)
      Whether to profile app launches, depending on profilesSampler or profilesSampleRate.
      Parameters:
      enableAppStartProfiling - true if app launches should be profiled.
    • setSendModules

      public void setSendModules(boolean sendModules)
      Whether to send modules containing information about versions.
      Parameters:
      sendModules - true if modules should be sent.
    • setIgnoredCheckIns

      @Experimental public void setIgnoredCheckIns(@Nullable @Nullable List<String> ignoredCheckIns)
    • getIgnoredCheckIns

      @Experimental @Nullable public @Nullable List<String> getIgnoredCheckIns()
    • getDateProvider

      @Internal @NotNull public @NotNull SentryDateProvider getDateProvider()
      Returns the current SentryDateProvider that is used to retrieve the current date.
    • setDateProvider

      @Internal public void setDateProvider(@NotNull @NotNull SentryDateProvider dateProvider)
      Sets the SentryDateProvider which is used to retrieve the current date.

      Different providers offer different precision. By default Sentry tries to offer the highest precision available for the system.

    • addPerformanceCollector

      @Internal public void addPerformanceCollector(@NotNull @NotNull IPerformanceCollector collector)
      Adds a ICollector.
      Parameters:
      collector - the ICollector.
    • getPerformanceCollectors

      @Internal @NotNull public @NotNull List<IPerformanceCollector> getPerformanceCollectors()
      Returns the list of ICollectors.
      Returns:
      the IPerformanceCollector list.
    • getConnectionStatusProvider

      @NotNull public @NotNull IConnectionStatusProvider getConnectionStatusProvider()
    • setConnectionStatusProvider

      public void setConnectionStatusProvider(@NotNull @NotNull IConnectionStatusProvider connectionStatusProvider)
    • getBackpressureMonitor

      @Internal @NotNull public @NotNull IBackpressureMonitor getBackpressureMonitor()
    • setBackpressureMonitor

      @Internal public void setBackpressureMonitor(@NotNull @NotNull IBackpressureMonitor backpressureMonitor)
    • setEnableBackpressureHandling

      @Experimental public void setEnableBackpressureHandling(boolean enableBackpressureHandling)
    • getProfilingTracesHz

      @Internal public int getProfilingTracesHz()
      Returns the rate the profiler will sample rates at. 100 hz means 100 traces in 1 second.
      Returns:
      Rate the profiler will sample rates at.
    • setProfilingTracesHz

      @Internal public void setProfilingTracesHz(int profilingTracesHz)
      Sets the rate the profiler will sample rates at. 100 hz means 100 traces in 1 second.
    • isEnableBackpressureHandling

      @Experimental public boolean isEnableBackpressureHandling()
    • getSessionFlushTimeoutMillis

      @Internal public long getSessionFlushTimeoutMillis()
    • setSessionFlushTimeoutMillis

      @Internal public void setSessionFlushTimeoutMillis(long sessionFlushTimeoutMillis)
    • getBeforeEnvelopeCallback

      @Internal @Nullable public @Nullable SentryOptions.BeforeEnvelopeCallback getBeforeEnvelopeCallback()
    • setBeforeEnvelopeCallback

      @Internal public void setBeforeEnvelopeCallback(@Nullable @Nullable SentryOptions.BeforeEnvelopeCallback beforeEnvelopeCallback)
    • getSpotlightConnectionUrl

      @Experimental @Nullable public @Nullable String getSpotlightConnectionUrl()
    • setSpotlightConnectionUrl

      @Experimental public void setSpotlightConnectionUrl(@Nullable @Nullable String spotlightConnectionUrl)
    • isEnableSpotlight

      @Experimental public boolean isEnableSpotlight()
    • setEnableSpotlight

      @Experimental public void setEnableSpotlight(boolean enableSpotlight)
    • isEnableScopePersistence

      public boolean isEnableScopePersistence()
    • setEnableScopePersistence

      public void setEnableScopePersistence(boolean enableScopePersistence)
    • isEnableMetrics

      @Experimental public boolean isEnableMetrics()
    • setEnableMetrics

      @Experimental public void setEnableMetrics(boolean enableMetrics)
    • isEnableSpanLocalMetricAggregation

      @Experimental public boolean isEnableSpanLocalMetricAggregation()
    • setEnableSpanLocalMetricAggregation

      @Experimental public void setEnableSpanLocalMetricAggregation(boolean enableSpanLocalMetricAggregation)
    • isEnableDefaultTagsForMetrics

      @Experimental public boolean isEnableDefaultTagsForMetrics()
    • setEnableDefaultTagsForMetrics

      @Experimental public void setEnableDefaultTagsForMetrics(boolean enableDefaultTagsForMetrics)
    • getBeforeEmitMetricCallback

      @Experimental @Nullable public @Nullable SentryOptions.BeforeEmitMetricCallback getBeforeEmitMetricCallback()
    • setBeforeEmitMetricCallback

      @Experimental public void setBeforeEmitMetricCallback(@Nullable @Nullable SentryOptions.BeforeEmitMetricCallback beforeEmitMetricCallback)
    • getCron

      @Nullable public @Nullable SentryOptions.Cron getCron()
    • setCron

      @Experimental public void setCron(@Nullable @Nullable SentryOptions.Cron cron)
    • empty

      @Internal @NotNull public static @NotNull SentryOptions empty()
      Creates SentryOptions instance without initializing any of the internal parts.

      Used by NoOpHub.

      Returns:
      SentryOptions
    • merge

      public void merge(@NotNull @NotNull ExternalOptions options)
      Merges with another SentryOptions object. Used when loading additional options from external locations.
      Parameters:
      options - options loaded from external locations