public class DefaultSentryClientFactory extends SentryClientFactory
SentryClientFactory
.
In most cases this is the implementation to use or extend for additional features.
Modifier and Type | Class and Description |
---|---|
protected static class |
DefaultSentryClientFactory.DaemonThreadFactory
Thread factory generating daemon threads with a custom priority.
|
Modifier and Type | Field and Description |
---|---|
static String |
ASYNC_GRACEFUL_SHUTDOWN_OPTION
Option to disable the graceful shutdown of the async connection.
|
static String |
ASYNC_OPTION
Option for whether to send events asynchronously.
|
static String |
ASYNC_PRIORITY_OPTION
Option for the priority of threads used for the async connection.
|
static String |
ASYNC_QUEUE_DISCARDNEW
Async executor overflow behavior that will discard the new event that was attempting
to be sent.
|
static String |
ASYNC_QUEUE_DISCARDOLD
Async executor overflow behavior that will discard old events in the queue.
|
static String |
ASYNC_QUEUE_OVERFLOW_DEFAULT
Default behavior to use when the async executor queue is full.
|
static String |
ASYNC_QUEUE_OVERFLOW_OPTION
Option for what to do when the async executor queue is full.
|
static String |
ASYNC_QUEUE_SIZE_OPTION
Option for the maximum size of the async send queue.
|
static String |
ASYNC_QUEUE_SYNC
Async executor overflow behavior that will cause a synchronous send to occur on the
current thread.
|
static long |
ASYNC_SHUTDOWN_TIMEOUT_DEFAULT
Default timeout of the
AsyncConnection executor, in milliseconds. |
static String |
ASYNC_SHUTDOWN_TIMEOUT_OPTION
Option for the graceful shutdown timeout of the async executor, in milliseconds.
|
static String |
ASYNC_THREADS_OPTION
Option for the number of threads used for the async connection.
|
static String |
BUFFER_DIR_OPTION
Option to buffer events to disk when network is down.
|
static boolean |
BUFFER_ENABLED_DEFAULT
Default value for whether buffering is enabled (if a directory is also provided).
|
static String |
BUFFER_ENABLED_OPTION
Option to enable or disable Event buffering.
|
static long |
BUFFER_FLUSHTIME_DEFAULT
Default number of milliseconds between attempts to flush buffered events.
|
static String |
BUFFER_FLUSHTIME_OPTION
Option for how long to wait between attempts to flush the disk buffer, in milliseconds.
|
static String |
BUFFER_GRACEFUL_SHUTDOWN_OPTION
Option to disable the graceful shutdown of the buffer flusher.
|
static long |
BUFFER_SHUTDOWN_TIMEOUT_DEFAULT
Default timeout of the
BufferedConnection shutdown, in milliseconds. |
static String |
BUFFER_SHUTDOWN_TIMEOUT_OPTION
Option for the graceful shutdown timeout of the buffer flushing executor, in milliseconds.
|
static int |
BUFFER_SIZE_DEFAULT
Default number of events to cache offline when network is down or project is throttled.
|
static String |
BUFFER_SIZE_OPTION
Option for maximum number of events to cache offline when network is down.
|
static String |
COMPRESSION_OPTION
Option for whether to compress requests sent to the Sentry Server.
|
static String |
DIST_OPTION
Option to set the distribution of the application.
|
static String |
ENVIRONMENT_OPTION
Option to set the environment of the application.
|
static String |
EXTRA_OPTION
Option to set extra data to be sent to Sentry.
|
static String |
EXTRATAGS_OPTION
Deprecated.
prefer
MDCTAGS_OPTION |
static String |
HIDE_COMMON_FRAMES_OPTION
Option for whether to hide common stackframes with enclosing exceptions.
|
static String |
HTTP_PROXY_HOST_OPTION
Option to set an HTTP proxy hostname for Sentry connections.
|
static String |
HTTP_PROXY_PASS_OPTION
Option to set an HTTP proxy password for Sentry connections.
|
static int |
HTTP_PROXY_PORT_DEFAULT
The default HTTP proxy port to use if an HTTP Proxy hostname is set but port is not.
|
static String |
HTTP_PROXY_PORT_OPTION
Option to set an HTTP proxy port for Sentry connections.
|
static String |
HTTP_PROXY_USER_OPTION
Option to set an HTTP proxy username for Sentry connections.
|
static String |
IN_APP_FRAMES_OPTION
Option for which package prefixes are part of the user's application code, as a single
comma separated string.
|
static String |
MAX_MESSAGE_LENGTH_OPTION
Option to set the maximum length of the message body in the requests to the
Sentry Server.
|
static String |
MDCTAGS_OPTION
Option to set tags that are extracted from the MDC system, where applicable.
|
static String |
NAIVE_PROTOCOL
Protocol setting to disable security checks over an SSL connection.
|
static int |
QUEUE_SIZE_DEFAULT
The default async queue size if none is provided.
|
static String |
RELEASE_OPTION
Option to set the version of the application.
|
static String |
SAMPLE_RATE_OPTION
Option for whether to sample events, allowing from 0.0 to 1.0 (0 to 100%) to be sent to the server.
|
static String |
SERVERNAME_OPTION
Option to set the server name.
|
static String |
TAGS_OPTION
Option to set additional tags to be sent to Sentry.
|
static int |
TIMEOUT_DEFAULT
Default timeout of an HTTP connection to Sentry.
|
static String |
TIMEOUT_OPTION
Option to set a timeout for requests to the Sentry server, in milliseconds.
|
static String |
UNCAUGHT_HANDLER_ENABLED_OPTION
Option for whether to enable an uncaught exception handler, defaults to 'true'.
|
Constructor and Description |
---|
DefaultSentryClientFactory() |
Modifier and Type | Method and Description |
---|---|
protected SentryClient |
configureSentryClient(SentryClient sentryClient,
Dsn dsn)
Configures a
SentryClient instance after it has been constructed. |
protected Connection |
createAsyncConnection(Dsn dsn,
Connection connection)
Encapsulates an already existing connection in an
AsyncConnection and get the async options from the
Sentry DSN. |
protected Connection |
createConnection(Dsn dsn)
Creates a connection to the given DSN by determining the protocol.
|
protected Connection |
createHttpConnection(Dsn dsn)
Creates an HTTP connection to the Sentry server.
|
protected JsonMarshaller |
createJsonMarshaller(int maxMessageLength)
Create a
JsonMarshaller . |
protected Marshaller |
createMarshaller(Dsn dsn)
Creates a JSON marshaller that will convert every
Event in a format
handled by the Sentry server. |
SentryClient |
createSentryClient(Dsn dsn)
Creates an instance of Sentry given a DSN.
|
protected Connection |
createStdOutConnection(Dsn dsn)
Uses stdout to send the logs.
|
protected boolean |
getAsyncEnabled(Dsn dsn)
Whether or not to wrap the underlying connection in an
AsyncConnection . |
protected boolean |
getAsyncGracefulShutdownEnabled(Dsn dsn)
Whether or not to attempt the graceful shutdown of the
AsyncConnection upon close. |
protected int |
getAsyncPriority(Dsn dsn)
Priority of threads used for the async connection.
|
protected int |
getAsyncQueueSize(Dsn dsn)
Maximum size of the async send queue.
|
protected long |
getAsyncShutdownTimeout(Dsn dsn)
The graceful shutdown timeout of the async executor, in milliseconds.
|
protected int |
getAsyncThreads(Dsn dsn)
The number of threads used for the async connection.
|
protected Buffer |
getBuffer(Dsn dsn)
Get the
Buffer where events are stored when network is down. |
protected boolean |
getBufferedConnectionGracefulShutdownEnabled(Dsn dsn)
Whether or not to attempt a graceful shutdown of the
BufferedConnection upon close. |
protected long |
getBufferedConnectionShutdownTimeout(Dsn dsn)
Maximum time to wait for
BufferedConnection shutdown when closed, in milliseconds. |
protected boolean |
getBufferEnabled(Dsn dsn)
Whether or not buffering is enabled.
|
protected long |
getBufferFlushtime(Dsn dsn)
How long to wait between attempts to flush the disk buffer, in milliseconds.
|
protected int |
getBufferSize(Dsn dsn)
Get the maximum number of events to cache offline when network is down.
|
protected boolean |
getBypassSecurityEnabled(Dsn dsn)
Whether to disable security checks over an SSL connection.
|
protected boolean |
getCompressionEnabled(Dsn dsn)
Whether to compress requests sent to the Sentry Server.
|
protected ContextManager |
getContextManager(Dsn dsn)
Returns the
ContextManager to use for locating and storing data that is context specific,
such as Breadcrumb s. |
protected String |
getDist(Dsn dsn)
Application distribution to send with
Event s that don't already
have a value for the field set. |
protected String |
getEnvironment(Dsn dsn)
Application environmentribution to send with
Event s that don't already
have a value for the field set. |
protected Map<String,String> |
getExtra(Dsn dsn)
Extra data to send with
Event s. |
protected Set<String> |
getExtraTags(Dsn dsn)
Deprecated.
prefer
getMdcTags(Dsn) |
protected boolean |
getHideCommonFramesEnabled(Dsn dsn)
Whether to hide common stackframes with enclosing exceptions.
|
protected Collection<String> |
getInAppFrames(Dsn dsn)
Returns the list of package names to consider "in-app".
|
protected int |
getMaxMessageLength(Dsn dsn)
The maximum length of the message body in the requests to the Sentry Server.
|
protected Set<String> |
getMdcTags(Dsn dsn)
Tags to extract from the MDC system and set on
Event s, where applicable. |
protected String |
getProxyHost(Dsn dsn)
HTTP proxy hostname for Sentry connections.
|
protected String |
getProxyPass(Dsn dsn)
HTTP proxy password for Sentry connections.
|
protected int |
getProxyPort(Dsn dsn)
HTTP proxy port for Sentry connections.
|
protected String |
getProxyUser(Dsn dsn)
HTTP proxy username for Sentry connections.
|
protected RejectedExecutionHandler |
getRejectedExecutionHandler(Dsn dsn)
Handler for tasks that cannot be immediately queued by a
ThreadPoolExecutor . |
protected String |
getRelease(Dsn dsn)
Application version to send with
Event s that don't already
have a value for the field set. |
protected Double |
getSampleRate(Dsn dsn)
Whether to sample events, and if so how much to allow through to the server (from 0.0 to 1.0).
|
protected String |
getServerName(Dsn dsn)
Server name to send with
Event s that don't already
have a value for the field set. |
protected Map<String,String> |
getTags(Dsn dsn)
Additional tags to send with
Event s. |
protected int |
getTimeout(Dsn dsn)
Timeout for requests to the Sentry server, in milliseconds.
|
protected boolean |
getUncaughtHandlerEnabled(Dsn dsn)
Whether or not to enable a
SentryUncaughtExceptionHandler . |
sentryClient, sentryClient, sentryClient, toString
public static final String NAIVE_PROTOCOL
public static final String COMPRESSION_OPTION
public static final String MAX_MESSAGE_LENGTH_OPTION
public static final String TIMEOUT_OPTION
public static final int TIMEOUT_DEFAULT
public static final String BUFFER_ENABLED_OPTION
public static final boolean BUFFER_ENABLED_DEFAULT
public static final String BUFFER_DIR_OPTION
public static final String BUFFER_SIZE_OPTION
public static final int BUFFER_SIZE_DEFAULT
public static final String BUFFER_FLUSHTIME_OPTION
public static final long BUFFER_FLUSHTIME_DEFAULT
public static final String BUFFER_GRACEFUL_SHUTDOWN_OPTION
public static final String BUFFER_SHUTDOWN_TIMEOUT_OPTION
public static final long BUFFER_SHUTDOWN_TIMEOUT_DEFAULT
BufferedConnection
shutdown, in milliseconds.public static final String ASYNC_OPTION
public static final String ASYNC_GRACEFUL_SHUTDOWN_OPTION
public static final String ASYNC_THREADS_OPTION
public static final String ASYNC_PRIORITY_OPTION
public static final String ASYNC_QUEUE_SIZE_OPTION
public static final String ASYNC_QUEUE_OVERFLOW_OPTION
public static final String ASYNC_QUEUE_DISCARDOLD
public static final String ASYNC_QUEUE_DISCARDNEW
public static final String ASYNC_QUEUE_SYNC
public static final String ASYNC_QUEUE_OVERFLOW_DEFAULT
public static final String ASYNC_SHUTDOWN_TIMEOUT_OPTION
public static final long ASYNC_SHUTDOWN_TIMEOUT_DEFAULT
AsyncConnection
executor, in milliseconds.public static final String IN_APP_FRAMES_OPTION
public static final String HIDE_COMMON_FRAMES_OPTION
public static final String SAMPLE_RATE_OPTION
public static final String HTTP_PROXY_HOST_OPTION
public static final String HTTP_PROXY_PORT_OPTION
public static final String HTTP_PROXY_USER_OPTION
public static final String HTTP_PROXY_PASS_OPTION
public static final int QUEUE_SIZE_DEFAULT
public static final int HTTP_PROXY_PORT_DEFAULT
public static final String RELEASE_OPTION
public static final String DIST_OPTION
public static final String ENVIRONMENT_OPTION
public static final String SERVERNAME_OPTION
public static final String TAGS_OPTION
@Deprecated public static final String EXTRATAGS_OPTION
MDCTAGS_OPTION
public static final String MDCTAGS_OPTION
public static final String EXTRA_OPTION
public static final String UNCAUGHT_HANDLER_ENABLED_OPTION
public SentryClient createSentryClient(Dsn dsn)
SentryClientFactory
createSentryClient
in class SentryClientFactory
dsn
- Data Source Name of the Sentry server.protected SentryClient configureSentryClient(SentryClient sentryClient, Dsn dsn)
SentryClient
instance after it has been constructed.sentryClient
- The SentryClient
to configure.dsn
- Data Source Name of the Sentry server to use.SentryClient
instance, after configuration.protected Connection createConnection(Dsn dsn)
dsn
- Data Source Name of the Sentry server to use.protected Connection createAsyncConnection(Dsn dsn, Connection connection)
AsyncConnection
and get the async options from the
Sentry DSN.dsn
- Data Source Name of the Sentry server.connection
- Connection to encapsulate in an AsyncConnection
.protected Connection createHttpConnection(Dsn dsn)
dsn
- Data Source Name of the Sentry server.HttpConnection
to the server.protected Connection createStdOutConnection(Dsn dsn)
dsn
- Data Source Name of the Sentry server.OutputStreamConnection
using System.out
.protected Marshaller createMarshaller(Dsn dsn)
Event
in a format
handled by the Sentry server.dsn
- Data Source Name of the Sentry server.JsonMarshaller
to process the events.protected JsonMarshaller createJsonMarshaller(int maxMessageLength)
JsonMarshaller
. This method makes it easier to provide a custom implementation.maxMessageLength
- of the whole json outputprotected ContextManager getContextManager(Dsn dsn)
ContextManager
to use for locating and storing data that is context specific,
such as Breadcrumb
s.
Defaults to ThreadLocalContextManager
.
dsn
- Sentry server DSN which may contain options.ContextManager
to use.protected Collection<String> getInAppFrames(Dsn dsn)
Those packages will be used with the StackTraceInterface
to show frames that are a part of
the main application in the Sentry UI by default.
dsn
- Sentry server DSN which may contain options.protected boolean getAsyncEnabled(Dsn dsn)
AsyncConnection
.dsn
- Sentry server DSN which may contain options.AsyncConnection
.protected RejectedExecutionHandler getRejectedExecutionHandler(Dsn dsn)
ThreadPoolExecutor
.dsn
- Sentry server DSN which may contain options.ThreadPoolExecutor
.protected long getBufferedConnectionShutdownTimeout(Dsn dsn)
BufferedConnection
shutdown when closed, in milliseconds.dsn
- Sentry server DSN which may contain options.BufferedConnection
shutdown when closed, in milliseconds.protected boolean getBufferedConnectionGracefulShutdownEnabled(Dsn dsn)
BufferedConnection
upon close.dsn
- Sentry server DSN which may contain options.BufferedConnection
upon close.protected long getBufferFlushtime(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected long getAsyncShutdownTimeout(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected boolean getAsyncGracefulShutdownEnabled(Dsn dsn)
AsyncConnection
upon close.dsn
- Sentry server DSN which may contain options.AsyncConnection
upon close.protected int getAsyncQueueSize(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected int getAsyncPriority(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected int getAsyncThreads(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected boolean getBypassSecurityEnabled(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected Double getSampleRate(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected int getProxyPort(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected String getProxyHost(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected String getProxyUser(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected String getProxyPass(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected String getRelease(Dsn dsn)
Event
s that don't already
have a value for the field set.dsn
- Sentry server DSN which may contain options.Event
s.protected String getDist(Dsn dsn)
Event
s that don't already
have a value for the field set.dsn
- Sentry server DSN which may contain options.Event
s.protected String getEnvironment(Dsn dsn)
Event
s that don't already
have a value for the field set.dsn
- Sentry server DSN which may contain options.Event
s.protected String getServerName(Dsn dsn)
Event
s that don't already
have a value for the field set.dsn
- Sentry server DSN which may contain options.Event
s.protected Map<String,String> getTags(Dsn dsn)
Event
s.dsn
- Sentry server DSN which may contain options.Event
s.@Deprecated protected Set<String> getExtraTags(Dsn dsn)
getMdcTags(Dsn)
Event
s, where applicable.dsn
- Sentry server DSN which may contain options.Event
s, where applicable.protected Set<String> getMdcTags(Dsn dsn)
Event
s, where applicable.dsn
- Sentry server DSN which may contain options.Event
s, where applicable.protected Map<String,String> getExtra(Dsn dsn)
Event
s.dsn
- Sentry server DSN which may contain options.Event
s.protected boolean getCompressionEnabled(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected boolean getHideCommonFramesEnabled(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected int getMaxMessageLength(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected int getTimeout(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected boolean getBufferEnabled(Dsn dsn)
dsn
- Sentry server DSN which may contain options.protected Buffer getBuffer(Dsn dsn)
Buffer
where events are stored when network is down.dsn
- Dsn passed in by the user.Buffer
where events are stored when network is down.protected int getBufferSize(Dsn dsn)
dsn
- Dsn passed in by the user.protected boolean getUncaughtHandlerEnabled(Dsn dsn)
SentryUncaughtExceptionHandler
.dsn
- Sentry server DSN which may contain options.SentryUncaughtExceptionHandler
.Copyright © 2012–2018. All rights reserved.