Skip to content

Commit 3d15492

Browse files
committed
Debug TAL rules through the DSL Debug API, page the debug API's record read, and debug the OTLP alias pairing
TAL rules are now debuggable as MAL, LAL and OAL rules are (`catalog=tal`). A record follows the object the analyzer passes through the rule: one OTLP span, or one native segment listing every span with the rule's run on each (statements, each `if` with the value of every operand it evaluated and its result, sources, metrics and aliases written, the network-alias half asked for and whether it was sent, end state). `GET /runtime/tal/files` lists the loaded TAL rules and `GET /runtime/tal/files/{name}` returns a file's content. The probes are compiled in when injection is on, and read one plain flag per generated method when no session records the rule. The debug read is paged for every DSL. Each record carries `captureTime` (`<millis>.<six-digit nanos>`), and `GET /dsl-debugging/session/{id}` takes `capturedSince` and `pageSize` and returns `nextCapturedSince`, so a client reads only what was captured since, from whichever node serves it. Each node's slice carries the process's `instanceId`, a node at its `recordCap` no longer holds back the others, and `complete` says the capture is read through. The other nodes stream their records one a message over the new `CollectDebugRecords` call, which replaces `CollectDebugSamples` (a breaking change between nodes of different versions), and the admin channels between nodes take `admin-server.gRPCMaxMessageSize` instead of gRPC's 4 MiB. A new admin module, `trace-pairing-debugging`, captures on demand what the OAP node that owns a trace does with the network-alias halves it receives: one capture per node, no sessions, each run a round under its own id, running while it is read and released when it stops or idles out. It lists the peers matched to a server, and the peers and servers whose halves left unmatched, with their latest trace ids, each entry naming the OAP nodes that hold it. The runtime-rule `bundled` and `dump` routes refuse `tal` and `oal`, which no runtime-rule engine claims.
1 parent cef9045 commit 3d15492

120 files changed

Lines changed: 9282 additions & 378 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/skywalking.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ jobs:
482482
config: test/e2e-v2/cases/dsl-debugging/lal-block/e2e.yaml
483483
- name: DSL Debug API — LAL statement
484484
config: test/e2e-v2/cases/dsl-debugging/lal-statement/e2e.yaml
485+
- name: DSL Debug API — TAL native
486+
config: test/e2e-v2/cases/dsl-debugging/tal-native/e2e.yaml
487+
- name: DSL Debug API — TAL OTLP
488+
config: test/e2e-v2/cases/dsl-debugging/tal-otlp/e2e.yaml
489+
- name: DSL Debug API — paging across nodes
490+
config: test/e2e-v2/cases/dsl-debugging/cluster-paging/e2e.yaml
485491

486492
- name: Alarm ES 8.18.8
487493
config: test/e2e-v2/cases/alarm/es/e2e.yaml

