-
Notifications
You must be signed in to change notification settings - Fork 2
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
5 changed files
with
23 additions
and
222 deletions.
There are no files selected for viewing
49 changes: 0 additions & 49 deletions
49
src/DiscordTranslationBot/Telemetry/TelemetryEndpointOptions.cs
This file was deleted.
Oops, something went wrong.
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,41 +1,14 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using DiscordTranslationBot.Extensions; | ||
namespace DiscordTranslationBot.Telemetry; | ||
|
||
namespace DiscordTranslationBot.Telemetry; | ||
|
||
public sealed class TelemetryOptions : IValidatableObject | ||
internal sealed class TelemetryOptions | ||
{ | ||
/// <summary> | ||
/// Configuration section name for <see cref="TelemetryOptions" />. | ||
/// </summary> | ||
public const string SectionName = "Telemetry"; | ||
|
||
/// <summary> | ||
/// The endpoint options for metrics. | ||
/// Flag indicating whether telemetry is enabled. | ||
/// </summary> | ||
public TelemetryEndpointOptions MetricsEndpoint { get; init; } = new(); | ||
|
||
/// <summary> | ||
/// The endpoint options for logging. | ||
/// </summary> | ||
public TelemetryEndpointOptions LoggingEndpoint { get; init; } = new(); | ||
|
||
/// <summary> | ||
/// The endpoint options for tracing. | ||
/// </summary> | ||
public TelemetryEndpointOptions TracingEndpoint { get; init; } = new(); | ||
|
||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | ||
{ | ||
MetricsEndpoint.TryValidate(out var metricsEndpointValidationResults); | ||
LoggingEndpoint.TryValidate(out var loggingEndpointValidationResults); | ||
TracingEndpoint.TryValidate(out var tracingEndpointValidationResults); | ||
|
||
return | ||
[ | ||
..metricsEndpointValidationResults, | ||
..loggingEndpointValidationResults, | ||
..tracingEndpointValidationResults | ||
]; | ||
} | ||
public bool Enabled { get; init; } | ||
} |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
"Microsoft.Hosting.Lifetime": "Information" | ||
} | ||
} | ||
} | ||
} |
97 changes: 0 additions & 97 deletions
97
tests/DiscordTranslationBot.Tests.Unit/Telemetry/TelemetryOptionsTests.cs
This file was deleted.
Oops, something went wrong.