Overview
Sentry allows you to track logs and error in real time. It provides insight into production deployments and information to reproduce and fix crashes.
The integration here supports error handling and reporting to Sentry, performance monitoring via spans and transactions as well as Sentry logging support.
Configuration
Support is enabled by including the following dependency in the WAR overlay:
1
2
3
4
5
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-sentry</artifactId>
<version>${cas.version}</version>
</dependency>
1
implementation "org.apereo.cas:cas-server-support-sentry:${project.'cas.version'}"
1
2
3
4
5
6
7
8
9
dependencyManagement {
imports {
mavenBom "org.apereo.cas:cas-server-support-bom:${project.'cas.version'}"
}
}
dependencies {
implementation "org.apereo.cas:cas-server-support-sentry"
}
1
2
3
4
5
6
7
8
9
10
dependencies {
/*
The following platform references are included automatically and are listed for reference only.
implementation enforcedPlatform("org.apereo.cas:cas-server-support-bom:${project.'cas.version'}")
implementation platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
*/
implementation "org.apereo.cas:cas-server-support-sentry"
}
The Logging configuration file must be adjusted to match the following:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<!-- Setting minimumBreadcrumbLevel modifies the default minimum level to add breadcrumbs from INFO to DEBUG -->
<!-- Setting minimumEventLevel the default minimum level to capture an event from ERROR to WARN -->
<Sentry name="Sentry"
minimumBreadcrumbLevel="DEBUG"
minimumEventLevel="WARN"
dsn="..." />
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Sentry"/>
<AppenderRef ref="casConsole"/>
</Root>
</Loggers>
</Configuration>
The following settings and properties are available from the CAS configuration catalog:
sentry.app-start-extender
sentry.attach-server-name
sentry.attach-stacktrace
sentry.attach-threads
sentry.backpressure-monitor
sentry.bundle-ids
sentry.cache-dir-path
sentry.capture-open-telemetry-events
sentry.clients.ok-http-enabledEnable automatic instrumentation of Spring-managed OkHttp clients.
falseEnable automatic instrumentation of Spring-managed OkHttp clients. Disabled by default.
sentry.composite-performance-collector
sentry.connection-status-provider
sentry.connection-timeout-millis
sentry.context-tags
sentry.continuous-profiler
sentry.cron.default-checkin-margin
sentry.cron.default-failure-issue-threshold
sentry.cron.default-max-runtime
sentry.cron.default-recovery-threshold
sentry.cron.default-timezone
sentry.data-collection
sentry.date-provider
sentry.deadline-timeout
sentry.debug
sentry.debug-meta-loader
sentry.default-scope-type
sentry.diagnostic-level
sentry.dist
sentry.distinct-id
sentry.distribution-controller
sentry.dsn
sentry.enable-aot-compatibilityIf set to true, this flag disables all AOP related features (e.g.
falseIf set to true, this flag disables all AOP related features (e.g. io.sentry.spring7.tracing.SentryTransaction, io.sentry.spring7.tracing.SentrySpan) to successfully compile to GraalVM
sentry.enable-app-start-profiling
sentry.enable-auto-session-tracking
sentry.enable-backpressure-handling
sentry.enable-cache-tracing
sentry.enable-database-transaction-tracing
sentry.enable-deduplication
sentry.enable-event-size-limiting
sentry.enable-external-configuration
sentry.enable-legacy-profiling
sentry.enable-pretty-serialization-output
sentry.enable-queue-tracing
sentry.enable-scope-persistence
sentry.enable-screen-tracking
sentry.enable-shutdown-hook
sentry.enable-spotlight
sentry.enable-time-to-full-display-tracing
sentry.enable-uncaught-exception-handler
sentry.enable-user-interaction-breadcrumbs
sentry.enable-user-interaction-tracing
sentry.enabled
sentry.envelope-disk-cache
sentry.envelope-reader
sentry.environment
sentry.event-processors
sentry.exception-resolver-orderReport all or only uncaught web exceptions.
1Report all or only uncaught web exceptions.
sentry.executor-service
sentry.fatal-logger
sentry.feedback-options
sentry.flush-timeout-millis
sentry.force-init
sentry.fully-displayed-reporter
sentry.gesture-target-locators
sentry.global-hub-mode
sentry.graphql.ignored-error-typesList of error types the Sentry Graphql integration should ignore.
List of error types the Sentry Graphql integration should ignore.
sentry.idle-timeout
sentry.ignored-check-ins
sentry.ignored-errors
sentry.ignored-exceptions-for-type
sentry.ignored-span-origins
sentry.ignored-transactions
sentry.in-app-excludes
sentry.in-app-includes
sentry.init-priority
sentry.instrumenter
sentry.integrations
sentry.keep-transactions-open-for-async-responses
falsesentry.logger
sentry.logging.enabledEnable/Disable logging auto-configuration.
trueEnable/Disable logging auto-configuration.
sentry.logging.loggersList of loggers the SentryAppender should be added to.
List of loggers the SentryAppender should be added to.
sentry.logging.minimum-breadcrumb-levelMinimum logging level for recording breadcrumbs.
Minimum logging level for recording breadcrumbs.
sentry.logging.minimum-event-levelMinimum logging level for recording events.
Minimum logging level for recording events.
sentry.logging.minimum-levelMinimum logging level for recording log events.
Minimum logging level for recording log events.
sentry.logs.enabled
sentry.logs.logger-batch-processor-factory
sentry.max-attachment-size
sentry.max-breadcrumbs
sentry.max-cache-items
sentry.max-depth
sentry.max-feature-flags
sentry.max-queue-size
sentry.max-request-body-size
sentry.max-spans
sentry.max-trace-file-size
sentry.metrics.enabled
sentry.metrics.metrics-batch-processor-factory
sentry.modules-loader
sentry.open-telemetry-mode
sentry.options-observers
sentry.org-id
sentry.performance-collectors
sentry.print-uncaught-stack-trace
sentry.profile-lifecycle
sentry.profile-session-sample-rate
sentry.profiler-converter
sentry.profiles-sample-rate
sentry.profiling-traces-dir-path
sentry.profiling-traces-hz
sentry.proguard-uuid
sentry.propagate-traceparent
sentry.proxy.host
sentry.proxy.pass
sentry.proxy.port
sentry.proxy.type
sentry.proxy.user
sentry.reactive.thread-local-accessor-enabledEnable/Disable usage of io.micrometer.context.ThreadLocalAccessor for Scopes propagation
trueEnable/Disable usage of io.micrometer.context.ThreadLocalAccessor for Scopes propagation
sentry.read-timeout-millis
sentry.release
sentry.replay-controller
sentry.sample-rate
sentry.scope-observers
sentry.scopes-storage-factory
sentry.sdk-version
sentry.send-client-reports
sentry.send-default-pii
sentry.send-modules
sentry.sentry-client-name
sentry.serializer
sentry.server-name
sentry.session-flush-timeout-millis
sentry.session-replay
sentry.session-tracking-interval-millis
sentry.shutdown-timeout-millis
sentry.socket-tagger
sentry.span-factory
sentry.spotlight-connection-url
sentry.ssl-socket-factory
sentry.start-profiler-on-app-start
sentry.strict-trace-continuation
sentry.tags
sentry.thread-checker
sentry.timer-executor-service
sentry.trace-options-requests
sentry.trace-propagation-targets
sentry.trace-sampling
sentry.traces-sample-rate
sentry.transaction-profiler
sentry.transport-factory
sentry.transport-gate
sentry.use-git-commit-id-as-releaseWhether to use Git commit id as a release.
trueWhether to use Git commit id as a release.
sentry.user-filter-orderDefines the io.sentry.spring.SentryUserFilter order.
Defines the io.sentry.spring.SentryUserFilter order. The default value is org.springframework.core.Ordered.LOWEST_PRECEDENCE, if Spring Security is auto-configured, its guaranteed to run after Spring Security filter chain.
sentry.version-detector
sentry.view-hierarchy-exporters
Required settings may be needed to activate or affect the feature; review them even when they have a default. Optional settings only need to be set to change a default or to turn on the behavior they control. Third party settings belong to libraries such as Spring Boot that CAS builds on; their own documentation may have more detail.
Notes on configuration
Configuration Metadata
The collection of configuration properties listed in this section are automatically generated from the CAS source and components that contain the actual field definitions, types, descriptions, modules, etc. This metadata may not always be 100% accurate, or could be lacking details and sufficient explanations.
Be Selective
This section is meant as a guide only. Do NOT copy/paste the entire collection of settings into your CAS configuration; rather pick only the properties that you need. Do NOT enable settings unless you are certain of their purpose and do NOT copy settings into your configuration only to keep them as reference. All these ideas lead to upgrade headaches, maintenance nightmares and premature aging.
YAGNI
Note that for nearly ALL use cases, declaring and configuring properties listed here is sufficient. You should NOT have to explicitly massage a CAS XML/Java/etc configuration file to design an authentication handler, create attribute release policies, etc. CAS at runtime will auto-configure all required changes for you. If you are unsure about the meaning of a given CAS setting, do NOT turn it on without hesitation. Review the codebase or better yet, ask questions to clarify the intended behavior.
Naming Convention
Property names can be specified in very relaxed terms. For instance cas.someProperty, cas.some-property, cas.some_property are all valid names. While all
forms are accepted by CAS, there are certain components (in CAS and other frameworks used) whose activation at runtime is conditional on a property value, where
this property is required to have been specified in CAS configuration using kebab case. This is both true for properties that are owned by CAS as well as those
that might be presented to the system via an external library or framework such as Spring Boot, etc.
When possible, properties should be stored in lower-case kebab format, such as cas.property-name=value.
The only possible exception to this rule is when naming actuator endpoints; The name of the
actuator endpoints (i.e. ssoSessions) MUST remain in camelCase mode.
Settings and properties that are controlled by the CAS platform directly always begin with the prefix cas. All other settings are controlled and provided
to CAS via other underlying frameworks and may have their own schemas and syntax. BE CAREFUL with
the distinction. Unrecognized properties are rejected by CAS and/or frameworks upon which CAS depends. This means if you somehow misspell a property definition
or fail to adhere to the dot-notation syntax and such, your setting is entirely refused by CAS and likely the feature it controls will never be activated in the
way you intend.
Validation
Configuration properties are automatically validated on CAS startup to report issues with configuration binding, especially if defined CAS settings cannot be recognized or validated by the configuration schema. Additional validation processes are also handled via Configuration Metadata and property migrations applied automatically on startup by Spring Boot and family.
Indexed Settings
CAS settings able to accept multiple values are typically documented with an index, such as cas.some.setting[0]=value. The index [0] is meant to be
incremented by the adopter to allow for distinct multiple configuration blocks.
Breadcrumbs are kept in memory (by default the last 100 records) and are sent with events. For example, by default,
if you log 100 entries with logger.info or logger.warn, no event is sent to Sentry. If you then
log with logger.error, an event is sent to Sentry that includes those 100 info or warn messages.
For this to work, SentryAppender needs to receive all log entries to decide what to keep as breadcrumb or send as event.
Set the SentryAppender log level configuration to a value lower than what is set for the minimumBreadcrumbLevel and minimumEventLevel
so that it receives these log messages.
Finally, you will need to configure your DSN (client key) and optionally other values such as environment and release.
You can do so in a src/main/resources/sentry.properties file:
1
dsn=https://12345@12345.ingest.sentry.io/12345
Or via system properties when you launch CAS:
1
java -Dsentry.dsn=https://12345@12345.ingest.sentry.io/12345 ...
Or via environment variables before you launch CAS:
1
export SENTRY_DSN=https://12345@12345.ingest.sentry.io/12345