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

# Quick Start: Alerts

> Set up your first Netra alert rule in minutes. Get notified via Slack or email when your AI system exceeds cost, latency, or error rate thresholds.

This guide walks you through creating your first [alert rule](/Alert-rules/Alert-rules) to monitor your AI system and get notified when something goes wrong.

## 1. Prerequisites

Before setting up alerts, ensure you have:

* [Netra SDK installed and initialized](/quick-start/QuickStart_Tracing)
* At least one traced LLM call in your dashboard
* Access to a notification channel (Email or Slack)

## 2. Create a Contact Point

Contact points define where notifications are sent when alerts trigger.

<Steps>
  <Step title="Navigate to Settings">
    Go to **Settings → Contact Points** from the left navigation panel.
  </Step>

  <Step title="Create Contact Point">
    Click **Create Contact Point**.
  </Step>

  <Step title="Configure">
    * **Name**: Enter a descriptive name (e.g., "Engineering Alerts")
    * **Integration**: Select **Email** or **Slack**
    * **Details**: Enter email address or Slack webhook URL
  </Step>

  <Step title="Save">
    Click **Create** to save your contact point.
  </Step>
</Steps>

<Tip>
  For Slack, create an [Incoming Webhook](https://api.slack.com/messaging/webhooks) in your workspace and paste the URL.
</Tip>

## 3. Create Your First Alert Rule

<Steps>
  <Step title="Navigate to Alert Rules">
    Go to **Alert Rules** from the left navigation panel.
  </Step>

  <Step title="Create Alert Rule">
    Click **Create Alert Rule** in the top right corner.
  </Step>

  <Step title="Basic Information">
    * **Alert Name**: "High Cost Alert"
    * **Description**: "Notifies when a single request exceeds \$0.50"
  </Step>

  <Step title="Select Contact Points">
    Choose the contact point you created in Step 2.
  </Step>

  <Step title="Configure Scope">
    Select **Trace** to monitor entire requests.
  </Step>

  <Step title="Select Metric">
    Choose **Cost** to monitor token/API spend.
  </Step>

  <Step title="Set Trigger">
    * **Operator**: Greater than (>)
    * **Threshold**: 0.50
  </Step>

  <Step title="Save">
    Click **Create** to activate the alert.
  </Step>
</Steps>

## 4. Test Your Alert

Trigger a trace that exceeds your threshold:

<CodeGroup>
  ```python Python theme={null}
  from netra import Netra
  from openai import OpenAI

  Netra.init(
      app_name="alert-test",
      headers=f"x-api-key={os.getenv('NETRA_API_KEY')}",
  )

  client = OpenAI()

  # Generate a longer response to increase cost
  response = client.chat.completions.create(
      model="gpt-4",
      messages=[
          {"role": "user", "content": "Write a detailed 500-word essay about AI safety."}
      ],
  )
  ```

  ```typescript TypeScript theme={null}
  import { Netra } from "netra-sdk";
  import OpenAI from "openai";

  await Netra.init({
    appName: "alert-test",
    headers: `x-api-key=${process.env.NETRA_API_KEY}`,
  });

  const client = new OpenAI();

  // Generate a longer response to increase cost
  const response = await client.chat.completions.create({
    model: "gpt-4",
    messages: [
      { role: "user", content: "Write a detailed 500-word essay about AI safety." }
    ],
  });
  ```
</CodeGroup>

## 5. Verify Notification

After triggering a high-cost trace:

1. Check your configured contact point (email inbox or Slack channel)
2. You should receive a notification with:
   * Alert name and description
   * Triggered value (actual cost)
   * Timestamp
   * Link to the trace

<Note>
  Alerts evaluate in real-time. Notifications arrive within seconds of the threshold being breached.
</Note>

## Common Alert Examples

### Latency Alert

Monitor response time:

* **Scope**: Trace
* **Metric**: Latency
* **Trigger**: > 5000ms

### Error Rate Alert

Catch failures:

* **Scope**: Span
* **Metric**: Error
* **Trigger**: = true

### Token Usage Alert

Control token consumption:

* **Scope**: Trace
* **Metric**: Token Count
* **Trigger**: > 10000

## Troubleshooting

| Issue                     | Solution                                                     |
| ------------------------- | ------------------------------------------------------------ |
| No notifications received | Verify contact point configuration and check spam folder     |
| Alert not triggering      | Confirm threshold is lower than actual values in your traces |
| Too many alerts           | Increase threshold or add time-based aggregation             |

## Next Steps

<CardGroup cols={2}>
  <Card title="Alert Rules" icon="bell" href="/Alert-rules/Alert-rules">
    Learn advanced alert configurations
  </Card>

  <Card title="Traces" icon="route" href="/Observability/Traces/overview">
    Understand the data alerts monitor
  </Card>

  <Card title="Dashboard" icon="chart-line" href="/Dashboard/Custom-dashboard">
    View metrics to set appropriate thresholds
  </Card>

  <Card title="Tenants" icon="building" href="/Observability/Tenants">
    Monitor per-customer metrics
  </Card>
</CardGroup>
