forked from a-gubskiy/X.Spectator
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
716 additions
and
596 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
patreon: ernado | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] | ||
github: [a-gubskiy] | ||
buy_me_a_coffee: g.andrew | ||
custom: ["http://andrew.gubskiy.com/donate"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,39 @@ | ||
# X.Spectator | ||
|
||
Framework for monitoring the state of the system and system modules. | ||
X.Spectator is a powerful library designed to help developers easily integrate real-time monitoring and analytics into their .NET applications. With X.Spectator 2.0, we introduce a range of new features and improvements that enhance performance, usability, and flexibility. | ||
|
||
More [information about library](https://andrey-gubskiy.medium.com/x-spectator-2-0-bea1c9073eab) on Medium. | ||
|
||
## Features | ||
|
||
- **Extensible API**: Flexible and extensible API, allowing for custom monitoring solutions. | ||
- **Ease of Use**: Simplified integration process with clear and concise documentation. | ||
- **Compatibility**: Seamlessly integrates with various .NET applications and services. | ||
|
||
## Installation | ||
|
||
To install X.Spectator 2.0, use the following NuGet command: | ||
|
||
```bash | ||
dotnet add package X.Spectator --version 2.0.0 | ||
``` | ||
|
||
Or add the package directly to your `csproj` file: | ||
|
||
```xml | ||
<PackageReference Include="X.Spectator" Version="2.0.0" /> | ||
``` | ||
|
||
## Contributing | ||
|
||
We welcome contributions to the X.Spectator project! If you have any ideas, bug reports, or pull requests, please visit our [GitHub repository](https://github.com/your-repo/x-spectator). | ||
|
||
1. Fork the repository. | ||
2. Create your feature branch (`git checkout -b feature/YourFeature`). | ||
3. Commit your changes (`git commit -am 'Add some feature'`). | ||
4. Push to the branch (`git push origin feature/YourFeature`). | ||
5. Create a new Pull Request. | ||
|
||
## License | ||
|
||
X.Spectator 2.0 is licensed under the MIT License. See the [LICENSE](https://github.com/ernado-x/X.Spectator/blob/master/LICENSE) file for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Example.App.Services; | ||
using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
using X.Spectator.Base; | ||
|
||
namespace Example.App.Probes | ||
namespace Example.App.Probes; | ||
|
||
/// <summary> | ||
/// Example probe | ||
/// </summary> | ||
public class LibraryServiceProbe : IProbe | ||
{ | ||
/// <summary> | ||
/// Example probe | ||
/// </summary> | ||
public class LibraryServiceProbe : IProbe | ||
{ | ||
private readonly LibraryService _service; | ||
private readonly int _minimumBookCount; | ||
private readonly LibraryService _service; | ||
private readonly int _minimumBookCount; | ||
|
||
public string Name => "Library Service Probe"; | ||
public string Name => "Library Service Probe"; | ||
|
||
public LibraryServiceProbe(LibraryService service, int minimumBookCount) | ||
{ | ||
_service = service; | ||
_minimumBookCount = minimumBookCount; | ||
} | ||
public LibraryServiceProbe(LibraryService service, int minimumBookCount) | ||
{ | ||
_service = service; | ||
_minimumBookCount = minimumBookCount; | ||
} | ||
|
||
public Task<ProbeResult> Check() | ||
public Task<ProbeResult> Check() | ||
{ | ||
var result = new ProbeResult | ||
{ | ||
var result = new ProbeResult | ||
{ | ||
Time = DateTime.UtcNow, | ||
ProbeName = this.Name, | ||
Success = false | ||
}; | ||
Time = DateTime.UtcNow, | ||
ProbeName = Name, | ||
Status = HealthStatus.Unhealthy | ||
}; | ||
|
||
try | ||
{ | ||
if (_service.TotalBookCount > _minimumBookCount) | ||
{ | ||
result.Success = true; | ||
} | ||
} | ||
catch (Exception ex) | ||
try | ||
{ | ||
if (_service.TotalBookCount > _minimumBookCount) | ||
{ | ||
result.Exception = ex; | ||
result.Data = ex.Message; | ||
result.Status = HealthStatus.Healthy; | ||
} | ||
|
||
return Task.FromResult(result); | ||
} | ||
catch (Exception ex) | ||
{ | ||
result.Exception = ex; | ||
result.Data = new Dictionary<string, object>{{"exception-message", ex.Message}}; | ||
} | ||
|
||
return Task.FromResult(result); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.