diff options
| author | Roy Ben Shabat <roy.mail.net@gmail.com> | 2025-08-30 22:05:03 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <roy.mail.net@gmail.com> | 2025-08-30 22:05:03 +0300 |
| commit | a1d55aa060450b0a16b597794686b2aa41eea259 (patch) | |
| tree | 62dfd7829b81335103a3c2d1d17c99d8408a5e54 /Software/Visual_Studio/PPC/Tango.PPC.Common | |
| parent | d9d5b0161efbce3f0d44e890b435883f49df2963 (diff) | |
| download | Tango-a1d55aa060450b0a16b597794686b2aa41eea259.tar.gz Tango-a1d55aa060450b0a16b597794686b2aa41eea259.zip | |
PPC Telemetry First Integration.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common')
5 files changed, 83 insertions, 1 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index 695d71b4b..872523bd0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -46,6 +46,7 @@ namespace Tango.PPC.Common.Connection /// Occurs when the machine has disconnected. /// </summary> public event EventHandler MachineDisconnected; + public event EventHandler<Machine> Initialized; private bool _isConnected; /// <summary> @@ -345,6 +346,8 @@ namespace Tango.PPC.Common.Connection MachineOperator.JobRunsLogger.SetDefaultMachine(Machine); + Initialized?.Invoke(this, Machine); + ConnectToMachine(); } else diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs index 774fa7c9e..52ab2620b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs @@ -25,6 +25,9 @@ namespace Tango.PPC.Common.Connection /// </summary> event EventHandler MachineDisconnected; + + event EventHandler<Machine> Initialized; + /// <summary> /// Gets a value indicating whether the machine is currently connected. /// </summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 7c20d08f5..c98a47e9a 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -273,6 +273,8 @@ <Compile Include="Synchronization\SynchronizationStatusChangedEventArgs.cs" /> <Compile Include="SystemInfo\DefaultSystemInfoService.cs" /> <Compile Include="SystemInfo\ISystemInfoService.cs" /> + <Compile Include="Telemetry\ITelemetryProvider.cs" /> + <Compile Include="Telemetry\TelemetrySettings.cs" /> <Compile Include="ThreadLoading\IThreadLoadingService.cs" /> <Compile Include="UpdatePackages\DefaultPackageRunner.cs" /> <Compile Include="UpdatePackages\IPackageRunner.cs" /> @@ -680,7 +682,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Telemetry/ITelemetryProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Telemetry/ITelemetryProvider.cs new file mode 100644 index 000000000..529775d0e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Telemetry/ITelemetryProvider.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.Telemetry +{ + public interface ITelemetryProvider + { + TelemetrySettings Settings { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Telemetry/TelemetrySettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Telemetry/TelemetrySettings.cs new file mode 100644 index 000000000..7acf7e197 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Telemetry/TelemetrySettings.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Logging; +using Tango.Settings; + +namespace Tango.PPC.Common.Telemetry +{ + public class TelemetrySettings : SettingsBase + { + public bool Enable { get; set; } = true; + + public bool EnableIoTHub { get; set; } = true; + public bool EnableMqtt { get; set; } = false; + + public String IoTHubConnectionString { get; set; } = "HostName=iot-twine-dev-weu.azure-devices.net;DeviceId=telemetry-dev-01;SharedAccessKey=cZhCMhiVL+TF7p13fpX+lFmyxoy8ZqCkbxUwumWw18Q="; + + /// <summary> + /// Interval for checking and reprocessing failed/pending telemetry from local storage. + /// </summary> + public TimeSpan PendingStorageCheckInterval { get; set; } = TimeSpan.FromMinutes(1); + + /// <summary> + /// Frequency at which historical sources are polled to request backlogged or missed telemetry. + /// </summary> + public TimeSpan HistorySourcesRequestInterval { get; set; } = TimeSpan.FromMinutes(1); + + /// <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 bool SendDiagnostics { get; set; } = true; + public TimeSpan DiagnosticsSamplingInterval { get; set; } = TimeSpan.FromSeconds(60); + public bool SendEvents { get; set; } = true; + public bool SendJobRuns { get; set; } = true; + public bool SendJobRunsHistory { get; set; } = true; + public bool SendJobStatus { get; set; } = true; + public bool SendLogs { get; set; } = true; + public bool SendMachineStatus { get; set; } = true; + public bool SendMachineUpdates { get; set; } = true; + public bool SendMachineUpdatesHistory { get; set; } = true; + public bool SendWires { get; set; } = true; + + public HashSet<LogCategory> LogCategories { get; set; } = new HashSet<LogCategory>() { LogCategory.Critical, LogCategory.Error, LogCategory.Warning }; + } +} |
