Giriş
Actuator projesi Application Performance Monitoring işlemi içindir. Bu işlemin amacı şöyle.
Gözlemlenebilirlik - Observability
5 tane temel örüntü var. Actuator, Application Metrics kısmını sağlar.
Açıklaması şöyle. /actuator/** adresi için istenilen ayar yapılır
Actuator projesi Application Performance Monitoring işlemi içindir. Bu işlemin amacı şöyle.
I think you could broadly define it as anything that has to do with monitoring the performance of a website or application. For example, there are tools that do nothing but check your website every minute to see if it is online and how long it takes to load. I guess you could say this is the absolute simplest form of application performance monitoring.Application Performance Management (APM) ise biraz daha farklı. Bu işlemin amacı şöyle.
Most APM solutions automatically discover and help you track all of your applications across all environments. Including pre-production and production environments.
There are several things that development teams need to track and manage their applications:
- Application type (web, background service, etc).
- Installed locations and the number of server instances.
- Deployment history.
- Application availability/uptime (SLAs).
- Web application traffic/usage.
- Performance indicators (response times, satisfaction scores, etc).
- Error rates.
Tüm endpointleri görmek için şöyle yaparız
http://localhost:8080/actuator
5 tane temel örüntü var. Actuator, Application Metrics kısmını sağlar.
Health-Check APIActuator ve Security
Distributed Tracing
Application Metrics
Exception Tracking
Audit Logging
Applicaton Logging
Açıklaması şöyle. /actuator/** adresi için istenilen ayar yapılır
There is no need to worry about security; if Spring Security is present, then these endpoints are secured by default using Spring Security’s content-negotiation strategy. Or else, we can configure custom security by the help of RequestMatcher.
Örnek
Eğer her şeye izin vermek istersek şöyle yaparız
@Bean public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { // to keep things simple, API endpoints are permitted for all httpSecurity .headers().frameOptions().disable() .and() .csrf().disable() .authorizeRequests() .antMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll() .antMatchers("/h2-console/**").permitAll()
.antMatchers(HttpMethod.GET, "/actuator/health/**").permitAll()
.anyRequest() .authenticated() .and() .httpBasic() .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS); return httpSecurity.build(); }
Örnek
Şöyle yaparız
@Bean public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { return http.authorizeExchange()
.pathMatchers("/actuator/**").permitAll()
.anyExchange().authenticated() .and().build(); }
Açıklaması şöyle.
Metrics have to be stored somewhere. The most popular tools for that are InfluxDB and Prometheus. They are representing two different models of collecting data. Prometheus periodically retrieves data from endpoint exposed by the application, while InfluxDB provides REST API that has to be called by the application. The integration with those two tools and several other is realized with the Micrometer library.Maven
Şu satırı dahil ederiz.
<dependency>
<groupId> org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Actuator'ı silmek için maven'dan spring-boot-starter-actuator satırı silinir. Açıklaması şöyle.Enabling/disabling the actuator is easy; the simplest way is to enable features to add the dependency (Maven/Gradle) to the spring-boot-starter-actuator, i.e. Starter. If you don't want the actuator to be enabled, then don't add the dependency.
actuator Endpoint
Açıklaması şöyle
it will list down all the endpoints that are enabled and exposed.
Örnek bir çıktı şöyle
{
"_links":{
"self":{
"href":"http://localhost:8080/actuator",
"templated":false
},
"info":{
"href":"http://localhost:8080/actuator/info",
"templated":false
},
"env":{
"href":"http://localhost:8080/actuator/env",
"templated":false
},
"env-toMatch":{
"href":"http://localhost:8080/actuator/env/{toMatch}",
"templated":true
}
}
}
auditevents Endpoint
Once Spring Security is in play, Spring Boot Actuator has a flexible audit framework that publishes events (by default, “authentication success”, “failure” and “access denied” exceptions). This feature can be very useful for reporting and for implementing a lock-out policy based on authentication failures.
beans Endpoint
beans Endpoint yazısına taşıdım
caches Endpoint
Açıklaması şöyle
Exposes available caches
httptrace Endpoint
http trace Endpoint yazısına taşıdım
loggers Endpoint
Loggers Endpoint yazısına taşıdım.
Loggers Endpoint yazısına taşıdım.
mappings Endpoint
Açıklaması şöyle
Displays a list of all request mappings in the application.
metrics Endpoint
Metrics Endpoint yazısına taşıdım.
Örnek
Konfigürasyon ayarlarını tekrar okumak için şöyle yaparız.
Shutdown Endpoint yazısına taşıdım
curl localhost:8080/actuator/refresh -d {} -H "Content-Type: application/json
shutdown EndpointShutdown Endpoint yazısına taşıdım
startup Endpoint
Startup Endpoint yazısına taşıdım.
Hiç yorum yok:
Yorum Gönder