diff options
Diffstat (limited to 'Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/schema.json')
| -rw-r--r-- | Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/schema.json | 85 |
1 files changed, 80 insertions, 5 deletions
diff --git a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/schema.json b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/schema.json index 41da6e63a..dba20ffb8 100644 --- a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/schema.json +++ b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Data/schema.json @@ -136,17 +136,91 @@ } ] }, - "JobStatusTable": { + "MachineStatusesTable": { "columns": { "SerialNumber": "string", + "MachineType": "string", + "Environment": "string", + "Organization": "string", + "Site": "string", "CreatedTime": "datetime", + "UploadTime": "datetime", "State": "string", "OverallTemperature": "real", "Status": "dynamic" }, + + "primaryTimeColumn": "CreatedTime", + "fallbackTimeColumns": [ "UploadTime" ], + "defaultTimeWindowDays": 1, + + "keys": { + "machineKey": [ "SerialNumber" ] + }, + + "enums": { + "State": [ + "PowerUp", + "Ready", + "Sleep", + "Error", + "ShuttingDown", + "PreparingJob", + "RunningJob", + "PowerDown" + ] + }, + "notes": [ - "High-volume time series of machine status snapshots. Short retention." - ] + "One row per machine status snapshot. Use CreatedTime for analysis; UploadTime is the ingestion/upload timestamp.", + "Status is a dynamic JSON object mirroring the on-device status payload (e.g., State, OverallTemperature, SpoolState, IDSPacksLevels[], error flags).", + "OverallTemperature is also duplicated at the top level for quick filtering/aggregation; the authoritative nested copy is Status.OverallTemperature.", + "Common expansions: Status.State (string), Status.SpoolState (string), Status.IDSPacksLevels (array of per-pack objects with MidTankLevel, DispenserLevel, etc.).", + "Example: latest state per machine (last 24h): MachineStatusesTable | where CreatedTime > ago(1d) | summarize arg_max(CreatedTime, *) by SerialNumber | project SerialNumber, Time=CreatedTime, State, OverallTemperature", + "Example: detect low MidTankLevel on any pack: MachineStatusesTable | where CreatedTime > ago(1d) | mv-expand pack=Status.IDSPacksLevels | project SerialNumber, CreatedTime, Index=todouble(pack.Index), MidTankLevel=toreal(pack.MidTankLevel) | where MidTankLevel < 2 | summarize min(MidTankLevel), any(CreatedTime) by SerialNumber, Index", + "Example: error intervals: MachineStatusesTable | where CreatedTime > ago(7d) | summarize Start=min(CreatedTime), End=max(CreatedTime), Count=count() by SerialNumber, State | where State == \"Error\" | order by Count desc", + "Example: Get the overall temperature during the last job for machine 30001: let LastJob = JobRunsTable | where SerialNumber == \"30001\" | summarize arg_max(EndTime, StartTime, EndTime) by SerialNumber; MachineStatusesTable | where SerialNumber == \"30001\" | join kind=inner (LastJob) on SerialNumber | where CreatedTime between (StartTime .. EndTime)" + ], + + "guardrails": { + "requireTimeFilter": true, + "maxRowsSuggested": 500, + "encourageSummarizeOrTop": true + }, + + "joinHints": [ + { + "table": "JobRunsTable", + "on": [ "SerialNumber" ], + "why": "Correlate state transitions (PreparingJob/RunningJob/Error) with job windows." + }, + { + "table": "MachinesTable", + "on": [ "SerialNumber" ], + "why": "Enrich with machine metadata (organization/site/version)." + }, + { + "table": "LogsTable", + "on": [ "SerialNumber" ], + "why": "Investigate logs around status changes using a time window." + } + ], + + "display": { + "rename": { + "CreatedTime": "Time" + }, + "suggestedProjections": [ + "SerialNumber", + "Time", + "State", + "OverallTemperature", + "Status.SpoolState", + "Status.IDSPacksLevels" + ] + } + + }, "MachinesTable": { "columns": { @@ -266,7 +340,8 @@ "Application logs emitted by services/apps running on or about the machines.", "Use CreatedTime for time filters; UploadTime is the ingestion/upload timestamp.", "Category is limited to Info, Warning, Error, Critical, Debug.", - "Source can be either Application or Firmware where Firmware represents logs generated by the embedded device and Application is everything else." + "Source can be either Application or Firmware where Firmware represents logs generated by the embedded device and Application is everything else.", + "Example to get error logs associated with a specific job: let LastJob = JobRunsTable | where SerialNumber == \"30001\" | summarize arg_max(EndTime, StartTime, EndTime) by SerialNumber; LogsTable | join kind=inner (LastJob) on SerialNumber | where Category == \"Error\" | where CreatedTime between (StartTime .. EndTime) | order by CreatedTime asc | project Time = format_datetime(CreatedTime, 'HH:mm:ss.fff'), Message" ], "guardrails": { @@ -461,4 +536,4 @@ ] } } -}
\ No newline at end of file +} |
