Developers

Monitoring

My computers, health, status, metrics and logs.

Updated:

My computers

In your Account, every container or pod shows up in My computers as a computer labeled Server, with the name of the token it connected with. There you see its state (sharing, paused or off) and what it has earned, and you can remove it.

Health and status

Path (port 9090)Answers
/healthzThe process is alive. Use it for liveness.
/readyzConnected to the network and engine ready. Use it for readiness.
/statusStatus as JSON with no personal data: version, variant, accelerator (accel), connection, engine, in-flight requests and models.
/metricsMetrics in Prometheus text format.

With the port published on the loopback interface only (-p 127.0.0.1:9090:9090):

bash
curl -s http://127.0.0.1:9090/healthz
curl -s http://127.0.0.1:9090/readyz
curl -s http://127.0.0.1:9090/status
curl -s http://127.0.0.1:9090/metrics

Metrics

MetricWhat it measures
piap_node_info{version,variant,accel}Version, image variant and detected accelerator (always 1).
piap_node_connected1 when connected to the network.
piap_node_sharing1 when sharing (not paused or outside the schedule).
piap_node_engine_ready1 when the model engine is ready.
piap_node_jobs_in_flightIn-flight requests.
piap_node_tokens_todayTokens generated today for the network (UTC day).
piap_node_daily_token_budgetConfigured daily cap (PIAP_DAILY_TOKENS); 0 = no cap.
piap_node_models_installedModels installed on the volume.
piap_node_uptime_secondsSeconds since start.

Scraping with Prometheus, with static targets and with pod discovery on Kubernetes (with the chart, metrics.serviceMonitor.enabled=true creates a ServiceMonitor):

yaml
scrape_configs:
  - job_name: piap-node
    scrape_interval: 30s
    static_configs:
      - targets:
          - 10.0.10.21:9090
          - 10.0.10.22:9090
  - job_name: piap-node-k8s
    kubernetes_sd_configs:
      - role: pod
        namespaces:
          names: ["piap"]
    relabel_configs:
      - source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_name]
        regex: piap-node
        action: keep
      - source_labels: [__meta_kubernetes_pod_container_port_number]
        regex: "9090"
        action: keep

Some useful alerts:

yaml
groups:
  - name: piap-node
    rules:
      - alert: PiapNodeDisconnected
        expr: piap_node_connected == 0
        for: 10m
      - alert: PiapNodeEngineNotReady
        expr: piap_node_engine_ready == 0
        for: 15m
      - alert: PiapNodeDailyBudgetReached
        expr: piap_node_daily_token_budget > 0 and piap_node_tokens_today >= piap_node_daily_token_budget
        for: 5m

Logs

Logs go to standard output as JSON and never include request content, the token or personal data. Ship them to your logging system like any other container.