Self-hosted monitoring and alerting for Solana programs.
Microscope consumes confirmed transactions from Yellowstone gRPC or a polling Solana JSON-RPC endpoint, decodes program activity with Carbon, and exposes it through Prometheus, Loki, and Grafana. It also normalizes Squads v3, v4, and Smart Account/v5 activity. You operate the stack in your own environment; Solana Foundation does not host it or receive deployment data.
| Signal | Record | Description |
|---|---|---|
| Instruction | program_instruction |
IDL-decoded program instruction |
| Event | program_event |
IDL-decoded log or direct event-CPI |
| Multisig | multisig_activity |
Squads instruction mapped to a stable action |
| Decode failure | event_decode_failure |
Event payload the IDL decoder rejected |
Microscope provides:
- Prometheus metrics and a generated Grafana dashboard
- Structured records in Loki and metrics in Prometheus, both retained 30 days in
the local stack (
PROMETHEUS_RETENTIONoverrides the metrics window); hosted Grafana Cloud and Kubernetes deployments follow their own retention - Config-driven Grafana alerts with optional field conditions
- Slack, Telegram, and PagerDuty delivery
- Local Docker Compose and Terraform deployments for AWS and Google Cloud
Raw program-log string matching is not supported. Alerts target decoded instructions, decoded events, or normalized Squads activity.
Yellowstone gRPC --.
+-> Carbon indexer -> Prometheus ------> Grafana
RPC polling -------' `-> Alloy -> Loki ----> alerts
One deployment monitors one or more programs and, optionally, any number of Squads multisigs.
To follow a complete example against a live mainnet protocol instead of
configuring your own, see
docs/examples/jupiter-lend.md, which monitors
Jupiter Lend and the Squads multisig that can upgrade it. It is a teaching
example only: Solana Foundation does not operate that deployment and is not
affiliated with Jupiter.
Requirements:
- Docker Engine with Docker Compose v2
- A Yellowstone gRPC endpoint or Solana JSON-RPC endpoint
- The target program ID and IDL
- Optionally, a Squads default vault, internal state account, and version
docs/operations.md covers sourcing those endpoints,
finding the Squads state address, cost, and troubleshooting.
git clone https://github.com/solana-foundation/solana-microscope.git
cd solana-microscope
cp microscope.toml.example microscope.tomlThe checked-in example points at the bundled example IDL. Replace its program ID, IDL, multisig vault, state account and version, dashboard fields, and alerts for your deployment.
The bundled setup-deployment
Claude Code skill automates this step: it interviews you for each value,
derives alert rules from your IDL, writes microscope.toml and .env — or
terraform.tfvars for the cloud deployments below — and validates the result.
Create an ignored .env file:
GEYSER_URL=https://your-yellowstone-endpoint:443
GEYSER_X_TOKEN=
# Required in RPC mode and by `just backfill`; optional in Yellowstone mode.
RPC_URL=https://your-solana-rpc-endpoint
GRAFANA_ADMIN_PASSWORD=replace-with-a-strong-password
SLACK_WEBHOOK_URL=
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=
PAGERDUTY_INTEGRATION_KEY=Start the stack:
just up
docker compose psGrafana reads alert provisioning only at process startup, so just up
regenerates the alerting config and recreates Grafana. Running
docker compose up --build --detach directly against an already-running stack
leaves Grafana evaluating the previous rules until you add
docker compose up --detach --no-deps --force-recreate grafana.
Open Grafana at http://localhost:3000. Indexer metrics are available at http://localhost:9090/metrics, and the health probes at http://localhost:9091/healthz and http://localhost:9091/readyz.
docker compose logs --follow indexer
docker compose downdocker compose down preserves local Prometheus, Loki, Alloy, and Grafana data.
Add --volumes to delete those volumes.
microscope.toml is the source of truth for local deployments:
program_id = "<PROGRAM_ID>"
idl_path = "idl/idl1.json"
[multisig] # optional; all three values are required when present
vault_address = "<SQUADS_DEFAULT_VAULT>"
state_address = "<SQUADS_STATE_ACCOUNT>"
version = "v4" # v3 | v4 | v5
# Optional; Yellowstone is the default.
[datasource]
mode = "yellowstone" # or "rpc"
poll_interval_seconds = 5
replay_window_slots = 600
[dashboard]
event_fields = ["name", "source", "signature", "slot", "failed", "data.amount"]
multisig_fields = ["action", "squads_version", "instruction", "signature", "slot", "failed"]
[alerting]
lookback_window_seconds = 60
evaluation_interval_seconds = 10
[[alerts]]
kind = "event"
name = "payment_settled"
match = "all"
conditions = [
{ field = "data.amount", operator = "gte", value = 1000 },
{ field = "data.currency", operator = "eq", value = "USDC" },
{ field = "failed", operator = "eq", value = false },
]
severity = "warning"
channels = ["slack"]
[[alerts]]
kind = "multisig"
name = "proposal_approved"
severity = "critical"
channels = ["pagerduty"]Alerts support:
- Kinds:
event,instruction,multisig - Names: the snake_cased instruction or event declared by
idl_path, or an action emitted by a configured multisig version; anything else is rejected at startup instead of becoming a rule that can never fire. A few Squads actions whose instructions reference no state account (for examplemultisig_createdand theprogram_*actions) validate but cannot fire for a configured deployment - Severities:
critical,error,warning,info - Condition groups:
match = "all"(default) ormatch = "any" - Operators:
exists,contains,eq,ne,gt,gte,lt,lte - Typed string, number, and boolean values;
existsomitsvalue existsmatches non-empty values; a missing field,null, and""do not match, because Loki extracts all three as an empty labelneagainst a string or boolean matches only records where the field is present, so an absent optional field is not treated as "not equal"containsrequires a non-empty string value- Integer condition values above 2^53 are rejected because Loki compares numbers as float64; quote the value to compare it as an exact string
- Global timing defaults with per-alert overrides; evaluation intervals use 10-second multiples
- Dot-separated JSON field paths
- Multisig alerts fire on successful activity only; failed Squads instructions
stay visible in the dashboard and metrics but never page. Event and
instruction alerts keep
failedas an explicit condition
Dashboard fields are also JSON paths. Missing fields render as empty cells;
complete records remain available in Loki. Every record also carries
instruction_index, instruction_path, and stack_height, identifying the
exact instruction occurrence within the transaction; they are usable in
dashboard fields and alert conditions like any other field. An alert with no channels remains
visible in Grafana but does not send notifications.
Event, instruction and multisig alerts notify Slack and Telegram once per match, with no "resolved" message when the match leaves the lookback window. Health alerts still send one when they recover. PagerDuty gets the resolved message for both, because it is what closes the incident.
Telegram gets a compact message for each alert:
🟠 recurring_transfer_event · warning
Matched event recurring_transfer_event where failed eq false
Transaction · Dashboard
Transaction opens the matched transaction in the explorer. Dashboard opens
the alert's panel in the Grafana dashboard; an alert with no dashboard panel,
such as an instruction or health alert, links its Rule instead. A recovered
health alert is one ✅ resolved: <signal> line. When the deployment monitors
several programs or several multisigs, a line under the description names the
one that matched: Program <program ID> or Vault <vault address>.
Telegram limits a message to 4096 characters, so one message shows at most
five alerts and counts the rest, and cuts a description at 3000 characters when
it holds one alert, or at 100 when it holds several. Link addresses are never
cut: the limits leave room for two links of 200 characters each, so a longer
explorer URL or Grafana root_url reduces that margin.
The Grafana links start with Grafana's root_url, which is
http://localhost:3000/ in the local stack, and Telegram shows a localhost
link as plain text; set GF_SERVER_ROOT_URL on the grafana service to get
working links.
Event, instruction and multisig alerts carry the explorer link alone in a
transaction_url annotation, for notification templates of your own. The
transaction annotation still holds the signature followed by that link.
See microscope.toml.example for all options.
Omit [datasource] to keep the default Yellowstone mode. Set GEYSER_URL and,
when required by your provider, GEYSER_X_TOKEN. Any endpoint speaking the
Yellowstone gRPC protocol works, whoever operates it.
The stream recovers its own disconnects: the client reconnects with an exponential backoff, resubscribes from the last slot it saw, and discards what the replay repeats. A disconnect therefore costs nothing as long as the outage fits inside the retry budget and the provider still serves the slot being replayed from, which is why the replay depth your provider offers matters.
A provider outage is not a disconnect: the stream retries the same dead
endpoint forever. To survive one, list endpoints from other providers in
GEYSER_FALLBACK_URLS, comma-separated in priority order, with their tokens in
GEYSER_FALLBACK_X_TOKENS matched by position (leave an entry empty for an
endpoint without a token). The indexer probes the endpoint in use and
any it would return to every 15 seconds, and a healthy fallback it is not using
every five minutes, until the endpoint in use starts failing. It moves the stream
to the first healthy one after the current endpoint fails its probe for a
minute, and returns to a higher-priority endpoint once it has been healthy for
five minutes. An endpoint that fails again right after a return waits twice as
long each time, up to an hour. A switch opens the new stream before closing the
old one and the pipeline deduplicates the overlap, so returning to a recovered
primary loses nothing; leaving a dead endpoint resubscribes at the new
endpoint's head, so that gap is RPC recovery's to fill, and RPC_URL should
point at a different provider than GEYSER_URL or one outage takes out both.
Metrics carry an endpoint label with the host alone, never the URL's path or
query, and microscope_yellowstone_active_endpoint names the endpoint in use.
The yellowstone_endpoint_degraded alert warns when one endpoint fails its
probe while another passes, so a fallback with a wrong token shows up before
the failover that needs it.
RPC_FALLBACK_URLS does the same for the poller, in RPC mode and for gap
recovery: comma-separated endpoints in priority order, used after RPC_URL
fails polls for a minute (a healthy fallback is otherwise probed every five
minutes) and left once RPC_URL has answered probes for five
minutes, with the same doubling wait for an endpoint that keeps failing after
each return. The cursors carry over, so a switch loses nothing. A fallback is
only used once it reports the same genesis hash as the endpoint the checkpoint
was written against, so an endpoint on another cluster is never polled; until a
checkpoint exists only RPC_URL can name the cluster, so a first start waits
for it. An endpoint whose history no longer reaches the checkpoint is given up
on until the indexer restarts, and recovery disables itself only once every
endpoint has been. microscope_rpc_active_endpoint names the endpoint in use,
and the rpc_endpoint_degraded alert warns when one endpoint is unusable while
another works. Backfill always uses RPC_URL or --rpc-url.
RPC_URL is still worth setting. Recovery inside the stream lives in the
process, so it covers disconnects but never restarts, outages longer than the
retry budget, history past the provider's replay window, or undecodable
transactions. When RPC_URL is set, the indexer reconciles confirmed signatures
through RPC to fill exactly those gaps, skipping whatever the stream already
delivered. The primary datasource remains Yellowstone; RPC_URL never changes
the selected mode.
Yellowstone exports microscope_yellowstone_disconnects_total and
microscope_yellowstone_missed_slots_total through Prometheus. Both count only
the disconnects the stream could not replay through, so a non-zero value means
an interval that RPC recovery has to cover.
Use RPC polling as the primary datasource when low latency is less important than endpoint cost:
[datasource]
mode = "rpc"
poll_interval_seconds = 5
replay_window_slots = 600Set RPC_URL and leave GEYSER_URL empty. RPC mode polls confirmed signatures
for the configured program and optional Squads state account, then fetches each
new transaction through the same decoding pipeline.
RPC polling and Yellowstone reconciliation share an atomic checkpoint under
MICROSCOPE_STATE_DIR. Every poll rescans replay_window_slots behind the
cursor, including the first run and every restart; signatures retained in the
durable checkpoint suppress the duplicates. The checkpoint only records progress
the pipeline has already consumed, so a crash between queueing a transaction
and Carbon processing it replays that transaction instead of skipping it.
Under sustained pipeline traffic the checkpoint may hold an older snapshot
until the queue drains; the cost is duplicate re-emission after a restart,
never loss. The checkpoint retains signatures covered by that replay window,
so transactions already present in the last durable checkpoint are not
re-emitted after a restart. Temporary RPC failures (outages, rate limits, server errors) never
advance a cursor, never discard a transaction, and leave checkpoints unchanged:
polling retries until the endpoint recovers and then catches up from the
durable checkpoint.
In Yellowstone mode the same checkpoint also absorbs the signatures the stream delivered, recorded only once an update reaches the pipeline. A poll stalled by a long RPC outage therefore skips them on recovery instead of emitting a second record for activity Grafana has already alerted on. Deliveries recorded but not yet absorbed are lost if the process exits, so a restart during an outage can still re-emit that last window.
Recovery depends on the endpoint retaining getSignaturesForAddress and
getTransaction history back to the checkpoint. When consecutive polls confirm
that the endpoint's history no longer reaches it, or that a checkpoint cursor
sits implausibly beyond the endpoint's confirmed head (two consecutive
observations are tolerated, since load-balanced providers can briefly answer
from a lagging node), RPC recovery disables itself instead of silently
creating a gap or
stopping the rest of the stack. Yellowstone continues when it is the
primary datasource; RPC-only deployments remain running but ingest no new
records until restarted against usable history: switch RPC_URL to an endpoint
that still has the missing slots, or backfill the missed window and delete the
checkpoint to restart at the current confirmed slot. Only a transaction the
endpoint provably cannot decode (an unsupported transaction version, or a
response that repeatedly fails conversion) is quarantined after bounded
confirmations; quarantining advances the affected cursor without a decoded
record and emits an error and metrics. High-volume programs may use more RPC
request units than a filtered gRPC stream.
RPC recovery exports microscope_rpc_recovery_enabled,
microscope_rpc_poll_started_unixtime,
microscope_rpc_poll_last_success_unixtime, microscope_rpc_poll_head_slot,
microscope_rpc_poll_lag_slots, microscope_rpc_poll_transactions_total,
microscope_rpc_poll_failures_total,
microscope_rpc_poll_transaction_failures_total,
microscope_rpc_poll_quarantined_transactions_total,
microscope_rpc_poll_quarantined_transactions,
microscope_rpc_checkpoint_last_success_unixtime,
microscope_rpc_checkpoint_slot, microscope_rpc_checkpoint_failures_total,
microscope_rpc_checkpoint_corrupt_total,
microscope_rpc_checkpoint_quarantined_files,
microscope_rpc_history_unavailable_total,
microscope_rpc_recovery_degraded, and
microscope_rpc_recovery_disabled_total through Prometheus. Whenever RPC
polling runs, whether as the primary datasource or as Yellowstone gap recovery,
the generated dashboard gains polling freshness, lag, throughput, failure, and
quarantine panels, and stale-poll, poll-failure, lag, quarantine, and
checkpoint-stale alert
rules are provisioned. The lag rule warns when cursors trail the confirmed head by more
than twice the replay window, catching stalls where polls still succeed but
transactions stop being decoded. The poll-failure rule warns when more than one
in twenty of the polls expected in a fifteen-minute window failed, catching a
poller that fails a share of its polls indefinitely: enough succeed to keep
freshness, lag, and readiness green while gap recovery is partially dead.
Those rules, plus the checkpoint-corruption, terminal recovery-degradation,
and datasource dropped-update rules that always exist, and the
stream-interruption and gap rules Yellowstone deployments add, are sent to
every contact channel used by the deployment; without a configured channel,
they remain visible in Grafana but muted.
Decoding a record and delivering it are separate failures, so Alloy's own delivery metrics are scraped and alerted on as well. Every deployment gets a rule that fires when the indexer decodes transactions while Alloy ships no log entries, and one that fires when Alloy drops entries or stops reporting delivery at all. Without them, a shipping failure leaves the dashboard green and every activity alert evaluating an empty stream.
The indexer serves two probe endpoints on port 9091, for orchestrators that restart or gate traffic on them:
| Endpoint | 200 when |
|---|---|
/healthz |
the process is running and its runtime is scheduling work |
/readyz |
startup finished, and the configured datasource is reachable |
/readyz returns 503 with the reason in the body otherwise. In RPC mode
"reachable" means a poll succeeded within the same poll_interval_seconds * 6
threshold, floored at 60 seconds, that the generated RPC poll staleness alert
uses; the window is seeded at startup, so the first poll has that long to
succeed. A poller failing only a share of its polls stays ready, since the
successful ones keep the window fresh; the generated poll-failure alert covers
that case.
In Yellowstone mode the indexer opens a short-lived subscription on the geyser
endpoint in use every 15 seconds, using the same URL and token as the stream
but no filters, so the endpoint sends pings and no transactions. It reports
unready once that has been failing on every endpoint for
MICROSCOPE_STREAM_STALE_AFTER_SECONDS, 90 seconds by default. A rejected
token, an unresolvable host, a dead endpoint or one that refuses to stream (a
quota, a plan without streaming) fails the probe; a single blip
does not, because the window is measured from the last success and six attempts
fit inside it. Set 0 to leave readiness blind to the endpoint. Probe failures
are also exported as microscope_yellowstone_probe_healthy and
microscope_yellowstone_probe_failures_total.
The probe is a second subscription next to the stream, so the provider plan
must allow two concurrent streams per endpoint. It proves the endpoint accepts
a subscription, not that our own stream is still being served: a stream wedged
against a healthy endpoint still reports ready. The generated yellowstone_stream_interrupted alert covers
that case, once the interruptions are sustained: the datasource logs one timeout
per STREAM_TIMEOUT, so the rule counts them over 15 minutes and fires above
five, leaving the single reconnect the client replays silent.
The probes listen on 0.0.0.0:9091 and the metrics exporter on 0.0.0.0:9090.
To bind either one elsewhere, for example to loopback on a host without Docker,
set MICROSCOPE_PROBE_ADDR or MICROSCOPE_METRICS_ADDR to an IP address and
port such as 127.0.0.1:9091. A value that does not parse stops startup. Leave
both unset under Compose and Kubernetes, where Prometheus and the kubelet reach
the indexer from outside its container.
Run just generate after changing the program or IDL. Carbon generates the
instruction and event decoder; Microscope gives log events and event-CPI
events the same JSON shape with source = "log" or "cpi". An event payload
that matches an event shape but fails to decode emits an
event_decode_failure record and increments
microscope_event_decode_failures_total.
The decoder is compiled in, so program_id and the IDL are build inputs, not
runtime ones. The generated decoder ignores instructions from any other program
and knows only the instructions and events the build's IDL declared. At startup
the indexer therefore refuses to run when its config names a different
program_id or an IDL whose contents differ from the one it was built from,
rather than subscribing successfully and decoding nothing.
To monitor several programs in one deployment, replace the top-level
program_id and idl_path with one table per program. A repeated program_id
is rejected:
[[programs]]
program_id = "<FIRST_PROGRAM_ID>"
idl_path = "idl/first.json"
[[programs]]
program_id = "<SECOND_PROGRAM_ID>"
idl_path = "idl/second.json"just generate and the image build produce one decoder per table, in this
order, so the list is a build input the same way a single program is: change it
and rebuild. Every program shares the one Yellowstone subscription and the one
RPC poller. Each monitored address costs one getSignaturesForAddress call per
poll, and Yellowstone endpoints cap how many accounts one filter may include
(10 in the reference server configuration), counting programs and multisig
state accounts together.
Records, the event table and the instruction and event counters carry
program_id. An event or instruction alert matches its name on every
configured program and reports the one that matched in a program_id
annotation. Set program_id on the alert to watch one program only; the name
then has to be declared by that program's IDL:
[[alerts]]
kind = "instruction"
name = "withdraw"
program_id = "<SECOND_PROGRAM_ID>"
severity = "warning"
channels = ["slack"]An alert that names its program keeps the rule UID it had while that program
was the only one configured, so pin existing alerts this way when adding a
second program to a running deployment. Adding or removing a program also
changes the monitored addresses, which disables RPC recovery until the RPC
checkpoint is removed; see
RPC recovery disabled itself.
In Terraform, set the programs list instead of program_id; see
infra/README.md.
For Squads, configure the default vault shown in the UI, its internal state
account, and version (v3, v4, or v5). The state account is the v3 Ms,
v4 Multisig, or Smart Account/v5 Settings account. At startup, the indexer
locally verifies that the state account derives the configured default vault;
no RPC lookup is needed. Live indexing and backfill monitor only the state
account because record-producing Squads instructions reference it. Smart
Account/v5 instructions scoped to a policy account instead of the Settings
account are therefore not monitored; decoded Squads instructions that reference
another state account are counted by
microscope_multisig_unmatched_state_total.
A multisig can hold several vaults, and monitoring the state account covers all
of them, not only the configured vault_address. Records report that
configured address in vault_address whichever vault an instruction acted
on, so use the vault index in the instruction arguments (v4:
data.data.args.vault_index) to narrow an alert to one vault.
To monitor several multisigs, repeat the table as an array of tables. Versions
can be mixed, every entry is verified at startup, and a repeated
vault_address or state_address is rejected:
[[multisig]]
vault_address = "<FIRST_DEFAULT_VAULT>"
state_address = "<FIRST_STATE_ACCOUNT>"
version = "v4"
[[multisig]]
vault_address = "<SECOND_DEFAULT_VAULT>"
state_address = "<SECOND_STATE_ACCOUNT>"
version = "v3"A kind = "multisig" alert then fires for activity on any configured vault,
names that vault in its vault_address annotation, and its name only has to be
emitted by one of the configured versions. Records
carry their own vault_address, so narrow an alert to one multisig with a
condition on it:
[[alerts]]
kind = "multisig"
name = "proposal_approved"
conditions = [
{ field = "vault_address", operator = "eq", value = "<FIRST_DEFAULT_VAULT>" },
]
severity = "critical"
channels = ["pagerduty"]The multisig table shows every configured vault; add vault_address to
dashboard.multisig_fields to tell them apart. The
microscope_multisig_* metrics are labelled by Squads version, not by vault.
Adding a multisig to a deployment that polls RPC changes the monitored
addresses, so remove the RPC checkpoint as described in
docs/operations.md.
Version-specific instructions are normalized into actions such as
proposal_approved, transaction_executed, member_added, and
threshold_changed.
Governance changes reach those granular actions only when the executing
instruction carries them. The v5 synchronous settings execution does, so it
emits settings_transaction_executed plus one action per applied change. The
v4 config transaction and the v5 asynchronous settings transaction apply
changes from a stored account, so their execution emits only
configuration_transaction_executed / settings_transaction_executed; the
changes themselves are in the data of the matching
configuration_transaction_created / settings_transaction_created record.
Alert on those creations, not on member_added, to catch v4 governance
changes.
Pinned Squads IDL sources are documented in
idl/squads/README.md. Generated decoder crates are
ignored by Git and should not be edited directly.
The VM deployment builds the indexer image on the VM. To deploy into a runtime
that pulls rather than builds, run the Publish Docker Image workflow from your
fork with your program_id and IDL path. It pushes to
ghcr.io/<your-org>/<your-repo> tagged with the program ID and with
<program-id>-<short-sha>. For several programs, give both inputs as
comma-separated lists in the same order; the tag is then
<first-program-id>-plus-<fingerprint>, where the fingerprint identifies the
ordered list, and the run summary prints the [[programs]] config to mount.
Publish from your own fork, not from upstream: an image serves only the programs and IDLs it was built from, and the workflow needs them as inputs.
The image carries no microscope.toml. Mount the deployment config at
/etc/microscope/microscope.toml and keep secrets in the environment, as
docker-compose.yml does. The config must name the
program ID and IDL the image was built from, or the indexer refuses to start.
docs/kubernetes.md is a reference for running the
indexer against a Prometheus, Loki, and Grafana you already operate.
Terraform configurations are available for
AWS and Google Cloud:
cd infra/aws
cp terraform.tfvars.example terraform.tfvars
terraform init
terraform plan
terraform applyThe Google Cloud module keeps state in a bucket, so its init needs one:
cd infra/gcp
cp terraform.tfvars.example terraform.tfvars
terraform init -backend-config="bucket=<state-bucket>" -backend-config="prefix=gcp/<deployment>"
terraform plan
terraform applySee remote state for creating that bucket and for running several deployments from one module directory.
Each deployment creates a dedicated network, an SSH-only Ubuntu VM, a private versioned deployment bucket, a cloud secret, and a least-privilege workload identity. Grafana and metrics remain bound to the VM loopback interface and are accessed through the generated SSH tunnel.
The initial image build can take several minutes. Configuration, secret, dashboard, and alert changes reuse the existing image; code and IDL changes rebuild it on the same VM.
For production:
- Pin
repository_refto a commit SHA. - Use an encrypted remote Terraform backend.
- Pass secrets through a secret-aware CI system or
TF_VAR_...variables. - SSH runs through IAP (GCP) or SSM Session Manager (AWS) with no public inbound ports; size compute, disk, and retention for the workload.
See the complete cloud deployment guide.
To ship into an existing Grafana Cloud stack instead of running Grafana,
Loki, and Prometheus on the VM, set the GRAFANA_CLOUD_* and
MICROSCOPE_DEPLOYMENT variables from .env.example and start only the
indexer and Alloy:
docker compose -f docker-compose.yml -f docker-compose.cloud.yml up -dMICROSCOPE_DEPLOYMENT is a label the deployment attaches to its own data,
not a permission. Dashboards, alert rules, and notification routes filter on
it, but Grafana Cloud does not bind a write token to a label: every deployment
sharing a stack can write under any deployment name. A leaked token or a
compromised VM can therefore forge another deployment's logs and metrics, and
so its alerts, including keeping a victim's series alive through an outage.
Give each deployment its own revocable access policy token so a leak can be
cut off individually, and put deployments from different trust domains in
separate Grafana Cloud stacks.
Switching an already-running local stack over: the overlay only disables
Grafana, Loki, Prometheus, and the alerting-config job, it does not stop
them. Run docker compose --profile local-stack down first, otherwise the
old Grafana keeps evaluating and delivering alerts alongside the hosted
stack.
Generate the matching Grafana resources for a deployment name and an existing dashboard folder UID:
RPC_URL=<endpoint> ./scripts/export-grafana-cloud.sh <deployment> <folder-uid> [config]The export refuses to run when [config] targets a different program than the
checked-out decoder, so run just generate for the deployment you are
exporting.
RPC_URL is mandatory because it decides whether the RPC polling health
alerts and dashboard panels are generated. Pass the deployment's endpoint
when it runs RPC recovery or the RPC datasource, and RPC_URL= when it
runs neither. Only presence matters, so a placeholder endpoint is enough;
the real secret stays on the VM.
The exported files are deployment-specific and stay untracked. Import
dashboards/<deployment>.json through the Grafana UI (Dashboards → New →
Import). Alert rules, contact points, and mute timings have no UI import;
create them in the alerting UI using the exported JSON as the reference, or
PUT each file to the Grafana provisioning API
with a token of your own:
curl -X PUT "$GRAFANA_URL/api/v1/provisioning/alert-rules/$(jq -r .uid rule.json)" \
-H "Authorization: Bearer $GRAFANA_API_TOKEN" \
-H "Content-Type: application/json" -H "X-Disable-Provenance: true" \
-d @rule.jsonContact-point JSON keeps $SLACK_WEBHOOK_URL-style placeholders; substitute
real secrets only at push time, never in the committed files. Slack and
Telegram export two contact points each: <deployment>-<channel> for health
alerts and <deployment>-<channel>-activity, which sends no resolved message,
for activity alerts. The Telegram contact points carry the message template in
settings.message, so push them again after an upgrade that changes it.
Pushing only creates and updates. Rules and contact points that disappear from
an export stay active in the tenant, and because rule UIDs are content-derived,
editing an alert replaces its UID and leaves the old rule firing. The script
prints the exact DELETE calls for everything that vanished since the last
export from this checkout; run them or the stale resources keep evaluating and
delivering to old channels.
The live indexer only sees activity from the moment it starts. To load past activity, run the backfill subcommand against a regular RPC endpoint with the stack running:
RPC_URL=https://your-rpc-endpoint just backfill 7dIt crawls the program plus every configured multisig state account backwards
through getSignaturesForAddress, decodes transactions with the same pipeline as the
live indexer, and pushes the records to Loki backdated to each transaction's
block time. Backdated records appear at their historical position in the
dashboard and never match the alert lookback window, so a backfill does not
trigger notifications.
--since accepts s, m, h, d, and w units and must stay within
Loki's reject_old_samples_max_age and retention_period (both 720h in the
provided configuration); the command refuses deeper backfills.
Grafana Cloud deployments run no local Loki; push through Alloy instead, which adds the deployment labels and Cloud credentials the hosted stack expects. Hosted endpoints do not expose their limits, so state the depth cap explicitly:
RPC_URL=https://your-rpc-endpoint just backfill 7d --loki-url http://alloy:3100 --loki-max-age 30dBackfill is all-or-nothing: any conversion, processing, missing-block-time, or interruption failure aborts the run before anything is pushed to Loki. Prometheus metrics are not backfilled, and a window that overlaps already-indexed activity can duplicate rows in the event tables.
Docker volumes preserve Prometheus, Loki, Alloy, Grafana, and RPC recovery
state across container restarts, configuration updates, and docker compose down. Invalid checkpoint JSON is renamed with a .corrupt-<timestamp> suffix
and recovery starts from a fresh replay window. The corruption alert stays
asserted while any such file exists: backfill the period the lost checkpoint
covered, then delete the file to resolve it. A checkpoint whose cluster,
program, or monitored addresses do not match the deployment disables recovery
to prevent cross-target reuse. Correct the configuration or endpoint first. If
the target intentionally changed, backfill any uncovered period, then remove the
old checkpoint and restart:
docker compose stop indexer
docker compose run --rm --entrypoint sh indexer \
-c 'rm -f /var/lib/solana-microscope/rpc-polling.json'
docker compose up -d indexerVM replacement, terraform destroy, or docker compose down --volumes removes
local history and checkpoints. Recovery then starts from a fresh replay window;
use backfill for any earlier gap.
Microscope is a single-node stack. High availability, external object storage, automated backups, and history migration are outside its current scope.
Local development requires Rust 1.97, Node.js 24, Python 3.11 or newer, Just,
Terraform 1.8 or newer for infrastructure work, and jq for
scripts/export-grafana-cloud.sh.
just setup
just build
just check
just test
just infra-checkSee CONTRIBUTING.md for contribution guidelines,
SECURITY.md for private vulnerability reporting, and
CHANGELOG.md for release history.
Solana Microscope is available under the MIT License.