diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-07-29 02:29:02 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2025-07-29 02:29:02 +0300 |
| commit | 72c6399ec345ec26bd7f79651667ffa585474919 (patch) | |
| tree | 687a6c9bb850b4568d1718aa51add12327737a7d /Software/Visual_Studio/Tango.Telemetry/TelemetryPublisherConfiguration.cs | |
| parent | 3f86a214b4459e619a5a767369b996e56cd17564 (diff) | |
| download | Tango-72c6399ec345ec26bd7f79651667ffa585474919.tar.gz Tango-72c6399ec345ec26bd7f79651667ffa585474919.zip | |
Telemetry
Diffstat (limited to 'Software/Visual_Studio/Tango.Telemetry/TelemetryPublisherConfiguration.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Telemetry/TelemetryPublisherConfiguration.cs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Software/Visual_Studio/Tango.Telemetry/TelemetryPublisherConfiguration.cs b/Software/Visual_Studio/Tango.Telemetry/TelemetryPublisherConfiguration.cs index 56f826591..da5856848 100644 --- a/Software/Visual_Studio/Tango.Telemetry/TelemetryPublisherConfiguration.cs +++ b/Software/Visual_Studio/Tango.Telemetry/TelemetryPublisherConfiguration.cs @@ -26,8 +26,32 @@ namespace Tango.Telemetry public void Validate() { - if (!MachineID.IsNotNullOrEmpty()) throw new ArgumentNullException($"{nameof(MachineID)} is not set."); - if (!Environment.IsNotNullOrEmpty()) throw new ArgumentNullException($"{nameof(Environment)} is not set."); + if (!MachineID.IsNotNullOrEmpty()) + throw new ArgumentNullException(nameof(MachineID), "MachineID is not set or empty."); + + if (!Environment.IsNotNullOrEmpty()) + throw new ArgumentNullException(nameof(Environment), "Environment is not set or empty."); + + if (!Enum.IsDefined(typeof(MachineTypes), MachineType)) + throw new ArgumentOutOfRangeException(nameof(MachineType), "MachineType is not a valid enum value."); + + if (DiagnosticsSamplingInterval.TotalSeconds < 1) + throw new ArgumentOutOfRangeException(nameof(DiagnosticsSamplingInterval), "DiagnosticsSamplingInterval must be at least 1 second."); + + if (PendingStorageCheckInterval.TotalSeconds < 5) + throw new ArgumentOutOfRangeException(nameof(PendingStorageCheckInterval), "PendingStorageCheckInterval must be at least 5 seconds."); + + if (TelemetryDestinations == null || TelemetryDestinations.Count == 0) + throw new InvalidOperationException("At least one telemetry destination must be provided."); + + foreach (var destination in TelemetryDestinations) + { + if (destination == null) + throw new InvalidOperationException("Telemetry destination list contains a null entry."); + + if (destination.SupportedSources == null || destination.SupportedSources.Count == 0) + throw new InvalidOperationException($"Telemetry destination '{destination.Name}' has no supported sources defined."); + } } } } |
