Welcome to Soenneker.Extensions.ServiceCollection.ApplicationInsights! This repository offers a collection of useful IServiceCollection
extension methods that simplify the integration of Application Insights into your .NET applications.
- Simplified Integration: Easily add Application Insights to your .NET applications.
- Flexible Configuration: Customize your telemetry settings with minimal effort.
- Extensible: Extend the functionality as per your application's needs.
- Support for JWT: Includes methods for JWT authentication and telemetry.
To get started, you can download the latest release from the Releases section. Make sure to download the appropriate package and execute it in your project.
You can also install the package via NuGet. Run the following command in your Package Manager Console:
Install-Package Soenneker.Extensions.ServiceCollection.ApplicationInsights
Integrating Application Insights into your application is straightforward. Here’s a simple example of how to use the extension methods provided in this repository.
In your Startup.cs
or wherever you configure your services, add the following:
public void ConfigureServices(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration["ApplicationInsights:InstrumentationKey"]);
// Additional services can be added here
}
You can utilize the provided extension methods to add more telemetry features. Here’s an example:
public void ConfigureServices(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration["ApplicationInsights:InstrumentationKey"]);
// Adding custom telemetry
services.AddTelemetryServices();
}
To send custom telemetry data, you can create a service that uses the telemetry client:
public class CustomTelemetryService
{
private readonly TelemetryClient _telemetryClient;
public CustomTelemetryService(TelemetryClient telemetryClient)
{
_telemetryClient = telemetryClient;
}
public void TrackEvent(string eventName)
{
_telemetryClient.TrackEvent(eventName);
}
}
Here are some of the key extensions available in this repository:
- AddTelemetryServices: Adds essential telemetry services to the service collection.
- AddJwtTelemetry: Configures telemetry for JWT authentication.
- AddCustomTelemetry: Allows you to send custom telemetry data easily.
We welcome contributions! If you want to improve this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes.
- Write tests for your changes.
- Submit a pull request.
For detailed guidelines, please check the CONTRIBUTING.md
file in the repository.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or suggestions, feel free to reach out to the maintainer:
- Name: Navya Gannavarapu
- Email: navya@example.com
- GitHub: Navya-Gannavarapu
Thank you for checking out Soenneker.Extensions.ServiceCollection.ApplicationInsights! For more information and updates, visit the Releases section.