Allow disabling per-filter events in SecurityObservationSettings
Los mantenedores suelen responder en 1 día
@erfannvb ya está trabajando en esto.
Desde el 18/10/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- observability
Línea de trabajo
Start by reading SecurityObservationSettings and ObservationFilterChainDecorator, which the issue identifies as the settings API and the source of per-filter events. Trace how settings control filter chain observations and how the decorator adds events; the payload names no tests or specific files beyond these entry points. Done means filter chain spans and their existing key values remain recorded while per-filter events can be disabled.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Expected Behavior
SecurityObservationSettings offers a way to keep the filter chain observations (i.e. the existing shouldObserveRequests(true) method) but turn off the per-filter events, for example:
@Bean
SecurityObservationSettings securityObservations() {
return SecurityObservationSettings.withDefaults()
.shouldObserveRequests(true)
.shouldObserveFilterEvents(false) // new
.build();
}
With this setting, the security filter spans are still recorded, with their existing key values, but no before XxxFilter / after XxxFilter events are added to them.
Current Behavior
ObservationFilterChainDecorator adds two events per filter to the chain observation (spring.security.filterchains): one named <filter>.before with contextual name before <FilterClass> and one named <filter>.after with contextual name after <FilterClass>. When distributed tracing is enabled, they become span events, so every request produces a dozen or more events such as before LogoutFilter, before RequestCacheAwareFilter, before AuthorizationFilter, and their after counterparts.
SecurityObservationSettings is all-or-nothing per observation type. shouldObserveRequests(false) removes the events, but also removes all the filter chain spans which are really useful for latency analysis and for investigating where a request was rejected. So if we want to remove the span events, we are also forced to get rid of the spans as well currently.
The events cannot be filtered downstream either: Micrometer's ObservationFilter only operates on the context, and events are forwarded to handlers directly.
Replacing the decorator is not really feasible. ObservationFilterChainDecorator is final, has a single ObservationRegistry constructor, and its FilterChainObservationConvention and FilterChainObservationContext are package-private and final.
Context
This was previously requested in #18646, which was closed as "not planned".
Such events might be useful in specific scenarios, but I found that more often than not they are not really needed, yet they are enabled by default and there's no way today to disable them. The consequence of keeping them on is extra noise on the spans when using observability platforms that support span events (e.g. Grafana), which is still acceptable. The main problem happens with observability platforms that don't support span event, such as Elasticsearch, which translates each span event to a log. That is not only noisy but also results in lots of extra disk space used.
There's always an option to operate at the OpenTelemetry level, but that's not optimal since it's not a portable solution and it's not straightforward to target only specific events at that point.
In this issue, I'm suggesting adding a new method to SecurityObservationSettings as a simple solution. But for even greater flexibility, it would be nice to follow the Micrometer best practices and accept an ObservationConvention to customize the filter chain observations, including the events (e.g. ObservationConvention<FilterChainObservationContext>). Perhaps SecurityObservationSettings could accept observation conventions for that.
- Lenguaje dominante
- Java
- Estrellas
- 9.7k
- Forks
- 6.4k
- Merge medio
- 3 h 11 min
- PR fusionados (30 d)
- 19
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de spring-projects/spring-security
-
Update spring-ldap to 4.0.7Abiertotype: dependency-upgrade
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
spring-projects/spring-security#20057 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Update micrometer to 1.16.9Abiertotype: dependency-upgrade
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
spring-projects/spring-security#20056 ·
Los mantenedores suelen responder en 1 día
-
Update spring-ldap to 4.1.3Abiertotype: dependency-upgrade
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
spring-projects/spring-security#20055 ·
Los mantenedores suelen responder en 1 día
-
Update micrometer to 1.17.3Abiertotype: dependency-upgrade
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
spring-projects/spring-security#20054 ·
Los mantenedores suelen responder en 1 día
-
Update spring-ldap to 4.2.0Abiertotype: dependency-upgrade
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
spring-projects/spring-security#20053 ·
Los mantenedores suelen responder en 1 día
Todos los issues de spring-projects/spring-security
Issues similares
-
jules
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
open-learning-exchange/myplanet#18568 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 85/100
hibernate/hibernate-reactive#4485 ·
Los mantenedores suelen responder en 1 día
-
type: dependency-upgrade
Dificultad 2/5 1-3 horas Aptitud para principiantes 61/100
spring-projects/spring-graphql#1556 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
higress-group/higress-console#800 ·
Los mantenedores suelen responder en 1 día