44-Spring-Boot-Actuator Flashcards

1
Q

What is the default actuator endpoint? How to change it?

A

/actuator

management.endpoints.web.base-path=/admin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to get the list of supported metrics?

A

/actuator/metrics returns {names: […]}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Configuration to expose metrics via HTTP?

A

management.endpoints.web.exposure.include=metrics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

URL to view details of a metric?

A

/actuator/metrics/metric-name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List out 10 actuator endpoints

A
health
info
metrics
liquibase
flyway
auditevents
beans
caches
conditions
env
loggers
mappings
sessions
threaddump
shutdown
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What endpoints are enabled and exposed via HTTP?

A

HTTP: all enabled except shutdown, httptrace, and auditevents. Expose only heath and info

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to enabled endpoints via JMX?

A

spring.jmx.enabled=true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

By default, what endpoints are disabled via HTTP?

A

shutdown, httptrace and auditevents

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What endpoints are enabled and exposed via JMX?

A

JMX: disabled by default, all enabled are exposed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to expose all endpoints via HTTP?

A

management.endpoints.web.exposure.include=*

Note: endpoints with s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

2 ways to secure endpoints via Spring Security?

A
With Spring security:
http.authorizeRequests()
    .mvcMatcher("/actuator/**").hasRole("ACTUATOR")
    .anyRequest().authenticated();
OR:
http.authorizeRequests()
    .requestMatchers(EndpointRequest.toAnyEndpoint()).hasRole("ACTUATOR)
    .anyRequest().authenticated();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

List out custom metric classes

A

Counter
Gauge
Timer
DistributionSummary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to register a metric?

A

Inject and use MeterRegistry

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the naming convention of hierarchical HTTP metrics?

A

http.method.$methodName.status.$statusName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to get the value of a tagged HTTP metric by status and method?

A

http?tag=method:get&tag=status:200

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Configuration to enable viewing details of health indicators?

A

management.endpoint.health.show-details=always

Note: endpoint without s

17
Q

List out 10 health indicators

A
db
diskSpace
jms
ldap
redis
ping
mail
influxdb, cassandra, couchbase, elasticsearch, mongo, neo4j, rabbit, solr
18
Q

How to create a group of health indicators?

A

management.endpoint.health.group.group-name.include=diskSpace,db
will returns: {status: “UP”, groups: [“group-name”]}
Note: endpoint without s

19
Q

Configuration to enable viewing details of a health indicator group?

A

management.endpoint.health.group.groupName.show-details=always
Note: endpoint without s

20
Q

Steps to build a custom health indicator?

A
  1. Extend AbstractHealthIndicator.doHealthCheck() or implement HealthIndicator.health()
  2. Mark class as a component
21
Q

Built-in health status values

A

DOWN
OUT_OF_SERVICE
UNKNOWN
UP

22
Q

How to override severity order?

A

management. endpoint.heath.status.order=FATAL, DOWN, OUT_OF_SERVICE, UNKNOWN, UP
(management. heath.status.order is deprecated)