blob: 07ef8061e6f10b2d4c84a6ecea781c46e1bbeb0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
using System;
using Tango.BL.Enumerations;
namespace Tango.Telemetry
{
public class TelemetryPublisherConfiguration
{
/// <summary>
/// Unique identifier of the machine sending telemetry. Used for tagging and routing.
/// </summary>
public String SerialNumber { get; set; }
/// <summary>
/// Enum representing the type of machine (e.g., X1, X4). Helps differentiate models in telemetry.
/// </summary>
public MachineTypes MachineType { get; set; }
public String Organization { get; set; }
public String Site { get; set; }
/// <summary>
/// Environment in which the telemetry is being published (e.g., Production, QA, Dev).
/// </summary>
public String Environment { get; set; }
/// <summary>
/// Interval for checking and reprocessing failed/pending telemetry from local storage.
/// </summary>
public TimeSpan PendingStorageCheckInterval { get; set; } = TimeSpan.FromMinutes(1);
/// <summary>
/// Maximum number of pending telemetry records to process in a single retry cycle.
/// </summary>
public int MaxPendingStorageTelemetriesPerCycle { get; set; } = 100;
/// <summary>
/// Frequency at which historical sources are polled to request backlogged or missed telemetry.
/// </summary>
public TimeSpan HistorySourcesRequestInterval { get; set; } = TimeSpan.FromMinutes(1);
/// <summary>
/// Maximum number of telemetry packages allowed in memory queues before rejecting new packages.
/// </summary>
public int MaxPendingTelemetries { get; set; } = 10000;
/// <summary>
/// Whether exponential backoff should be applied to retry logic per destination.
/// </summary>
public bool EnableBackoff { get; set; } = false;
/// <summary>
/// The maximum amount of time to delay retries during exponential backoff.
/// </summary>
public TimeSpan MaxExponentialBackoff { get; set; } = TimeSpan.FromHours(1);
/// <summary>
/// Gets or sets the interval at which the published telemetry cache cleanup process should occur.
/// This defines how frequently old published telemetry entries are eligible for pruning,
/// based on their publication timestamp.
/// </summary>
public TimeSpan PublishedTelemetriesCacheCleanupInterval { get; set; } = TimeSpan.FromHours(1);
public void Validate()
{
if (!SerialNumber.IsNotNullOrEmpty())
throw new ArgumentNullException(nameof(SerialNumber), "SerialNumber 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 (PendingStorageCheckInterval.TotalSeconds < 5)
throw new ArgumentOutOfRangeException(nameof(PendingStorageCheckInterval), "PendingStorageCheckInterval must be at least 5 seconds.");
}
}
}
|