Skip to content

Debug TAL rules through the DSL Debug API, page the debug API's record read, and debug the OTLP alias pairing - #14265

Merged
wu-sheng merged 1 commit into
masterfrom
feat/tal-dsl-debugging
Nov 25, 2026
Merged

wu-sheng merged 1 commit into
masterfrom
feat/tal-dsl-debugging

Conversation

@wu-sheng

@wu-sheng wu-sheng commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Debug TAL rules through the DSL Debug API, page the debug API's record read for every DSL, and debug the OTLP network-alias pairing

TAL rules are now debuggable as MAL, LAL and OAL rules are: a session on catalog=tal records what a rule did to the
object the analyzer passes through it.

  • One record per object through the rule. OTLP: one span. Native (sw-native): one segment, listing every span
    of it in wire order with its metadata, while the rule runs span by span; first {} shows on span 0, a queued
    build {} on the span that queued it. The segment's fields and the values the runner derives from it are the
    record's context.
  • File lines. A step's sourceLine is its line in the rule file, counted from the record's rule.dslFirstLine,
    the file line the rule's DSL starts at, so a client places every step on the file without matching texts; a node
    that cannot read the file sends no dslFirstLine, and its steps carry dslLine, the line within the DSL.
  • if operands. An if step lists each operand of its condition that is not a literal, with the value it
    evaluated to, short-circuit kept, and the condition's result.
  • The network-alias half. A run's pairing output is the half it asked for (the caller's service and the peer it
    dialed, or the callee's service and rule) and what became of it (sent, notSampled, rootSpan, ...); offeredBy
    says when the span sent an earlier rule's half instead. Whether halves match is not a rule's run, so the TAL debug
    records no match; the pairing has its own debugging, below.
  • Granularity. statement records every statement; block keeps the blocks, aborts and failures, and every
    output, the data a run pushes forward: sources, metrics, writeNetworkAlias, persist votes and pairing.
  • Abort is published with continueOn: false and the abort line, as LAL's is.
  • Read-only rule view. GET /runtime/tal/files lists the loaded rule files with their rules;
    GET /runtime/tal/files/{name} returns a file's content.
  • Cap. The unified debug cap of 100 records applies: 100 segments for native, 100 spans for OTLP.
  • Cost with no session. The probes are behind the session gate the context carries. On the native benchmark,
    injection on vs off with no session is within 2–4% (wide and concurrent cases within error), allocation unchanged.
    The v1-v2 checker passes with probes on and a no-op recorder bound on every native rule (1,938,922 probe calls,
    outputs identical).

Paging, for every DSL. A cluster read used to fetch every node's whole capture in one gRPC reply per node, every
second, and a node whose capture passed 4 MiB showed as unreachable. Now:

  • every record carries captureTime, when its node captured it, as <millis>.<six-digit nanos>: epoch
    milliseconds and the nanoseconds within them, compared milliseconds first, never adjusted;
  • GET /dsl-debugging/session/{id} takes capturedSince and pageSize (1–1000, default 1000) and returns
    nextCapturedSince: every record captured before it, on every node that answered, has been returned, and the next
    read passes it back to get the records captured at or after it, on whichever node it lands, since the point travels
    with the client. Records of one capture time are never split across pages;
  • each node's slice carries instanceId, made once per OAP process by the debugging module, so a client behind a load
    balancer tells the processes apart where node ids (0.0.0.0_11800 on every node by default) do not; a node that
    reached its recordCap no longer holds back the records of nodes whose clocks run ahead of it; complete says the
    capture is read through: every node holding the session answered and reached its cap, and the response holds the
    rest. A node that does not answer, beside one that did, bounds the point at the serving node's clock;
  • the other nodes stream their part over CollectDebugRecords, one captured record a message, then one
    CollectDebugRecordsSummary (status, capture size, the point the page holds every record before, the process's
    instanceId) that ends the stream, so only a single record has to fit a message. It replaces CollectDebugSamples,
    which returned a node's whole capture in one reply. Breaking: during a rolling upgrade a node reads no records
    from a node of the other version (it shows as unreachable); the changelog lists it as a breaking change. The admin
    bus is not on any data path, so this is acceptable;
  • the admin channels between nodes now take admin-server.gRPCMaxMessageSize (50 MB by default), as the admin gRPC
    server always did, instead of gRPC's 4 MiB default; a record larger than it comes as its size, oversizedBytes,
    without its content;
  • whatever pageSize asks for, a response holds at most 100 MiB, shared evenly by the nodes, so the page size is what
    a read meets;
  • a read without the parameters starts from the first record, so today's clients read as before. An OAP before this
    change ignores the parameters and returns the whole capture without nextCapturedSince (verified on a
    pre-change image).

