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

# Monitoring

> Monitor SHIELD production deployment

# Monitoring

Monitor SHIELD production for issues and performance.

## Vercel Analytics

Enable in Dashboard:

* Web Vitals
* Traffic insights
* Error tracking

## Database Monitoring

### Neon Dashboard

Monitor:

* Query performance
* Connection count
* Storage usage

### Alerts

Set up alerts for:

* High latency (> 500ms)
* Connection limit
* Storage threshold

## Smart Contract Monitoring

### Tenderly

Set up [Tenderly](https://tenderly.co) for:

* Transaction monitoring
* Alert rules
* Gas usage tracking

### Custom Alerts

Watch for:

* Failed `createPolicy` calls
* Failed `logAttempt` calls
* Unusual activity patterns

## Error Tracking

### Sentry

```typescript theme={null}
// sentry.client.config.ts
import * as Sentry from '@sentry/nextjs';

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  tracesSampleRate: 1.0,
});
```

## Logging

Structured logging in API routes:

```typescript theme={null}
console.log(JSON.stringify({
  level: 'info',
  message: 'Policy created',
  policyId,
  sender,
  timestamp: new Date().toISOString(),
}));
```

## Health Checks

Create `/api/health`:

```typescript theme={null}
export async function GET() {
  // Check database
  // Check IPFS
  // Check contract

  return Response.json({
    status: 'healthy',
    timestamp: Date.now(),
    checks: {
      database: 'ok',
      ipfs: 'ok',
      contract: 'ok',
    },
  });
}
```

## Alert Thresholds

| Metric            | Warning | Critical |
| ----------------- | ------- | -------- |
| API errors        | > 1%    | > 5%     |
| Avg response time | > 500ms | > 1000ms |
| DB connections    | > 80%   | > 95%    |
| Failed txs        | > 5%    | > 10%    |

## Runbooks

Document responses to common issues:

* High error rate
* Database connection issues
* Contract call failures
* IPFS upload failures