‎docs/en/changes/changes.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@
104104
* The Zipkin receiver counts the spans it does not store in `spans_dropped_count` with a `reason` label beside `protocol`, shared with the OTLP receiver: `sampled` (`sampleRate`), `rate_limited` (`maxSpansPerSecond`) and `process_failed`. It counted only `zipkin-http`, with no reason, and now also counts `zipkin-kafka`; a Prometheus query on the raw metric that does not sum over `reason` sees one series per reason. The new MAL rule `meter_oap_instance_spans_dropped_by_reason` breaks `meter_oap_instance_spans_dropped_count` down by reason. One Zipkin span that fails to be processed is now dropped, logged and counted as `process_failed` alone, where it stopped the rest of its HTTP request or Kafka message from being processed: the HTTP request then failed and counted in `trace_analysis_error_count`, so a client retrying it stored the spans before it twice, and the Kafka message was lost without a log. `SpanForwardService.send` takes the protocol's `TraceSpansDropped` and returns nothing. A Zipkin Kafka message that fails to be decoded or processed is now logged and counted in `trace_analysis_error_count{protocol="zipkin-kafka"}`; it ran on an executor whose result nothing read, so it was lost without a log or a count.
105105
* The SkyWalking agent Kafka fetcher logs and counts in `trace_analysis_error_count{protocol="kafka"}` a segment whose analysis fails, where it counted only a message that does not decode and lost the others without a log. Every trace receiver registers `trace_analysis_error_count` with one help text, which says what it counts: received trace data that could not be decoded or processed as a whole, an agent segment, a Zipkin HTTP request or Kafka message, or an OTLP export request; a span dropped on its own is counted in `spans_dropped_count` instead.
106106
* The Kafka trace exporter's `kafka_exporter_trace_success_count` and `kafka_exporter_trace_error_count` count spans, where they counted segments, so the exported spans compare with `trace_in_latency_count`, which counts spans.
107+
* Debug TAL rules through the DSL Debug API (`catalog=tal`), as MAL, LAL and OAL rules are. A record follows the object the analyzer passes through the rule: one OTLP span, or one native segment with all its spans; each span carries the rule's run on it, the statements it executed (and each `if` with the value of every operand it evaluated and its result), the sources, metrics and aliases it wrote, and its end state. An OTLP run records the network-alias half it asked for and whether it was sent. `GET /runtime/tal/files` lists the TAL rules a node loaded and `GET /runtime/tal/files/{name}` returns a file's content, and `/dsl-debugging/status` lists the catalogs a session can be installed on. The runtime-rule `GET /runtime/rule/bundled` and `GET /runtime/rule/dump/{catalog}` routes now refuse a catalog no runtime-rule engine claims, `tal` and `oal`, with `400 invalid_catalog`, as its other routes do; `oal` returned an empty result before. The probes are compiled into a rule when `SW_DSL_DEBUGGING_INJECTION_ENABLED` is on, the default.
108+
* Page the DSL Debug API's record read: every record carries `captureTime`, when its node captured it, as `<millis>.<six-digit nanos>`; `GET /dsl-debugging/session/{id}` takes `capturedSince` and `pageSize` and returns `nextCapturedSince`, the point the next read passes back to get only the records captured since, from whichever OAP node serves it. The other nodes stream their records one a message over the new `CollectDebugRecords` call, and the admin channels between nodes take `admin-server.gRPCMaxMessageSize`, as the admin gRPC server does, instead of gRPC's 4 MiB, so a node whose capture outgrew 4 MiB no longer shows as unreachable. A read without the parameters starts from the first record. Each node's slice carries `instanceId`, which tells the OAP processes apart where node ids do not, and `complete` says the capture is read through; a node that reached its `recordCap` no longer holds back the records of nodes whose clocks run ahead of it.
109+
* **Breaking Change** — DSL Debug API across OAP nodes: `CollectDebugRecords` replaces `CollectDebugSamples` on the admin gRPC bus (`admin-server.gRPCPort`), which returned a node's whole capture in one reply. During a rolling upgrade, a node reads no records from a node of the other version and shows it as `unreachable` in a debug session's `nodes[]`; a session reads the whole cluster again once every node runs the same version.
110+
* Debug the network-alias pairing of OTLP calls through a new admin module, `trace-pairing-debugging` (`SW_TRACE_PAIRING_DEBUGGING`, on by default, requires `trace-analyzer`). `POST /trace-pairing-debugging/start` turns on one capture per OAP node, shared by every reader, as each node owns a share of the traces; it runs while it is read, and stops a minute after the latest read or on `POST /trace-pairing-debugging/stop`, releasing what it found; each capture from a start to its stop is a round with its own `roundId`, which every node in it shares, and each listed entry names the OAP nodes that hold it. `GET /trace-pairing-debugging/pairings` lists, over the nodes, the peers matched to a server, with the server before it when a later match moved it, the callers, the count of calls and each match's outcome (`registered`, `gateway`, `uncomposed`, `tooLong`, `noService`); and the peers and the servers whose halves left without their pair (`expired`, `evicted`, `replaced`), each with its latest five trace ids.
107111

108112
#### UI
109113

