Skip to content

Commit 1d12410

Browse files
committed
Debug TAL rules through the DSL Debug API, and page the debug API's record read
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 and `if` results, sources, metrics and aliases written, end state); on the trace's owner, a match of a caller and a callee network-alias half is a record of its own. `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. 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. The runtime-rule `bundled` and `dump` routes refuse `tal` and `oal`, which no runtime-rule engine claims.
1 parent 3d54482 commit 1d12410

92 files changed

Lines changed: 6408 additions & 335 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@
103103
* 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.
104104
* 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.
105105
* 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.
106+
* 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` result), the sources, metrics and aliases it wrote, and its end state. On the OAP node that owns a trace, a session on the rule that composes a network alias also records each match of a caller and a callee half, and a callee half that expires unmatched; an OTLP run records whether its half 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.
107+
* 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.
108+
* **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.
106109

107110
#### UI
108111

‎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/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: 9 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,15 @@ A trimmed slice (one record = one scrape window):
148149
{
149150
"sessionId": "76b3266a-...",
150151
"capturedAt": 1777967923700,
152+
"nextCapturedSince": "1777967923699.871533",
151153
"ruleKey": { "catalog": "otel-rules", "name": "mal-with-filter",
152154
"ruleName": "e2e_demo_filtered_requests" },
153155
"nodes": [{
154156
"nodeId": "0.0.0.0_11800",
155157
"status": "ok",
156158
"records": [{
157159
"startedAtMs": 1777967921000,
160+
"captureTime": "1777967921004.067385",
158161
"dsl": "(e2e_demo_request_count_total.sum(['service_name'])).service(['service_name'], Layer.GENERAL)",
159162
"rule": {
160163
"metricPrefix": "e2e_demo",
@@ -213,8 +216,11 @@ curl -s -X POST 'http://OAP:17128/dsl-debugging/session/SESSION_ID/stop'
213216

214217
- **Install** broadcasts to every reachable peer; each peer binds its own
215218
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
219+
- **Collect** reads one page from every node: each other node streams the
220+
records it captured at or after the client's point, and the response holds
221+
every node's records before the point all of them are complete before; see
222+
[Reading the records page by page](dsl-debugging.md#reading-the-records-page-by-page).
223+
Unreachable peers appear as `status: "unreachable"` rather than being
218224
omitted.
219225
- **Stop** broadcasts; missed acks fall out via per-node retention timeout
220226
(default 5 minutes).
@@ -249,5 +255,6 @@ Override per-session (within the caps above) in the request body:
249255

250256
- [DSL Debug API — OAL](dsl-debugging-oal.md)
251257
- [DSL Debug API — LAL](dsl-debugging-lal.md)
258+
- [DSL Debug API — TAL](dsl-debugging-tal.md)
252259
- [Runtime Rule Hot-Update API](runtime-rule.md) — apply / inactivate / delete MAL rules.
253260
- [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)