Pairing debugging, a new admin module. trace-pairing-debugging (SW_TRACE_PAIRING_DEBUGGING, on by default,
requires trace-analyzer) shows what the OAP node that owns a trace does with the halves it receives: which match,
and the alias each match pushes.

  • No sessions: one capture per node, shared by every reader. POST /trace-pairing-debugging/start turns it on on
    every node; it runs while it is read (GET /trace-pairing-debugging/pairings is a ping) and stops a minute after the
    latest read, or on POST /trace-pairing-debugging/stop; a stop, or that expiry, releases what it found, as a DSL
    session's records go when it stops, so OAP keeps nothing between captures and a client keeps what it read. Each
    capture from a start to its stop is a round with a roundId: a start gives every node the round of the node that
    took it, and a read sums only the nodes in its round, naming the others. Each entry names the OAP nodes that hold
    it, by admin address.
    GET /trace-pairing-debugging/status probes without a ping.
  • Three lists per node, each keeping its 1000 most recently seen entries: the peers matched to a server (with the
    server before it when a later match moved it, the latest callers, the alias address, the count 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. A read merges the
    nodes' lists.
  • Any node takes the REST call and calls its peers over the module's own gRPC service on the admin bus, every peer at
    once, each call with the bus timeout, collected within one budget, so a slow node delays no other.
  • With no capture on, the pairing pays one volatile read per half.

Docs: dsl-debugging-tal.md and trace-pairing-debugging.md (new), the shared dsl-debugging.md (paging, the TAL
listing, the record cap, which was documented as 32 and 1000/10000), the admin API index, the security page, the
configuration vocabulary, the TAL, native trace and trace analyzer pages.

Also: the runtime-rule bundled and dump routes refuse tal and oal, which have no runtime-rule engine; the
TAL holder registry treats two rules of one name in one file as not debuggable instead of picking one.

  • If this is non-trivial feature, paste the links/URLs to the design doc.

  • Update the documentation to include this new feature.

  • Tests(including UT, IT, E2E) are added to verify the new feature.

    • Unit tests for the probes and if operands, the recorder, the listing, paging on a node and across nodes
      (capped nodes, a node that does not answer, complete), the pairing gate on SpanPairing, the pairing capture
      (its rounds, a read of the round most nodes hold, each entry's nodes, the release on a stop and on expiry, a
      restart beginning empty) and its merge over nodes, and the fan-out with nine stalled peers and one prompt one.
    • E2E DSL Debug API — TAL native: an emitter reports a typical segment (Entry, Local, Exits to a database and a
      cache); statement and block sessions on native-segment, native-virtual-database and native-virtual-cache;
      a record names the file line its rule's DSL starts at.
    • E2E DSL Debug API — TAL OTLP: two services' spans; the caller and callee halves a run sent, block records, the
      pairing capture matching the peer to its server, dialed by its caller, read as one round and released by a stop,
      and the capture read five records a page while it captures.
    • The MAL, LAL (statement and block) and OAL debug e2e cases pass unchanged on the paged read.
    • E2E DSL Debug API — paging across nodes: two OAPs in a ZooKeeper cluster, spans to one node only; a session read
      through the other node gets the first node's records over the stream, the two slices name distinct processes, and
      a read paged five records at a time, switching nodes on every page, covers the capture with no record twice or
      missing.
    • storage/mysql's config dump gains the new module.
  • If it's UI related, attach the screenshots below. The Horizon Live Debugger's TAL tab, the TAL rule view and the
    OTLP pairing page follow in a Horizon PR once this one is merged.

  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #.

  • Update the CHANGES log.

  • GraalVM distro impact:

    • None.
    • Impacted, by: a DSL engine (TAL), a module, a native-image concern (Armeria handlers), and the admin catalog
      parity.
      • TAL engine: with injection on, as the distro's precompiler compiles, every generated TAL class carries a
        debug GateHolder field, debugHolder() and segmentDefNames(), and calls the static TALDebug probes,
        TALDebug.operand among them for an if condition's operands. SpanFilterListener publishes each loaded rule's
        holder through TalStaticBindingHook. TALClassGenerator and SpanFilterListener, which the distro pins,
        change. The distro's TAL replacements (TalDSL, TALConfigs) are unchanged in contract; TALConfigs only
        changes a comment.
      • New module trace-pairing-debugging: an admin module, of a kind the distro ships, so it needs accepting and
        wiring (AcceptedModules, provider-inventory.properties, oap-graalvm-server/pom.xml, an application.yml
        section), or SW_TRACE_PAIRING_DEBUGGING=- in the distro's application.yml until then. It has no config
        field, runs no generated code, and answers with Gson JsonObjects it builds (no bound POJO); its admin-bus gRPC
        service is built as dsl-debugging's is. It hooks a PairingDebugGate onto SpanPairing, which the distro uses
        as-is.
      • dsl-debugging, used as-is: it now depends on trace-analyzer and reads the raw TAL files from
        StaticRuleRegistry (catalog tal). The new Armeria handlers RuntimeTalRestHandler and
        TracePairingDebuggingRestHandler need the reflection metadata the precompiler's handler scan generates.
      • Rendering: ApdexArgument, PercentileArgument, BucketedValues, DataTable, NetworkAliasMatch and
        GenAIModelMatch implement ToJson, and GenAIPricingConfig.Model gains @ToString.
      • Admin parity: upstream's bundled/dump refuse tal and oal with 400 invalid_catalog, so the distro's
        BundledRuleCatalogHandler and its parity test need the same refusal at the next sync.

@wu-sheng
wu-sheng requested a balanced review from Copilot November 24, 2026 09:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@wu-sheng wu-sheng added this to the 11.2.0 milestone Nov 24, 2026
@wu-sheng wu-sheng added core feature Core and important feature. Sometimes, break backwards compatibility. enhancement Enhancement on performance or codes labels Nov 24, 2026
@wu-sheng
wu-sheng force-pushed the feat/tal-dsl-debugging branch from 1d12410 to 80c8d7c Compare November 25, 2026 01:04
@wu-sheng wu-sheng changed the title Debug TAL rules through the DSL Debug API, and page the debug API's record read Debug TAL rules through the DSL Debug API, page the debug API's record read, and debug the OTLP alias pairing Nov 25, 2026
@wu-sheng
wu-sheng requested a review from wankai123 November 25, 2026 01:34
@wu-sheng
wu-sheng force-pushed the feat/tal-dsl-debugging branch 2 times, most recently from e6c63f4 to 3d15492 Compare November 25, 2026 05:39
wankai123
wankai123 previously approved these changes Nov 25, 2026
…d 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.
@wu-sheng
wu-sheng merged commit bd8f276 into master Nov 25, 2026
547 of 549 checks passed
@wu-sheng
wu-sheng deleted the feat/tal-dsl-debugging branch November 25, 2026 08:35
wu-sheng added a commit to apache/skywalking-horizon-ui that referenced this pull request Nov 26, 2026
… pairing on a page of its own (#228)

For SkyWalking 11.2 (apache/skywalking#14265):

- The Live Debugger gains a TAL tab, laid out as an IDE's debugger: the
  captured frames, the rule file with each executed line's value, and the
  frame's variables. A read-only TAL rules page lists the loaded rules with a
  debug link beside each.
- A new OTLP pairing page starts and stops OAP's shared pairing capture and
  lists what each round found in one paged list, by kind, with each round
  saved in History.
- Every debugger tab reads only the records captured since its last read.
- Pages that need 11.2 say so against an older OAP.

Fixes to existing Live Debugger bugs: a cluster whose nodes share a node id
read as one node; a capture stopped reading after its browser tab was hidden;
a start or back to live over a saved capture kept showing it, or kept its
address; a capture link was taken by every open tab; folds, selections and
filters carried over to the next capture; a running capture was not saved
while a saved one was on screen; MAL and LAL saved a capture under the rule
picked next; a capture grown past the browser's storage emptied Capture
history; against an OAP before 11.2, Resume of a stopped capture showed
nothing, and a node that missed a read erased its records. Leaving the Live
Debugger, or reloading it, while a capture runs now asks first. The
trace Tree no longer scales a short trace up to fill its canvas, and its zoom
controls follow the theme.

The core e2e case gains a TAL debugger and an OTLP pairing spec against OAP
bd8f2764db.
wu-sheng added a commit to apache/skywalking-graalvm-distro that referenced this pull request Nov 26, 2026
…-debugging module (#53)

* Sync upstream to cb632100a5: TAL live debugging and the trace-pairing-debugging module

The skywalking submodule moves 8 commits past 4bb9a61839 to cb632100a5.

- TAL rules are live-debuggable (apache/skywalking#14265). Upstream's TAL compiler emits the debug probes when the
  codegen switch is on, which the precompiler turns on before every pass, so every pre-compiled TAL class carries
  its debug holder and probes; dsl-debugging runs TAL sessions and the /runtime/tal/* listing as it is.
- Accept and wire the new trace-pairing-debugging admin module (poms, AcceptedModules, provider inventory,
  application.yml, regenerated config loader).
- /runtime/rule/bundled refuses oal and tal with 400 invalid_catalog, as upstream now does for a catalog no
  runtime-rule engine claims; the parity test takes the served catalogs from upstream's MAL and LAL engines.
- BanyanDBStorageConfig.Global loses compatibleServerApiVersions (apache/skywalking#14267); regenerate the loader.
- otel-rules/oap.yaml and redis-instance.yaml change upstream (apache/skywalking#14264, #14258); OapTest feeds the
  new OTLP protocols and drop reasons, and the rule and source pins are refreshed.
- Adopt upstream's dsl-debugging/tal-native and tal-otlp e2e cases; the dsl-debugging status fixture gains
  upstream's catalogs list; the e2e runner follows upstream's pin 8bb8499.
- Docs and changelog describe TAL debugging and the new module.

* Run upstream's cluster-paging e2e on two native replicas in a kind cluster

Upstream runs dsl-debugging/cluster-paging on two ZooKeeper-coordinated containers. The distro runs it as
dsl-debugging-cluster-paging on two native replicas on the Kubernetes coordinator, as otlp-traces-cluster does:
upstream's span emitter sends to the first pod, and upstream's flow script reads through the second, with its two
node names (oap1 / oap2) replaced by the pods' IPs, as the Kubernetes coordinator names the nodes; the wrapper fails
when upstream renames them. It is the distro's only e2e of the admin-internal gRPC bus between nodes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core feature Core and important feature. Sometimes, break backwards compatibility. enhancement Enhancement on performance or codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants