Backend Development 25 min read

Master Sentinel Console: Real‑Time Monitoring, Flow Control & Rule Configuration Guide

This tutorial walks you through Sentinel's lightweight console, showing how to view machine health, monitor real‑time metrics, configure flow, degrade, hotspot, and system rules, handle exceptions with custom handlers, enable authentication, and push rules in a Spring Boot microservice environment.

Ops Development Stories
Ops Development Stories
Ops Development Stories
Master Sentinel Console: Real‑Time Monitoring, Flow Control & Rule Configuration Guide

Console Overview

Sentinel provides a lightweight open‑source console for machine discovery, health monitoring, real‑time metrics, rule management and push, as well as authentication.

Environment

jdk 1.8
sentinel 1.8.0
spring-boot 2.3.5.RELEASE
spring-cloud Hoxton.SR8
spring-cloud-alibaba 2.2.5.RELEASE

Machine List & Health

After successful integration, the

Machine List

menu displays each service node's health status.

Sentinel machine list health view
Sentinel machine list health view
If Sentinel integration fails, refer to the official documentation or FAQ for troubleshooting.

Service Monitoring

1. Real‑time Monitoring

Metrics from all machines under the same service are aggregated and displayed under "Real‑time Monitoring" with a 5‑minute data retention window.

Sentinel real‑time monitoring stores 5 minutes
Sentinel real‑time monitoring stores 5 minutes
Ensure the console machine time matches the application machine time, otherwise real‑time data cannot be fetched.

2. Cluster Call Chain

The cluster call chain page shows resource call relationships in two modes: a tree structure or a flat view of real‑time resource status.

Sentinel cluster call chain
Sentinel cluster call chain
Again, synchronize the console and application machine times.

3. Flow Control Rules

Flow control monitors QPS or concurrent threads and blocks traffic when thresholds are exceeded, protecting application availability.

Key slots involved:

FlowSlot

,

NodeSelectorSlot

,

ClusterBuilderSlot

,

StatisticSlot

.

When a rule is triggered,

Entry nodeA = SphU.entry(resourceName)

throws a

FlowException

, which is a subclass of

BlockException

. Custom handlers can catch

BlockException

to define fallback logic.

<code>@Component
public class SentinelBlockHandler implements BlockExceptionHandler {
    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, BlockException e) throws Exception {
        CommonResult<Void> result = new CommonResult<>();
        if (e instanceof FlowException) {
            result = CommonResult.error(101, "接口限流了");
        } else if (e instanceof DegradeException) {
            result = CommonResult.error(102, "服务降级了");
        } else if (e instanceof ParamFlowException) {
            result = CommonResult.error(103, "热点参数限流了");
        } else if (e instanceof SystemBlockException) {
            result = CommonResult.error(104, "系统规则(负载/...不满足要求)");
        } else if (e instanceof AuthorityException) {
            result = CommonResult.error(105, "授权规则不通过");
        }
        response.setStatus(500);
        response.setCharacterEncoding("utf-8");
        response.setHeader("Content-Type", "application/json;charset=utf-8");
        response.setContentType("application/json;charset=utf-8");
        new ObjectMapper().writeValue(response.getWriter(), result);
    }
}
</code>

Example curl results:

{"code":1,"message":"this is a success message","data":{"id":1,"code":"STOCK==>1000"}}
{"code":101,"message":"接口限流了","data":null}

Threshold Types

Thread Count : Limits concurrent threads to protect thread pools. Configuration is usually done on the caller side.

Sentinel flow rule thread count
Sentinel flow rule thread count

Flow Control Modes

Direct : Immediate rejection when QPS exceeds the threshold (default behavior).

Warm‑up : Gradually ramps up traffic to avoid sudden spikes on cold systems.

Sentinel warm‑up curve
Sentinel warm‑up curve

Rate Limiter : Enforces a uniform request interval using a leaky‑bucket algorithm (not supported for QPS > 1000).

Sentinel rate‑limiter monitoring
Sentinel rate‑limiter monitoring

4. Degrade Rules

Degrade (circuit‑breaker) protects services from unstable downstream calls. Strategies include slow‑call ratio, error ratio, and error count.

Example configuration screenshot omitted for brevity.

5. Hotspot Rules

Hotspot (parameter) flow control limits frequently accessed parameter values (e.g., hot product IDs). Resources must be annotated with

@SentinelResource

and parameters must be primitive types.

Sentinel hotspot rule principle
Sentinel hotspot rule principle

6. Authorization Rules

Origin‑based black‑/white‑list control restricts access based on the request's

origin

. Implement

RequestOriginParser

to extract the origin, then configure rules in the console.

Sentinel authorization rule configuration
Sentinel authorization rule configuration

7. System Rules

System protection monitors load, CPU usage, average RT, concurrent threads, and inbound QPS at the application entry level. Only entry traffic (

EntryType.IN

) is affected.

Supported modes: Load adaptive, CPU usage, average RT, concurrent threads, entry QPS.

Sentinel system rule principle
Sentinel system rule principle

8. Cluster Flow Control

Cluster flow control centralizes token distribution to enforce global QPS limits across multiple instances, solving uneven traffic distribution.

Roles: Token Client (requests tokens) and Token Server (issues tokens).

Rule Push

The console supports three push modes: raw, Pull, and Push. Rules are stored in memory by default; for production, use dynamic rule sources (e.g., Nacos, Apollo) and the push mode.

Sentinel add flow rule
Sentinel add flow rule

Authentication

Since Sentinel 1.5.0, a generic

AuthService

interface allows custom authentication. From 1.6.0, a basic login (default user/password:

sentinel

) is provided, configurable via JVM arguments or Spring properties.

Sentinel console login
Sentinel console login

Reference

Official documentation: https://github.com/alibaba/Sentinel/wiki/控制台

JavaMonitoringmicroservicesSpring BootSentinelflow control
Ops Development Stories
Written by

Ops Development Stories

Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.