‎docs/en/concepts-and-designs/tal.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,11 @@ fits. A function name that two classes serve for one input fails the boot, among
495495
helpers and the modules' providers, and so does one that takes an entity constructor's name, such as `service`. A
496496
function object is stateless across runs and safe to call from every receiver thread.
497497

498+
## Debugging a rule
499+
500+
A rule's run on live traffic can be captured statement by statement through the
501+
[DSL Debug API](../setup/backend/admin-api/dsl-debugging-tal.md).
502+
498503
## Differences from LAL
499504

500505
- No parser blocks. `text {}`, `json {}` and `yaml {}` give a log body structure; a span is already structured.

‎docs/en/security/README.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ the operator team. The feature modules mounted on it serve these routes:
8484
| `/inspect/*` | `inspect` | Browse the metric catalog, the entities holding values, and the metric values. |
8585
| `/ui-management/*` | `ui-management` | Read, add, update, and disable UI dashboard templates. |
8686
| `/runtime/rule`, `/runtime/rule/*`, `/runtime/mal/*`, `/runtime/lal/*` | `receiver-runtime-rule` | List, dump, add, override, inactivate, and delete MAL/LAL rule files, which are compiled and loaded into the OAP JVM on the fly. |
87-
| `/dsl-debugging/*` | `dsl-debugging` | Start, read, and stop sampling sessions that capture live MAL/LAL/OAL rule executions, including the payloads each sampled rule processed. |
88-
| `/runtime/oal/*` | `dsl-debugging` | List the loaded OAL files and read their rules. |
87+
| `/dsl-debugging/*` | `dsl-debugging` | Start, read, and stop sampling sessions that capture live MAL/LAL/OAL/TAL rule executions, including the payloads each sampled rule processed. |
88+
| `/runtime/oal/*`, `/runtime/tal/*` | `dsl-debugging` | List the loaded OAL and TAL files and read their rules. |
89+
| `/trace-pairing-debugging/*` | `trace-pairing-debugging` | Start, read, and stop the capture of how OTLP calls are paired into network aliases, including the services and peers of the calls and the trace ids of those left unmatched. |
8990

