Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soenneker/soenneker.blazor.applicationinsights
A Blazor interop library that sets up client-side Application Insights
https://github.com/soenneker/soenneker.blazor.applicationinsights
application-insights blazor csharp dotnet interop
Last synced: about 1 month ago
JSON representation
A Blazor interop library that sets up client-side Application Insights
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.blazor.applicationinsights
- Owner: soenneker
- License: mit
- Created: 2023-01-06T01:31:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T09:10:53.000Z (2 months ago)
- Last Synced: 2024-10-29T10:59:36.005Z (2 months ago)
- Topics: application-insights, blazor, csharp, dotnet, interop
- Language: C#
- Homepage:
- Size: 308 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![](https://img.shields.io/nuget/v/Soenneker.Blazor.ApplicationInsights.svg?style=for-the-badge)](https://www.nuget.org/packages/Soenneker.Blazor.ApplicationInsights/)
[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.blazor.applicationinsights/publish-package.yml?style=for-the-badge)](https://github.com/soenneker/soenneker.blazor.applicationinsights/actions/workflows/publish-package.yml)
[![](https://img.shields.io/nuget/dt/Soenneker.Blazor.ApplicationInsights.svg?style=for-the-badge)](https://www.nuget.org/packages/Soenneker.Blazor.ApplicationInsights/)# ![](https://user-images.githubusercontent.com/4441470/224455560-91ed3ee7-f510-4041-a8d2-3fc093025112.png) Soenneker.Blazor.ApplicationInsights
### A Blazor interop library that sets up client-side Azure [Application Insights](https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview?tabs=net).## Installation
```
dotnet add package Soenneker.Blazor.ApplicationInsights
```## Usage
1. Register the interop within DI (`Program.cs`)
```csharp
public static async Task Main(string[] args)
{
...
builder.Services.AddApplicationInsights();
}
```2. Inject `IApplicationInsightsInterop` within your `App.Razor` file
```csharp
@using Soenneker.Blazor.ApplicationInsights.Abstract
@inject IApplicationInsightsInterop AppInsightsInterop
```3. Initialize the interop in `OnInitializedAsync` within `App.Razor` using your Application Insights connection string
```csharp
protected override async Task OnInitializedAsync()
{
await AppInsightsInterop.Init("your-connection-string-here");
...
}
```