Prometheus

Storage Map v101 → v490 · 1 shape change

Prometheus endpoint info for neurons.

Explore chain
Queried by: validatorssubnet ownersdevelopersanalytics

The Big Picture

Prometheus endpoints expose operational metrics from neurons - inference latency, request counts, error rates, resource usage, etc. This enables observability across the network. Validators can use this data to make better weight decisions, and operators can debug issues.

Why This Matters

Beyond just connecting to miners, you want to know how they're performing. Prometheus endpoints give you operational metrics - how fast, how reliable, how loaded is this neuron?

Example Scenario

Query Prometheus(netuid=1, uid=47) returns { ip: '1.2.3.4', port: 9090, ip_type: 4, version: 1, block: 7000000 }. Scrape http://1.2.3.4:9090/metrics for Prometheus-format metrics.

Common Questions

Is Prometheus required?
No, it's optional. Neurons can participate without exposing metrics. But providing metrics can build trust with validators who value transparency.
What metrics should neurons expose?
Common: inference_latency, request_count, error_rate, queue_depth. Subnet-specific metrics depend on the task. Follow Prometheus naming conventions.
Can validators use this for scoring?
Yes, sophisticated validators can scrape metrics to inform weight decisions - rewarding neurons with better performance characteristics.

Use Cases

  • Build network-wide monitoring dashboards
  • Scrape neuron performance metrics for analysis
  • Debug neuron health and performance issues
  • Create alerting systems based on neuron metrics
  • Research network behavior through metrics aggregation

From Chain Metadata

MAP ( netuid, hotkey ) --> prometheus_info

Purpose & Usage

Purpose

Store metrics endpoint location for monitoring and observability.

Common Query Patterns

  • Query by netuid-uid for a specific neuron's metrics endpoint
  • Iterate to discover all available metrics endpoints
  • Build monitoring systems that scrape neuron metrics

Migration Notes

v424 v432 Breaking

key type changed from (u16, AccountId) to (NetUid, AccountId)

Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.

Query Keys

#NameTypeDescription
1
netuid
NetUid netuid (NetUid, hashed key component)
2
hotkey
AccountId hotkey (AccountId, hashed key component) (hex -> SS58)

Stored Value

prometheus_info (PrometheusInfo)

Default Value

None (absent keys return no value)

Optional storage: querying a key that has never been written returns no value (None) — do not assume a zero default.

Relationships

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query Prometheus storage
const netuid = 1;
const hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query.SubtensorModule.Prometheus.getValue(netuid, hotkey);
console.log("Prometheus:", result);

On-Chain Activity

Write Frequency
●●●●○○ Medium 100K–1M est. writes

100K to 1M writes

#173 most written storage item

Write Source Calls + Hooks

Modified by both user extrinsics and runtime hooks

As of block 9,385,000

Version History

v101 block 1 Added
v425–v431 · runtime versions skipped on chain (never deployed)
v432 block 8,636,190 Shape changed Current
  • key : (u16, AccountId) → (NetUid, AccountId)

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v101
Current Version
v490