-
Notifications
You must be signed in to change notification settings - Fork 8k
How it works
When an entry is created, a series of slots are created as well. These slots have different responsibilities, some for tracing; some for collecting and calculating run-time information, some for controlling flow;some for authorization, etc. Users can customize his own logic by adding slots based on following 3 fundamental slots.
ContextUtil.enter("entrance1", "appA", null, EntryType.IN);
Entry nodeA = SphU.entry("nodeA");
if (nodeA != null) {
nodeA.exit();
}
ContextUtil.exit();
Above code will generate following structure in memory:
machine-root
/
/
EntranceNode1
/
/
DefaultNode(nodeA)
Each DefaultNode is identified by both the resource id and enter name. In other words, one resource id, may have multiple default nodes distinguished by enter name declared in ContextUtil.enter(name)
ContextUtil.enter("entrance1", "appA", null, EntryType.IN);
Entry nodeA = SphU.entry("nodeA");
if (nodeA != null) {
nodeA.exit();
}
ContextUtil.exit();
ContextUtil.enter("entrance2", "appA", null, EntryType.IN);
nodeA = SphU.entry("nodeA");
if (nodeA != null) {
nodeA.exit();
}
ContextUtil.exit();
Above code will generate the following structure in memory:
machine-root
/ \
/ \
EntranceNode1 EntranceNode2
/ \
/ \
DefaultNode(nodeA) DefaultNode(nodeA)
The calling trace can be displayed by calling curl http://localhost:8719/tree?type=root
.
EntranceNode: machine-root(t:0 pq:1 bq:0 tq:1 rt:0 prq:1 1mp:0 1mb:0 1mt:0)
-EntranceNode1: Entrance1(t:0 pq:1 bq:0 tq:1 rt:0 prq:1 1mp:0 1mb:0 1mt:0)
--nodeA(t:0 pq:1 bq:0 tq:1 rt:0 prq:1 1mp:0 1mb:0 1mt:0)
-EntranceNode2: Entrance1(t:0 pq:1 bq:0 tq:1 rt:0 prq:1 1mp:0 1mb:0 1mt:0)
--nodeA(t:0 pq:1 bq:0 tq:1 rt:0 prq:1 1mp:0 1mb:0 1mt:0)
t:threadNum pq:passQps bq:blockedQps tq:totalQps rt:averageRt prq: passRequestQps 1mp:1m-passed 1mb:1m-blocked 1mt:1m-total
This slot maintains resource running statistics (response time, qps, thread, count, exception), and a list of origin callers statistics. The origin caller's name is marked by {@code Context.enter(entryname, origin)}.
The information can be displayed by calling url:
curl http://localhost:8719/origin?id=xxxx
id: nodeA
idx origin threadNum passedQps blockedQps totalQps aRt 1m-passed 1m-blocked 1m-total
1 caller1 0 0 0 0 0 0 0 0
2 caller2 0 0 0 0 0 0 0 0
- cluster node: total statistics of a cluster node of the resource id
- origin node: statistics of a cluster node from different callers
- default node: the entry of the node, marked by context entry name and resource id
- the total sum statistics of incoming entrances
-
文档
-
Documents
- Read Me
- Introduction
- How to Use
- How it Works
- Flow Control
- Parameter Flow Control
- Cluster Flow Control
- API Gateway Flow Control
- Circuit Breaking
- Adaptive System Protection
- Metrics
- General Configuration
- Dynamic Rule Configuration
- Dashboard
- Integrations with open-source frameworks
- Contribution Guideline