Add RPC latency data to Solana Data dashboard#1656
Conversation
- Introduced new environment variables for Grafana Cloud Prometheus data source. - Added RPC region and method options to the data configuration. - Implemented new charts for average and P99 latency metrics in the Solana data dashboard. - Enhanced the dashboard controls to include RPC method and region filters. - Created a new API route for fetching RPC latency data from Grafana. - Developed server-side logic to query Prometheus for RPC latency metrics. - Updated internationalization files to support new RPC-related labels and descriptions.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
Greptile SummaryThis PR adds a new RPC tab to the Solana Data dashboard, backed by a server-side Grafana Cloud Prometheus reader (
Confidence Score: 5/5Safe to merge; all external inputs are whitelisted before reaching Prometheus, HTTPS enforcement is in place, and the error handling surfaces clean 502/503 responses without leaking credentials. The new Prometheus reader is well-guarded (HTTPS-only URL validation, full allowlist on every PromQL label, label-value escaping), the caching strategy is sound, and the existing test suite was extended to cover the new query-building logic and chart utilities. The two findings are quality concerns about an unguarded fetch that could hang under a slow upstream and a KPI delta that is structurally always zero for the instant-query avg-latency card — neither affects data correctness or security.
Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Browser
participant SWR as SWR Client (60 s poll)
participant Route as /api/rpc/data
participant Cache as unstable_cache + in-flight Map
participant Grafana as Grafana Cloud Prometheus
Browser->>SWR: mount RPC tab
SWR->>Route: "GET /api/rpc/data?method=…®ion=…&infra=…"
Route->>Route: getRpcLatencyConfig() — validate env + HTTPS URL
Route->>Cache: getCachedRpcLatencyData(config, options)
alt cache hit (≤60 s)
Cache-->>Route: cached RpcLatencyData
else cache miss
Cache->>Grafana: Promise.all — 5× Prometheus queries
Grafana-->>Cache: PrometheusResponse[]
Cache->>Cache: "normalise timestamps & values → MetricRow[]"
Cache-->>Route: RpcLatencyData
end
Route-->>SWR: "200 JSON + Cache-Control s-maxage=60"
SWR-->>Browser: rows → filterRowsForCharts → buildSeries
Browser->>Browser: KpiGrid + ProviderBarChart + TimeSeriesChart
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Browser
participant SWR as SWR Client (60 s poll)
participant Route as /api/rpc/data
participant Cache as unstable_cache + in-flight Map
participant Grafana as Grafana Cloud Prometheus
Browser->>SWR: mount RPC tab
SWR->>Route: "GET /api/rpc/data?method=…®ion=…&infra=…"
Route->>Route: getRpcLatencyConfig() — validate env + HTTPS URL
Route->>Cache: getCachedRpcLatencyData(config, options)
alt cache hit (≤60 s)
Cache-->>Route: cached RpcLatencyData
else cache miss
Cache->>Grafana: Promise.all — 5× Prometheus queries
Grafana-->>Cache: PrometheusResponse[]
Cache->>Cache: "normalise timestamps & values → MetricRow[]"
Cache-->>Route: RpcLatencyData
end
Route-->>SWR: "200 JSON + Cache-Control s-maxage=60"
SWR-->>Browser: rows → filterRowsForCharts → buildSeries
Browser->>Browser: KpiGrid + ProviderBarChart + TimeSeriesChart
Reviews (7): Last reviewed commit: "feat: enhance percent axis handling with..." | Re-trigger Greptile |
…s and descriptions
…dd-rpc-data # Conflicts: # apps/web/.env.example # turbo.json
Summary
/api/rpc/dataroute for avg latency and hourly p99 latency/datawith method/region filters, provider filtering, avg latency bars, and p99 time seriesValidation
pnpm --filter solana-com exec tsc --noEmit --project tsconfig.jsonpnpm --filter solana-com test -- src/__tests__/components/data/solana-data-dashboard.test.ts src/__tests__/components/data/time-series-chart.test.ts src/__tests__/components/data/time-series-chart-legend.test.tsxpnpm --filter solana-com lint(passes with existing unrelated warnings)/data?tab=rpc