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

# Tenants

> Monitor LLM usage and costs per customer with Netra tenant observability. Isolate traces, track spending, and enforce SLAs across your customer base.

If you're building AI-powered products for multiple customers, Netra's tenant tracking gives you complete visibility into how each customer uses your platform. This is a unique capability that lets multi-tenant partners monitor, debug, and optimize AI interactions on a per-customer basis.

## Why Tenant Tracking Matters

For platforms serving multiple customers, understanding per-tenant behavior is critical:

* **Usage Attribution**: Know exactly which customer is driving costs, token consumption, and API calls
* **Customer Support**: When a customer reports an issue, instantly access their specific traces without sifting through logs
* **SLA Monitoring**: Track performance metrics per tenant to ensure service level agreements are met
* **Cost Allocation**: Generate accurate billing reports based on actual LLM usage per customer
* **Anomaly Detection**: Identify unusual patterns in specific tenant activity before they become problems

## Setting Up Tenant Tracking

Associate traces with tenants by calling `set_tenant_id` in your application code:

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

  # Set tenant context - all subsequent traces will be associated with this tenant
  Netra.set_tenant_id("acme-corp")

  # Your LLM calls are now attributed to "acme-corp"
  response = client.chat.completions.create(
      model="gpt-4",
      messages=[{"role": "user", "content": "Hello"}]
  )
  ```

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

  // Set tenant context - all subsequent traces will be associated with this tenant
  Netra.setTenantId("acme-corp");

  // Your LLM calls are now attributed to "acme-corp"
  const response = await client.chat.completions.create({
      model: "gpt-4",
      messages: [{ role: "user", content: "Hello" }]
  });
  ```
</CodeGroup>

<Tip>
  Set the tenant ID early in your request lifecycle, typically in middleware or at the start of request handling, to ensure all traces within that request are properly attributed.
</Tip>

## View Tenants List

The **Tenants** view provides a centralized dashboard of all customers whose activity you monitor.

Navigate to **Observability → Tenants** from the left navigation menu.

<video autoPlay muted loop playsInline className="w-full aspect-video rounded-xl" src="https://mintcdn.com/netra/XTkLfH0aAT4vWndN/videos/tenant_list_gif.mp4?fit=max&auto=format&n=XTkLfH0aAT4vWndN&q=85&s=34447c18d4b0210e77d44816559a966d" data-path="videos/tenant_list_gif.mp4" />

### Available Controls

| Control          | Description                                                            |
| ---------------- | ---------------------------------------------------------------------- |
| **Search**       | Locate tenants by name using the search bar                            |
| **Time Range**   | Filter tenant-level metrics based on a predefined or custom date range |
| **Sort by Cost** | Quickly identify high-usage or high-spend customers                    |

### Tenant List Columns

| Column       | Description                                                                       |
| ------------ | --------------------------------------------------------------------------------- |
| **Tenant**   | The unique identifier of the end customer                                         |
| **Sessions** | Total number of sessions generated for this tenant within the selected time range |
| **Traces**   | Total number of traces recorded for this tenant                                   |
| **Cost**     | Aggregated token cost attributed to this tenant                                   |
| **Actions**  | View Traces button to drill down into tenant-specific data                        |

<Info>
  Clicking **View Traces** navigates to the [Traces view](/Observability/Traces/overview), automatically filtered to display only the traces associated with that specific tenant.
</Info>

## Use Cases

### Customer Support

When a customer reports an issue:

1. Search for their tenant ID in the Tenants view
2. Click **View Traces** to see all their recent activity
3. Identify the problematic trace and investigate the root cause

### Usage-Based Billing

Generate accurate invoices by:

1. Filtering the Tenants view by your billing period
2. Exporting cost data per tenant
3. Attributing LLM costs directly to each customer

### Performance Benchmarking

Compare performance across your customer base:

1. Sort tenants by trace count or cost
2. Identify outliers in latency or error rates
3. Proactively reach out to customers experiencing issues

## Related

* [Users](/Observability/Users) - Track individual user activity within tenants
* [Sessions](/Observability/Session) - Group related interactions into sessions
* [Traces Overview](/Observability/Traces/overview) - Deep dive into individual trace analysis
