@@ -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
@@ -120,13 +120,12 @@ Follow this example to set up your project with all the features provided by thi
120120 }
121121 }
122122 },
123+ "ResponseCrafterVisibility" : " Private" ,
124+ "DefaultTimeZone" : " Caucasus Standard Time" ,
123125 "RepositoryName" : " be-lib-sharedkernel" ,
124126 "ConnectionStrings" : {
125127 "Redis" : " localhost:6379" ,
126128 "PersistentStorage" : " /persistence"
127- },
128- "Security" : {
129- "AllowedCorsOrigins" : " https://example.com,https://api.example.com"
130129 }
131130}
132131```
163162 .UseResponseCrafter ()
164163 .UseCors ()
165164 .MapMinimalApis ()
166- .MapDefaultEndpoints ()
167165 .EnsureHealthy ()
166+ .MapHealthCheckEndpoints ()
167+ .MapPrometheusExporterEndpoints ()
168168 .ClearAssemblyRegistry ()
169169 .UseOpenApi ()
170170 .MapControllers ();
@@ -422,12 +422,11 @@ The package includes extension methods to simplify common validation scenarios:
422422
423423- File Validations:
424424 - HasMaxFileSize(maxFileSizeInMb): Validates that an uploaded file does not exceed the specified maximum size.
425- - FileTypeIsOneOf(allowedFileExtensions): Validates that the uploaded file has one of the allowed file
426- extensions.
425+ - FileTypeIsOneOf(allowedFileExtensions): Validates that the uploaded file has one of the allowed file
426+ extensions.
427427- String Validations:
428428 - IsValidJson(): Validates that a string is a valid JSON.
429- - IsXssSanitized(): Validates that a string is sanitized against XSS attacks.
430- -
429+ - IsXssSanitized(): Validates that a string is sanitized against XSS attacks.
431430
432431## Cors
433432
@@ -547,45 +546,43 @@ app.MapControllers();
547546app .Run ();
548547```
549548
550- ## OpenTelemetry
551-
552- Use ` builder.AddOpenTelemetry() ` to add OpenTelemetry to your project. This will track metrics, traces, and logging at
553- runtime, including ASP.NET Core and ` HttpClient ` operations.
554-
555- Example:
549+ ## Telemetry Integration
556550
557- ``` csharp
558- var builder = WebApplication .CreateBuilder (args );
559- builder .AddOpenTelemetry ();
560- ```
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
561569
562570## HealthChecks
563-
564- The ` app.EnsureHealthy() ` extension method performs a health check at startup and will terminate the application if it
565- 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 `
566577
567578Example :
568-
569579```csharp
570580var app = builder .Build ();
571- app .EnsureHealthy ();
572- ```
573-
574- ### Default Endpoints
575-
576- To map default endpoints, use ` app.MapDefaultEndpoints() ` . This will add the following endpoints:
577581
578- - Ping Endpoint: ` url/above-board/ping `
579- - Health Check Endpoint: ` url/above-board/health `
580- - Prometheus Metrics Endpoint: ` url/above-board/metrics `
581- - Prometheus Health Metrics Endpoint: ` url/above-board/metrics/health `
582+ app .EnsureHealthy (); // Startup validation
583+ app .MapHealthCheckEndpoints (); // Map health check routes
582584
583- > Note: To use Prometheus endpoints, you need to apply ` OpenTelemetry ` as well.
584-
585- Example:
586-
587- ``` csharp
588- app .MapDefaultEndpoints ();
585+ app .Run ();
589586```
590587
591588## Additional Extensions and NuGet Packages
@@ -611,4 +608,4 @@ This package includes various extensions and utilities to aid development:
611608
612609## License
613610
614- MIT License
611+ MIT License
0 commit comments