serve_prometheus

Call v101 → current #5

Registers Prometheus metrics endpoint.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: minersvalidatorsdevelopersanalytics

The Big Picture

Transparency builds trust. serve_prometheus publishes your metrics endpoint so anyone can monitor your performance. This is optional but valuable - validators may prefer miners they can observe, and the community benefits from network-wide health data.

Why This Matters

Running a miner in a black box works, but transparency helps. Validators may consider observable miners more trustworthy. You can also use this to debug your own operations and let delegators see your uptime.

Example Scenario

Your miner exposes Prometheus metrics at port 9090. Call serve_prometheus(netuid=1, ip=203.0.113.50, port=9090). Now anyone can scrape your metrics endpoint to see response times, error rates, and other performance data.

Common Questions

Is serve_prometheus required?
No, it's optional. Your miner works without it. But some validators and analytics tools may favor transparent miners.
What metrics should I expose?
Common metrics: response latency, request count, error rate, GPU utilization, queue depth. Use standard Prometheus format for compatibility.

Use Cases

  • Publish miner performance metrics for monitoring
  • Enable network-wide health dashboards
  • Allow validators to assess miner reliability
  • Support community analytics and research

Input Parameters

#NameTypeDescription
0
netuid
u16 Subnet/network identifier (0-65535)
1
version
u32 version (u32)
2
ip
u128 ip (u128)
3
port
u16 port (u16)
4
ip_type
u8 ip_type (u8)

Permissions

Origin
Unknown
Required Role
Authorization Checks
  • Hotkey must be registered on the target subnet

Requirements

  • Caller is registered on subnet
  • Valid endpoint provided

Effects

Events Emitted

Storage Modified

Postconditions

  • Prometheus endpoint stored

Side Effects

  • Monitoring systems can discover metrics

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Build serve_prometheus call
const netuid = 1;
const version = 0;
const ip = 0;
const port = 0;
const ip_type = 0;

const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("serve_prometheus")](
  netuid,
  version,
  ip,
  port,
  ip_type
);

On-Chain Activity

Usage Frequency
●●●●●○ Core 1M–10M extrinsics

Primary protocol calls

#8 most used call

Success Rate Highly competitive

Under 5% succeed — vast majority fail due to competition

As of block 7,429,232

Runtime Info

View Source
Pallet Index
7
Call Index
5
First Version
v101
Current Version
v393