Blok Logo
CLI Reference

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

OptionTypeDescriptionDefault
--webbooleanLaunch web-based dashboard instead of terminal UIfalse
--hoststringPrometheus server URLLocal Prometheus URL
--tokenstringBearer token for authenticated Prometheus accessNone
--helpbooleanShow helpfalse

Examples

Monitor with Terminal UI (Local Development)

npx blokctl@latest monitor

Monitor with Web Dashboard (Local Development)

npx blokctl@latest monitor --web

Connect 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:

  1. Create a new project if you don't have one:

    npx blokctl@latest create project
  2. Start the local observability stack:

    docker-compose -f infra/metrics/docker-compose.yml up -d
  3. 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
  4. Launch the monitor:

    npx blokctl@latest monitor

Monitoring Cloud Deployments

After deploying your nanoservice to Deskree Cloud:

  1. Retrieve the Prometheus URL from your deployment information.

  2. Generate an access token from https://atomic.deskree.com.

  3. 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.