# Microsoft.ApplicationInsights.AspNetCore

**Kind:** Service

**Source:** `Pams/Web/Pams.Web/Pams.Web.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`Microsoft.ApplicationInsights.AspNetCore` is a NuGet package dependency in `Pams.Web.csproj` that adds Application Insights telemetry support to the ASP.NET Core web application. It records request, dependency, exception, and trace telemetry from server-side application code and sends it to the configured Application Insights resource.

## Diagram

```mermaid
sequenceDiagram
    participant Client as JavaScript Client
    participant Web as Pams.Web ASP.NET Core
    participant AI as Application Insights

    Client->>Web: HTTP request
    Web->>AI: Record request telemetry
    Web->>Web: Process endpoint logic
    Web->>AI: Record dependencies, traces, or exceptions
    Web-->>Client: HTTP response
```

## Usage

```ts
async function loadPamsData() {
  const response = await fetch("/api/pams");

  if (!response.ok) {
    throw new Error(`Request failed: ${response.status}`);
  }

  return response.json();
}

loadPamsData().catch((error) => {
  console.error("Pams API request failed", error);
});
```

## AI Coding Instructions

- Keep `Microsoft.ApplicationInsights.AspNetCore` configured from the ASP.NET Core application startup path, not from browser code.
- Use application logging and exception handling so server-side failures are available as Application Insights telemetry.
- Preserve request correlation headers when adding outbound HTTP calls or proxy endpoints.
- Avoid sending secrets, access tokens, or personal data in telemetry properties, log messages, or exception text.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `Pams.Web` — `Pams/Web/Pams.Web/Pams.Web.csproj`:1
