> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nshield.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Public API Monitoring

> Metadata-only request stats, scrapeable metrics, and Firebase-compatible events for Nova public APIs.

Nova public API monitoring is built for dashboards, agents, and simple uptime checks.

The API emits one structured `api_request` event per completed request and keeps current-process counters for route volume, status codes, errors, rate limits, and latency. Events are metadata-only and do not include request bodies, query values, wallet addresses, token mints, transaction payloads, signed transactions, or secrets.

## JSON Stats

Use stats when an agent, script, or dashboard needs an easy JSON summary:

```bash theme={"dark"}
curl "https://api-nova.tech/v1/monitoring/public-api/stats?includeRecent=true&limit=20"
```

The response includes:

* Total requests, successes, errors, rate limits, and latency percentiles
* Per-route counters using stable route templates
* Error-code counts such as `RATE_LIMITED`, `NOT_FOUND`, or provider-specific public errors
* A Firebase-compatible event schema
* Optional recent sanitized events

These stats reset when the public API container restarts. For long-term history, consume the structured logs or scrape metrics into your monitoring stack.

## Metrics

Use metrics when Prometheus-compatible tooling or uptime monitors need a text endpoint:

```bash theme={"dark"}
curl "https://api-nova.tech/v1/monitoring/public-api/metrics"
```

The endpoint exposes:

* `nova_public_api_requests_total`
* `nova_public_api_errors_total`
* `nova_public_api_rate_limited_total`
* `nova_public_api_request_latency_avg_ms`
* `nova_public_api_request_latency_p95_ms`

Labels are limited to method, route template, status, status class, and error code so the series stay small and stable.

## Firebase Event Shape

Structured request logs include a Firebase-ready event:

```json theme={"dark"}
{
  "name": "api_request",
  "params": {
    "api_service": "nova_public_api",
    "api_method": "GET",
    "api_route": "/v1/data/tokens/search",
    "api_status": 200,
    "api_status_class": "2xx",
    "api_latency_ms": 42,
    "api_success": 1,
    "api_error_code": "none",
    "api_rate_bucket": "standard",
    "api_client_type": "docs",
    "api_country": "US",
    "api_edge_region": "unknown",
    "api_deploy_sha": "unknown"
  }
}
```

All event names and parameter names are lowercase, underscore-separated, and under Firebase naming limits. Keep this exact shape when forwarding logs into Firebase Analytics, BigQuery, or an AI monitoring pipeline.

## What To Watch

Practical alerts for this API:

* Error rate by `api_route` and `api_error_code`
* `RATE_LIMITED` spikes by route
* P95 latency by route
* Sudden changes in `api_client_type`
* Monitoring endpoint availability

For AI-friendly operations, fetch the stats endpoint first, then drill into route-level errors or latency before checking raw logs.
