Skip to content

observability: let the liquidity boards read liq_ from the exporter or the bot [RAI-3095] - #1687

Open
JuaniRios wants to merge 1 commit into
rai-2998-liq-metrics-ordersfrom
rai-2998-board-native
Open

JuaniRios wants to merge 1 commit into
rai-2998-liq-metrics-ordersfrom
rai-2998-board-native

Conversation

@JuaniRios

@JuaniRios JuaniRios commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Part of RAI-3095.

Adds a Source variable to the five liquidity boards, so they can read liq_* from the exporter sidecar or from the bot's own /metrics. Item 6a of the RAI-2998 stack, part 1 of 6.

Live effect: the board gets a Source dropdown. It opens on exporter, so it shows what it shows today · Risk: low (read-only queries, a revert undoes it) · Ships: on merge, through the observability workflow

Why

The bot now serves the same liq_* names as the exporter. Stage 3 compares them side by side, and Stage 4 moves the board to the bot. One dropdown does both.

Decisions

  • J3: exporter stays the default until Stage 4. Stage 4 flips it in SOURCE_VAR, one line.
  • bot is the regex t0-liquidity|t0-liquidity-staging, since prod and staging scrape the bot under different job names. $env already picks the project, and PromQL anchors the regex, so it never matches t0-liquidity-exporter.
  • pin_liq now writes job=~"$source", and the generator still fails closed: any liq_ selector without exactly that matcher stops the build.
  • The Bot light: the bot never emits liq_up, so the bot source reads the scrape's own up. The exporter source never falls back to up, because the exporter's up says nothing about the bot (a stopped exporter shows no data, not a red bot).
  • The Δ deviation columns still read liq_*_ratio_deviation, which the bot does not emit, so they are empty on bot. observability: show the liquidity inventory as per-chain Grafana tables [RAI-3098] #1690 removes them.
  • Log panels (Trades, Rebalances, Logs) keep the exporter's log names on both sources. Moving them to the bot's own log lines is 6b, after item 5.

Proof

  • gen-t0-liquidity.py --check passes. Every liq_ selector on the five boards reads job=~"$source".
  • Multi-model review loop over the six 6a PRs (sol, grok, composer, flash, and opus) ran 4 passes plus a check of the last fix. This PR's findings were the up fallback on the exporter source (fixed) and a ticket key in a comment (fixed).
  • Not verified: the board on live Grafana with Source = bot. Needs the bot release on staging.

Merge conditions

Same as the stack below. The board deploys on merge to master through the observability workflow, not with a bot release. That is safe before the bot releases: Source defaults to exporter, so the published board reads the same series as today.

@linear-code

linear-code Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

RAI-2998

RAI-3062

RAI-3095

JuaniRios commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label add-to-gt-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@JuaniRios

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 08094176-8bb3-461c-bb07-0dbff74f8f92

📥 Commits

Reviewing files that changed from the base of the PR and between 246d8b0 and 6e74721.


📒 Files selected for processing (8)
  • docs/observability.md
  • observability/README.md
  • observability/dashboards/liquidity/t0-liquidity.json
  • observability/dashboards/liquidity/tabs/t0-liquidity-logs.json
  • observability/dashboards/liquidity/tabs/t0-liquidity-orders.json
  • observability/dashboards/liquidity/tabs/t0-liquidity-performance.json
  • observability/dashboards/liquidity/tabs/t0-liquidity-pnl.json
  • observability/gen-t0-liquidity.py

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.



Walkthrough

The liquidity dashboards add an exporter-or-bot source selector. Their PromQL queries use the selected job matcher, and connection indicators use exporter liq_up or the bot scrape’s up metric. The generator adds the source variable, pins liq_* selectors, and validates that selectors use the selected matcher. Documentation describes the source options and migration stages.

Estimated code review effort

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 6e747

No actionable defect is established. The boards retain the exporter default; check the bot selection in Grafana when staging is available.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (7 skipped: 7 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: allowing liquidity boards to read liq_ metrics from either the exporter or the bot.
Description check Passed The description directly explains the Source variable, exporter and bot metric selection, defaults, validation, rollout, and known verification limits.


✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

📝 Generate docstrings
  • Commit to this branch
  • Create a new PR


  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@JuaniRios
JuaniRios marked this pull request as ready for review October 8, 2026 23:55
@JuaniRios

Copy link
Copy Markdown
Collaborator Author

@rain-marvin review

@rain-marvin

rain-marvin Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

⏳ Queued behind 12 other jobs, @JuaniRios. I'll post here when I start.

@rain-marvin

rain-marvin Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🔎 Reviewing 82c3844, started by @JuaniRios. The review will appear here when it's done.

@rain-marvin rain-marvin Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR adds a Source dropdown to the five generated liquidity boards. Every liq_* selector now reads job=~"$source", where exporter (the default) is the sidecar job and bot is t0-liquidity|t0-liquidity-staging. The Bot light reads liq_up on the exporter source and the scrape's own up on the bot source. The generator still fails closed on any liq_ selector without exactly that matcher, and --check passes for all five boards.

Overall read: correct and safe to ship ahead of the bot release. With the default on exporter, every query resolves to the same series as before. The Grafana Cloud Monitoring datasource passes a single-value custom variable into PromQL unescaped, so the | alternation works. PromQL anchors the regex, so bot never matches the exporter job. The tab links set includeVars, so the source carries between tabs. Two lanes rated the scrape job names and the exporter path a public-repo exposure. Both verifiers rejected that: the base commit already publishes every one of those names and paths. What remains is small: one hand-built data link drops the new variable, one CI doc still describes the old pin, and a docs claim about the Stage 4 flip is not accurate. Not checked here: the board on live Grafana with Source = bot, which needs the bot release on staging, as the PR says.

claude-opus-5-5 · high · 1 h 26 min

Comment thread observability/gen-t0-liquidity.py
Comment thread docs/observability.md
Comment thread docs/observability.md
@JuaniRios

Copy link
Copy Markdown
Collaborator Author

@coderabbitai approve

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@JuaniRios
JuaniRios force-pushed the rai-2998-liq-metrics-orders branch from af7ab30 to 88fad70 Compare October 9, 2026 22:27
@JuaniRios
JuaniRios force-pushed the rai-2998-board-native branch from 82c3844 to 4030f3b Compare October 9, 2026 22:27
@JuaniRios JuaniRios changed the title [RAI-2998] Let the liquidity boards read liq_ from the exporter or the bot observability: let the liquidity boards read liq_ from the exporter or the bot [RAI-3095] Oct 9, 2026
@JuaniRios
JuaniRios force-pushed the rai-2998-liq-metrics-orders branch from 88fad70 to 78bbf85 Compare October 9, 2026 23:39
@JuaniRios
JuaniRios force-pushed the rai-2998-board-native branch from 4030f3b to 1aa64e8 Compare October 9, 2026 23:39
This was referenced Oct 10, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant