Monitor
The blokctl monitor command provides real-time visibility into your Blok applications through a metrics dashboard. It offers both terminal-based and web-based interfaces, allowing you to monitor application performance, request counts, error rates, and resource usage.
This powerful observability tool connects to Prometheus metrics, making it easy to track the health and performance of your bloks whether they're running locally or deployed to the cloud.
Monitor Blok Metrics
Syntax
npx blokctl@latest monitor [options]Displays real-time metrics for your Blok application.
Options
| Option | Type | Description | Default |
|---|---|---|---|
--web | boolean | Launch web-based dashboard instead of terminal UI | false |
--host | string | Prometheus server URL | Local Prometheus URL |
--token | string | Bearer token for authenticated Prometheus access | None |
--help | boolean | Show help | false |
Examples
Monitor with Terminal UI (Local Development)
npx blokctl@latest monitorMonitor with Web Dashboard (Local Development)
npx blokctl@latest monitor --webConnect to Public Prometheus Instance
npx blokctl@latest monitor --host <PROMETHEUS_URL>Connect to Private Prometheus Instance with Authentication
npx blokctl@latest monitor --web --host <PROMETHEUS_URL> --token <AUTH_TOKEN>Setting Up Local Monitoring Environment
To use the monitor command with a local project:
-
Create a new project if you don't have one:
npx blokctl@latest create project -
Start the local observability stack:
docker-compose -f infra/metrics/docker-compose.yml up -d -
Run your nanoservice application with docker:
# Open a terminal and run npm run infra:dev # Open a second terminal and run npm run infra:build -
Launch the monitor:
npx blokctl@latest monitor
Monitoring Cloud Deployments
After deploying your nanoservice to Deskree Cloud:
-
Retrieve the Prometheus URL from your deployment information.
-
Generate an access token from https://atomic.deskree.com.
-
Run the monitor with the cloud Prometheus URL:
npx blokctl@latest monitor --web --host <PROMETHEUS_URL> --token <AUTH_TOKEN>
Key Metrics Displayed
The monitor dashboard displays several important metrics:
- Request counts by endpoint
- Response times
- Error rates
- Resource usage per module
- Historical trends (web UI only)
These metrics help you identify bottlenecks, troubleshoot issues, and optimize your nanoservice performance.