diff --git a/.vitepress/config.ts b/.vitepress/config.ts index d8294bdda..0e7284170 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -286,6 +286,10 @@ function sidebarHome() { text: "Run a rollup full node", link: "/guides/full-node", }, + { + text: "Run a centralized sequencer", + link: "/guides/centralized-sequencer", + }, { text: "CometBFT into a Rollkit app", link: "/guides/cometbft-to-rollkit", @@ -318,6 +322,10 @@ function sidebarHome() { text: "Use lazy sequencing (aggregation)", link: "/guides/lazy-sequencing", }, + { + text: "Configure Prometheus metrics", + link: "/guides/metrics", + }, ], }, { diff --git a/guides/centralized-sequencer.md b/guides/centralized-sequencer.md new file mode 100644 index 000000000..c2daa5ffa --- /dev/null +++ b/guides/centralized-sequencer.md @@ -0,0 +1,33 @@ +### Centralized Sequencer Node + +The `centralized-sequencer` node implements a pluggable centralized sequencer scheme. It can be configured using the following flags: + +| Flag | Usage | Default | +|------------------------------|------------------------------------------------------------------|------------------------------| +| `batch-time` | Time in seconds to wait before generating a new batch | `2` seconds | +| `da_address` | DA address | `http://localhost:26658` | +| `da_auth_token` | Auth token for the DA | `""` | +| `da_namespace` | DA namespace where the sequencer submits transactions | `""` | +| `host` | Centralized sequencer host | `localhost` | +| `port` | Centralized sequencer port | `50051` | +| `listen-all` | Listen on all network interfaces (0.0.0.0) instead of just localhost | disabled | +| `metrics` | Enable Prometheus metrics | disabled | +| `metrics-address` | Address to expose Prometheus metrics | `":8080"` | + +See `centralized-sequencer --help` for details. + +The `centralized-sequencer` node reports Prometheus metrics when the `-metrics` flag is enabled. + +By default, metrics are exported to `http://localhost:8080/metrics`. + +The listening address and port can be configured with the `-metrics-address` flag. + +The following metrics are available: + +| **Name** | **Type** | **Tags** | **Description** | +|-------------------------------------------|-----------|-----------|------------------------------------------------------------------------| +| sequencer_gas_price | Gauge | | Gas price of the DA transaction | +| sequencer_last_blob_size | Gauge | | Last blob size submitted to the DA | +| sequencer_transaction_status | Gauge | | Transaction status of the DA transaction | +| sequencer_num_pending_blocks | Gauge | | Number of blocks pending DA submission | +| sequencer_included_block_height | Gauge | | Block height of the last DA transaction | diff --git a/guides/metrics.md b/guides/metrics.md new file mode 100644 index 000000000..d0f1e881c --- /dev/null +++ b/guides/metrics.md @@ -0,0 +1,71 @@ +# How to configure metrics + +Rollkit can report and serve the Prometheus metrics, which in their turn can +be consumed by Prometheus collector(s). + +This functionality is disabled by default. + +To enable the Prometheus metrics, set `instrumentation.prometheus=true` in your +CometBFT node's [config file](https://docs.cometbft.com/v0.38/core/configuration) +located at `$CMTHOME/config/config.toml`. + +Metrics will be served under `/metrics` on 26660 port by default. +The listening address (default: `localhost:26660`) can be changed in the config file using +`instrumentation.prometheus_listen_addr`. + +## List of available metrics + +The following metrics are available, grouped by their subsystem: + +### ABCI + +| Name | Type | Tags | Description | +|----------------------------------------------|-----------|-----------------------------|--------------------------------------------| +| cometbft_abci_connection_method_timing_seconds | Histogram | chain_id, method, type | Timing for each ABCI method. | + +### sequencer + +| Name | Type | Tags | Description | +|--------------------------------------|-------|----------|------------------------------| +| cometbft_sequencer_height | Gauge | chain_id | Height of the chain. | +| cometbft_sequencer_num_txs | Gauge | chain_id | Number of transactions. | +| cometbft_sequencer_block_size_bytes | Gauge | chain_id | Size of the block. | +| cometbft_sequencer_total_txs | Gauge | chain_id | Total number of transactions. | +| cometbft_sequencer_latest_block_height | Gauge | chain_id | The latest block height. | + +### mempool + +| Name | Type | Tags | Description | +|------------------------------------------|-----------|----------|--------------------------------------------------------------------------------| +| cometbft_mempool_size | Gauge | chain_id | Size of the mempool (number of uncommitted transactions). | +| cometbft_mempool_size_bytes | Gauge | chain_id | Total size of the mempool in bytes. | +| cometbft_mempool_tx_size_bytes | Histogram | chain_id | Transaction sizes in bytes. | +| cometbft_mempool_failed_txs | Counter | chain_id | Number of failed transactions. | +| cometbft_mempool_rejected_txs | Counter | chain_id | Number of rejected transactions. | +| cometbft_mempool_evicted_txs | Counter | chain_id | Number of evicted transactions. | +| cometbft_mempool_recheck_times | Counter | chain_id | Number of times transactions are rechecked in the mempool. | + +### p2p + +| Name | Type | Tags | Description | +|--------------------------------------|---------|---------------------|--------------------------------------------------| +| cometbft_p2p_peers | Gauge | chain_id | Number of peers. | +| cometbft_p2p_peer_receive_bytes_total| Counter | peer_id, chID | Number of bytes received from a given peer. | +| cometbft_p2p_peer_send_bytes_total | Counter | peer_id, chID | Number of bytes sent to a given peer. | +| cometbft_p2p_peer_pending_send_bytes | Gauge | peer_id | Pending bytes to be sent to a given peer. | +| cometbft_p2p_num_txs | Gauge | peer_id | Number of transactions submitted by each peer. | +| cometbft_p2p_message_receive_bytes_total | Counter | message_type | Number of bytes of each message type received. | +| cometbft_p2p_message_send_bytes_total | Counter | message_type | Number of bytes of each message type sent. | + +In addition to these, [go-libp2p metrics](https://github.com/libp2p/go-libp2p/tree/master/dashboards) are exported as well. + +### state + +| Name | Type | Tags | Description | +|--------------------------------------------|-----------|----------|--------------------------------------------------------------------------| +| cometbft_state_block_processing_time | Histogram | chain_id | Time spent processing FinalizeBlock. | +| cometbft_state_consensus_param_updates | Counter | chain_id | Number of consensus parameter updates returned by the application since process start. | + +## centralized-sequencer + +The `centralized-sequencer` has its own metrics and configuration, see the [centralized sequencer docs](guides/centralized-sequencer) for details. diff --git a/guides/overview.md b/guides/overview.md index 8eec07d47..6f5636d90 100644 --- a/guides/overview.md +++ b/guides/overview.md @@ -19,6 +19,7 @@ In this section, you'll find: * [Create genesis for your rollup](/guides/create-genesis) * [Restart your rollup](/guides/restart-rollup) * [Run a rollup full node](/guides/full-node) +* [Run a centralized sequencer](/guides/centralized-sequencer) * [Turn your CometBFT app into a Rollkit app](/guides/cometbft-to-rollkit) * [Use Ignite to create a Rollkit app](/guides/ignite-rollkit) * Configuration @@ -27,6 +28,7 @@ In this section, you'll find: * [Configure DA chain block sync time](/guides/da-block-time) * [Change speed of block production](/guides/block-times) * [Use lazy sequencing (aggregation)](/guides/lazy-sequencing) + * [Configure Prometheus metrics](/guides/metrics) * Integrations * [Test and deploy cosmwasm smart-contracts](/guides/cw-orch) * [Add zkML to your EVM rollup](/guides/zkml)