9091
Of these routes, only `/status/config/ttl` is also served next to the GraphQL API on the query
9192
port (see [Query and Receiver Ports](#query-and-receiver-ports)), and it returns the TTL settings only. The admin port also
@@ -106,7 +107,7 @@ variable to `-` if it is not needed.
106107

107108
`admin-server` also opens an **admin-internal gRPC bus** (default `17129`) for peer-to-peer
108109
cluster RPCs between OAP nodes — runtime-rule `Suspend / Resume / Forward`, DSL debug
109-
`install / collect / stop`. This is intentionally a **separate transport** from the public
110+
`install / collect / stop`, trace pairing debug `start / stop / collect`. This is intentionally a **separate transport** from the public
110111
agent / cluster gRPC port (`core.gRPCPort`, default `11800`). An attacker who reaches `11800`
111112
to submit telemetry MUST NOT be able to invoke privileged admin RPCs.
112113

@@ -119,7 +120,7 @@ To remove a feature, set its module variable to `-`, such as `SW_STATUS=-` for t
119120
debugging routes (including `/status/config/ttl` on the query port). An empty value does not
120121
remove a module: OAP fails to start with a `ProviderNotFoundException`. To close the admin
121122
port entirely, set `SW_ADMIN_SERVER=-` together with `SW_STATUS=-`, `SW_INSPECT=-`,
122-
`SW_UI_MANAGEMENT=-`, `SW_RECEIVER_RUNTIME_RULE=-`, and `SW_DSL_DEBUGGING=-`, as a feature
123+
`SW_UI_MANAGEMENT=-`, `SW_RECEIVER_RUNTIME_RULE=-`, `SW_DSL_DEBUGGING=-`, and `SW_TRACE_PAIRING_DEBUGGING=-`, as a feature
123124
module left on without `admin-server` stops OAP from starting. Horizon UI reads `/status/*`
124125
and the configuration dump, so keep `status` when Horizon UI is deployed, and restrict the
125126
port instead.

‎docs/en/setup/backend/admin-api/dsl-debugging-lal.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ appends one **sample**. The wire shape is:
1515
nodes[]
1616
records[]
1717
startedAtMs — record boundary timestamp (ms)
18+
captureTime — when the node captured it, `<millis>.<six-digit nanos>`, which pages the read
1819
dsl — verbatim per-rule DSL text
1920
rule — { ruleName, sourceLine }
2021
samples[]
@@ -120,7 +121,7 @@ Examples:
120121

121122
## Granularity
122123

123-
LAL is the only DSL with **per-statement** capture. Operators choose the mode
124+
LAL, like TAL, has **per-statement** capture. Operators choose the mode
124125
at install time:
125126

126127
| `granularity` | Behaviour |
@@ -168,6 +169,7 @@ A trimmed slice (one record = one log):
168169
"nodes": [{
169170
"records": [{
170171
"startedAtMs": 1778114804604,
172+
"captureTime": "1778114804605.418226",
171173
"dsl": "filter {\n sink {\n }\n}\n",
172174
"rule": { "ruleName": "default", "sourceLine": "3" },
173175
"samples": [
@@ -279,7 +281,10 @@ curl -s -X POST 'http://OAP:17128/dsl-debugging/session/SESSION_ID/stop'
279281

280282
- **Install** broadcasts to every reachable peer; each peer binds its own
281283
recorder on its own holder.
282-
- **Collect** broadcasts and concatenates per-node slices.
284+
- **Collect** reads one page from every node: each other node streams the
285+
records it captured at or after the client's point, and the response holds
286+
every node's records before the point all of them are complete before; see
287+
[Reading the records page by page](dsl-debugging.md#reading-the-records-page-by-page).
283288
- **Stop** broadcasts; missed acks fall out via retention timeout.
284289

285290
No cross-node merge — each peer's slice is self-contained.
@@ -299,7 +304,7 @@ No cross-node merge — each peer's slice is self-contained.
299304
|-------------------|---------------|-----------------|--------------------------------------------------|
300305
| `recordCap` | `100` | `100` | Max records before the recorder refuses appends. |
301306
| `retentionMillis` | `300000` (5m) | `3600000` (1h) | Wall-clock retention. |
302-
| `granularity` | `block` | n/a | `block` or `statement` (LAL only). |
307+
| `granularity` | `block` | n/a | `block` or `statement` (LAL and TAL). |
303308

304309
Out-of-range values return `400 invalid_limits`. Override per-session (within
305310
the caps above) in the install body:
@@ -312,5 +317,6 @@ the caps above) in the install body:
312317

313318
- [DSL Debug API — MAL](dsl-debugging-mal.md)
314319
- [DSL Debug API — OAL](dsl-debugging-oal.md)
320+
- [DSL Debug API — TAL](dsl-debugging-tal.md)
315321
- [Runtime Rule Hot-Update API](runtime-rule.md) — apply / inactivate / delete LAL rules.
316322
- [SWIP-13](../../../swip/SWIP-13.md) — full design.

‎docs/en/setup/backend/admin-api/dsl-debugging-mal.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ within a record, each probe stage the expression executes appends one
1515
nodes[]
1616
records[]
1717
startedAtMs — record boundary timestamp (ms)
18+
captureTime — when the node captured it, `<millis>.<six-digit nanos>`, which pages the read
1819
dsl — verbatim per-rule DSL text
1920
rule — rule envelope:
2021
metricPrefix
@@ -148,13 +149,17 @@ A trimmed slice (one record = one scrape window):
148149
{
149150
"sessionId": "76b3266a-...",
150151
"capturedAt": 1777967923700,
152+
"nextCapturedSince": "1777967923699.871533",
153+
"complete": false,
151154
"ruleKey": { "catalog": "otel-rules", "name": "mal-with-filter",
152155
"ruleName": "e2e_demo_filtered_requests" },
153156
"nodes": [{
154157
"nodeId": "0.0.0.0_11800",
158+
"instanceId": "0f6c2a4e-...",
155159
"status": "ok",
156160
"records": [{
157161
"startedAtMs": 1777967921000,
162+
"captureTime": "1777967921004.067385",
158163
"dsl": "(e2e_demo_request_count_total.sum(['service_name'])).service(['service_name'], Layer.GENERAL)",
159164
"rule": {
160165
"metricPrefix": "e2e_demo",
@@ -213,8 +218,11 @@ curl -s -X POST 'http://OAP:17128/dsl-debugging/session/SESSION_ID/stop'
213218

214219
- **Install** broadcasts to every reachable peer; each peer binds its own
215220
recorder on its own holder so the slice reflects local L1 parsing.
216-
- **Collect** broadcasts and concatenates per-node slices into `nodes[]`;
217-
unreachable peers appear as `status: "unreachable"` rather than being
221+
- **Collect** reads one page from every node: each other node streams the
222+
records it captured at or after the client's point, and the response holds
223+
every node's records before the point all of them are complete before; see
224+
[Reading the records page by page](dsl-debugging.md#reading-the-records-page-by-page).
225+
Unreachable peers appear as `status: "unreachable"` rather than being
218226
omitted.
219227
- **Stop** broadcasts; missed acks fall out via per-node retention timeout
220228
(default 5 minutes).
@@ -249,5 +257,6 @@ Override per-session (within the caps above) in the request body:
249257

250258
- [DSL Debug API — OAL](dsl-debugging-oal.md)
251259
- [DSL Debug API — LAL](dsl-debugging-lal.md)
260+
- [DSL Debug API — TAL](dsl-debugging-tal.md)
252261
- [Runtime Rule Hot-Update API](runtime-rule.md) — apply / inactivate / delete MAL rules.
253262
- [SWIP-13](../../../swip/SWIP-13.md) — full design.

‎docs/en/setup/backend/admin-api/dsl-debugging-oal.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ appends one **sample**:
2020
nodes[]
2121
records[]
2222
startedAtMs — record boundary timestamp (ms)
23+
captureTime — when the node captured it, `<millis>.<six-digit nanos>`, which pages the read
2324
dsl — verbatim per-metric `.oal` line
2425
rule — { ruleName, sourceLine }
2526
samples[]
@@ -149,6 +150,7 @@ A trimmed slice (one record = one source event):
149150
"status": "ok",
150151
"records": [{
151152
"startedAtMs": 1778115085149,
153+
"captureTime": "1778115085150.213904",
152154
"dsl": "service_relation_server_cpm = from(ServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).cpm();",
153155
"rule": { "ruleName": "service_relation_server_cpm", "sourceLine": "30" },
154156
"samples": [
@@ -201,7 +203,10 @@ curl -s -X POST 'http://OAP:17128/dsl-debugging/session/SESSION_ID/stop'
201203

202204
- **Install** broadcasts to every reachable peer; each peer attaches its own
203205
recorder to its dispatcher.
204-
- **Collect** broadcasts and concatenates per-node slices.
206+
- **Collect** reads one page from every node: each other node streams the
207+
records it captured at or after the client's point, and the response holds
208+
every node's records before the point all of them are complete before; see
209+
[Reading the records page by page](dsl-debugging.md#reading-the-records-page-by-page).
205210
- **Stop** broadcasts; missed acks fall out via retention timeout.
206211

207212
No cross-node merge — each peer's slice is self-contained.
@@ -233,4 +238,5 @@ the caps above) in the install body:
233238

234239
- [DSL Debug API — MAL](dsl-debugging-mal.md)
235240
- [DSL Debug API — LAL](dsl-debugging-lal.md)
241+
- [DSL Debug API — TAL](dsl-debugging-tal.md)
236242
- [SWIP-13](../../../swip/SWIP-13.md) — full design.

0 commit comments

Comments
 (0)