https://github.com/telexintegrations/telexapm-for-dotnet
π Telex APM β Global Error Tracking & Performance Monitoring for .NET. Lightweight APM SDK for .NET applications (ASP.NET Core & standalone C#). Tracks errors & performance automatically. π
https://github.com/telexintegrations/telexapm-for-dotnet
Last synced: over 1 year ago
JSON representation
π Telex APM β Global Error Tracking & Performance Monitoring for .NET. Lightweight APM SDK for .NET applications (ASP.NET Core & standalone C#). Tracks errors & performance automatically. π
- Host: GitHub
- URL: https://github.com/telexintegrations/telexapm-for-dotnet
- Owner: telexintegrations
- Created: 2025-02-18T21:12:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-23T16:24:21.000Z (over 1 year ago)
- Last Synced: 2025-02-23T17:30:28.233Z (over 1 year ago)
- Language: C#
- Size: 48.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TelexAPM SDK for c#(dotnet)
## Overview
π Telex APM β Global Error Tracking & Performance Monitoring for .NET. Lightweight APM SDK for .NET applications (ASP.NET Core & standalone C#). Tracks errors & performance automatically. π
## Features
- π Global Error Tracker/Reporting to Telex Channel
- β
Performance Tracker/Reporting to Telex Channel
- π§ͺ Unit test coverage
- π SDK documentation
- π ASP.NET Core Extensions and Middleware (Supports Dependency Injection)
## Project Structure
```
telexapm-for-dotnet/
βββ TelexAPM/
β βββ Extensions/ #ASP.NET Core Extensions
β β βββ AddTelex.cs #Service Registration for containers - DI injections
β β βββ AspNetCoreExtensions.cs #Configure to UseTelex middleware
β β βββTelexMiddleware.cs
β β
β βββ Models/ #Models for Data to be sent
β β βββ ErrorReport.cs
β β βββ PerformanceReport.cs
β β βββ SuccessReport.cs
β β βββ WebhookPayload.cs
β β
β βββ Services/ #MTelex APM Core Services
β β βββ BaseTracker.cs #Internal - Clients should not access this directly
β β βββ ErrorTracker.cs #Internal - Clients should not access this directly
β β βββ PerformanceTracker.cs #Internal - Clients should not access this directly
β β βββ TelexClient.cs #Public API - Accessible to Clients
| |
| βββ TelexAPM.ConsoleTest/ #Models for Data to be sent
β β βββ appsettings.json
β β βββ Program.cs
β β βββ TelexApm.ConsoleTest.csproj
β βββ TelexAPM.csproj
β
βββ TelexAPM.Tests/
β βββ TelexMiddlewareTest.cs # API endpoint tests
β βββ TelexAPM.Test.csproj
βββ telexAPM-for-dotnet.sln # telexAPM-for-dotnet.sln
βββ README.md
```
## Technologies Used
- C#
- ASP.NET Core
- XUnit
## Installation
### Step 1: Add TelexAPM Reference to Your Project
Since Telex is currently in build mode - this SDK is not yet published to NuGet, you'll need to reference it directly from GitHub in your project file.
```bash
git clone https://github.com/telexintegrations/telexAPM-for-dotnet.git
cd telexAPM-for-dotnet
```
### Step 2: Reference TelexAPM in Your Project
-Add a reference to TelexAPM in your project file:
Project Reference (preferred during development)
In your .csproj file, add:
```xml
```
You can check the csproj file in the TelexAPM.ConsoleTest Directory
### Step 3: Configure TelexAPM
Configuration in appsettings.json
Add the following section to your appsettings.json file:
```json
{
"Telex": {
"BaseUrl": "ping.telex.im/v1/webhooks", #this must be telex base-url for channels
"ChannelHookId": "YOUR_CHANNEL_HOOK_ID"
}
}
```
- Usage
- Console Applications
```cs
using TelexAPM.Services;
using Microsoft.Extensions.Configuration;
class Program
{
static async Task Main(string[] args)
{
// Config builder - setting appsettings as config file
var Config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.Build();
TelexConfiguration telexConfig = GetTelexConfig(Config);
await Test(telexConfig);
}
public static async Task Test(TelexConfiguration telexConfig)
{
TelexClient telex = new(telexConfig);
var x = new Exception("Console Test Telex Error");
await telex.TrackErrorAsync(x);
Console.WriteLine("test done");
}
public static TelexConfiguration GetTelexConfig(IConfigurationRoot config)
{
TelexConfiguration telexConfig = new()
{
BaseUrl = config["Telex:BaseUrl"],
ChannelHookId = config["Telex:ChannelHookId"],
};
return telexConfig;
}
}
```
- Usage
- ASP.NET cORE applications:
Step 1: Register TelexAPM Services
In your Program.cs or Startup.cs, add TelexAPM services:
```cs
using TelexApm.Extensions;
// ...
services.AddTelex(Configuration); // Dependency Container
```
Step 2: Use TelexAPM Middleware
Add the TelexAPM middleware to your application pipeline:
```cs
using TelexAPM.Extensions;
// ...
app.UseTelex();
```
## API Reference
### TelexClient
The main client for interacting with TelexAPM.
```cs
// Create a new TelexClient
TelexClient telex = new(telexConfig);
// Track an error
await telex.TrackErrorAsync(exception);
// Track performance
await telex.TrackPerformanceAsync("Operation Name", timeSpan);
```
### TelexConfiguration
| Property | Description |
| --------------- | ---------------------------------------- |
| `BaseUrl` | The base URL of the Telex service |
| `ChannelHookId` | The channel hook ID for your application |
## Test Integration (HNG Mentors)
To test the integration, follow these steps:
### 1. Navigate to the Console Test Folder
Open a terminal and change the directory to the `TelexAPM.ConsoleTest` folder:
```sh
cd TelexAPM/TelexAPM.ConsoleTest
```
### 2. Create the `appsettings.json` File
Inside the `TelexAPM.ConsoleTest` folder, create a file named `appsettings.json` and add the following content:
Run the following command in your terminal to create and edit the file:
```sh
nano appsettings.json
```
Then, paste the following JSON configuration:
```json
{
"Telex": {
"BaseUrl": "ping.telex.im/v1/webhooks", #this must be telex base-url for channels
"ChannelHookId": "YOUR_CHANNEL_HOOK_ID"
}
}
```
Replace "YOUR_CHANNEL_HOOK_ID" with the actual channel hook ID.
### 3. Run the Application
Once the `appsettings.json` file is in place, execute the following command to run the console test:
```sh
dotnet run
```
## Telex Integration/Channel Configuration
TelexAPM includes extensions for easy integration with ASP.NET Core applications and Standalone applications
The APM automatically tracks request performance and catches unhandled exceptions and report/sends to your Telex Channel
## πΈ Screenshots
### Test Code

### Message Screenshot In Telex

## π Telex Dotnet APM Integration Guide
Follow these steps to configure your Telex channel to use the Dotnet APM:
This assumes you have an organisation and channel created!
---
### π οΈ Step 1: Install the Dotnet APM Application
- Go to your **Telex dashboard**.
- Install the **Dotnet APM** application:
- The application url: https://dotnet-apm.onrender.com
- The application integration json url: https://dotnet-apm.onrender.com/integration.json
- The application target url: https://dotnet-apm.onrender.com/target_url (This url will be called by telex)
---
### βοΈ Step 2: Update the Webhook URL
- After installation, update the `webhookUrl` in the application settings to your **output webhook** (where you want Telex to send your messages).
---
### π§ Step 3: Activate/Configure Your Channel
- Activate and configure your channel to use the **Dotnet APM**.
---
### π Step 4: You're Done!
- **Voila!** π Your Telex APM setup is now complete.
## Additional Resources
- π [TelexAPM Documentation](https://docs.telex.im/docs)
- π [.NET Configuration Documentation](https://dotnet.microsoft.com/en-us/apps/aspnet)
## Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit changes (`git commit -m 'Add AmazingFeature'`)
4. Push to branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Support
For support, please open an issue in the GitHub repository.