# Telemetry

Telemetry is a real-time stream of structured data emitted by peers to describe their internal activity, performance, and state. It enables external services to observe, monitor, and analyze system behavior without directly interacting with core logic.

Telemetry events are transmitted over a WebSocket connection, allowing consumers to subscribe to and process events such as network activity, state changes, and performance metrics as they occur.

## Usage:

```python
telemetry = Telemetry(
    url="ws://localhost:9000",
    subnet_id=1,
    subnet_node_id=10,
    peer_id=ID.from_base58("12D3Koo...")
)

async with trio.open_nursery() as nursery:
    telemetry.start(nursery)

    await telemetry.emit_async("node_started")
    await telemetry.emit_async("peer_connected", peer="12D3Koo...")
```

You can spin up and customize the Telemetry endpoint by cloning [https://github.com/hypertensor-blockchain/subnet-telemetry](https://github.com/hypertensor-blockchain/subnet-telemetryhttps://github.com/hypertensor-blockchain/subnet-telemetry). See the README.md for documentation on how to build and start the telemetry server.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hypertensor.org/copy-of-subnet-template/telemetry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
