@@ -24,8 +24,8 @@ This package currently supports:
2424- ** Resilience Pipelines** for ` HttpClient ` operations.
2525- ** Controller Extensions** for mapping old-style MVC controllers.
2626- ** SignalR Extensions** for adding simple SignalR or distributed SignalR backed with Redis.
27- - ** OpenTelemetry Integration ** for tracking metrics , traces, and logging .
28- - ** Health Checks** with default endpoints and startup validation .
27+ - ** OpenTelemetry** : Metrics , traces, and logs with Prometheus support .
28+ - ** Health Checks** : Startup validation and endpoints for monitoring .
2929- Various ** Extensions and Utilities** , including enumerable, string, and queryable extensions.
3030
3131## Prerequisites
162162 .UseResponseCrafter ()
163163 .UseCors ()
164164 .MapMinimalApis ()
165- .MapDefaultEndpoints ()
166165 .EnsureHealthy ()
166+ .MapHealthCheckEndpoints ()
167+ .MapPrometheusExporterEndpoints ()
167168 .ClearAssemblyRegistry ()
168169 .UseOpenApi ()
169170 .MapControllers ();
@@ -422,7 +423,7 @@ The package includes extension methods to simplify common validation scenarios:
422423- File Validations:
423424 - HasMaxFileSize(maxFileSizeInMb): Validates that an uploaded file does not exceed the specified maximum size.
424425 - FileTypeIsOneOf(allowedFileExtensions): Validates that the uploaded file has one of the allowed file
425- extensions.
426+ extensions.
426427- String Validations:
427428 - IsValidJson(): Validates that a string is a valid JSON.
428429 - IsXssSanitized(): Validates that a string is sanitized against XSS attacks.
@@ -545,45 +546,43 @@ app.MapControllers();
545546app .Run ();
546547```
547548
548- ## OpenTelemetry
549+ ## Telemetry Integration
549550
550- Use ` builder.AddOpenTelemetry() ` to add OpenTelemetry to your project. This will track metrics, traces, and logging at
551- runtime, including ASP.NET Core and ` HttpClient ` operations.
552-
553- Example:
554-
555- ``` csharp
556- var builder = WebApplication .CreateBuilder (args );
557- builder .AddOpenTelemetry ();
558- ```
551+ Integrate OpenTelemetry for observability, including metrics, traces, and logging:
552+ 1 . Setup:
553+ ``` csharp
554+ var builder = WebApplication .CreateBuilder (args );
555+ builder .AddOpenTelemetry ();
556+ var app = builder .Build ();
557+ app .MapPrometheusExporterEndpoints ();
558+ app .Run ();
559+ ```
560+ 2 . Prometheus Endpoints :
561+ - Metrics : `url / above - board / metrics `
562+ - Health Metrics : `url / above - board / metrics / health `
563+ 3 . Included Features :
564+ - ASP .NET Core metrics
565+ - HTTP client telemetry
566+ - Distributed tracing
567+ - Logging
568+ - Prometheus exporter
559569
560570## HealthChecks
561-
562- The ` app.EnsureHealthy() ` extension method performs a health check at startup and will terminate the application if it
563- is not healthy.
571+ - ** Startup Validation : ** `app .EnsureHealthy ()` performs a health check at startup and terminates the application if it
572+ is not healthy .
573+ - **Endpoints Mapping : ** `app .MapHealthCheckEndpoints ()` maps default health check endpoints to the application .
574+ - ** Mapped Endpoints : **
575+ - Ping Endpoint : `url / above - board / ping `
576+ - Health Check Endpoint : `url / above - board / health `
564577
565578Example :
566-
567579```csharp
568580var app = builder .Build ();
569- app .EnsureHealthy ();
570- ```
571-
572- ### Default Endpoints
573-
574- To map default endpoints, use ` app.MapDefaultEndpoints() ` . This will add the following endpoints:
575-
576- - Ping Endpoint: ` url/above-board/ping `
577- - Health Check Endpoint: ` url/above-board/health `
578- - Prometheus Metrics Endpoint: ` url/above-board/metrics `
579- - Prometheus Health Metrics Endpoint: ` url/above-board/metrics/health `
580581
581- > Note: To use Prometheus endpoints, you need to apply ` OpenTelemetry ` as well.
582+ app .EnsureHealthy (); // Startup validation
583+ app .MapHealthCheckEndpoints (); // Map health check routes
582584
583- Example:
584-
585- ``` csharp
586- app .MapDefaultEndpoints ();
585+ app .Run ();
587586```
588587
589588## Additional Extensions and NuGet Packages
0 commit comments