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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
--Ploty Examples--
Pie Chart of Job Statuses:
let data =
JobRunsTable
| summarize Completed = countif(Status == "Completed"), Failed = countif(Status == "Failed"), Aborted = countif(Status == "Aborted");
data
| extend TotalJobs = Completed + Failed + Aborted
| extend ploty = strcat(
'{"data":[{"type":"pie",',
'"labels":["Completed","Failed","Aborted"],',
'"values":[', tostring(Completed), ',', tostring(Failed), ',', tostring(Aborted), '],',
'"marker":{"colors":["green","red","orange"]},',
'"textinfo":"label+value",',
'"hoverinfo":"label+value"}],',
'"layout":{"title":"Job Status Distribution (', tostring(TotalJobs), ')",',
'"showlegend":false}}'
)
| project ploty
Ink Consumption by Color (L)
JobRunsTable
| summarize
Cyan = sum(OutputCyan),
Magenta = sum(OutputMagenta),
Yellow = sum(OutputYellow),
Black = sum(OutputBlack),
LightCyan = sum(OutputLightCyan),
LightMagenta = sum(OutputLightMagenta),
LightYellow = sum(OutputLightYellow),
Blue = sum(OutputBlue),
LightBlue = sum(OutputLightBlue),
Orange = sum(OutputOrange),
LightOrange = sum(OutputLightOrange),
Rubine = sum(OutputRubine),
LightRubine = sum(OutputLightRubine),
Navy = sum(OutputNavy),
Violet = sum(OutputViolet),
Transparent = sum(OutputTransparent)
| extend keys = pack_array("Cyan","Magenta","Yellow","Black","Light Cyan","Light Magenta","Light Yellow","Blue","Light Blue","Orange","Light Orange","Rubine","Light Rubine","Navy","Violet","Transparent")
| extend values = pack_array(
toreal(Cyan)/1000000000.0,
toreal(Magenta)/1000000000.0,
toreal(Yellow)/1000000000.0,
toreal(Black)/1000000000.0,
toreal(LightCyan)/1000000000.0,
toreal(LightMagenta)/1000000000.0,
toreal(LightYellow)/1000000000.0,
toreal(Blue)/1000000000.0,
toreal(LightBlue)/1000000000.0,
toreal(Orange)/1000000000.0,
toreal(LightOrange)/1000000000.0,
toreal(Rubine)/1000000000.0,
toreal(LightRubine)/1000000000.0,
toreal(Navy)/1000000000.0,
toreal(Violet)/1000000000.0,
toreal(Transparent)/1000000000.0
)
| extend colors = pack_array("#00FFFF", "#FF00FF", "#FFFF00", "#000000", "#E0FFFF", "#FFB6C1", "#FFFFE0", "#0000FF", "#ADD8E6", "#FFA500", "#FFE4B5", "#D2042D", "#FF69B4", "#000080", "#8A2BE2", "#FFFFFF")
| extend ploty = strcat(
'{"data":[{"type":"bar",',
'"x":', tostring(keys), ',',
'"y":', tostring(values), ',',
'"marker":{"color":', tostring(colors), '}',
'}],',
'"layout":{"title":"Ink Consumption by Color (L)","xaxis":{"title":"Color"},"yaxis":{"title":"Total Ink (L)"}}}'
)
| project ploty
Failing Machines (TOP 10):
let data = JobRunsTable
| where Status == "Failed"
| summarize FailedCount = count() by SerialNumber, Site
| top 10 by FailedCount desc
| order by FailedCount desc
| extend SerialNumberWithSite = strcat(SerialNumber, iif(isnull(Site), "", strcat(" (", Site, ")")));
let x = toscalar(data | summarize make_list(SerialNumberWithSite));
let y = toscalar(data | summarize make_list(FailedCount));
let colors = dynamic([
"#B30000", "#CC0000", "#E60000", "#FF0000", "#FF2A2A",
"#FF3333", "#FF4D4D", "#FF6666", "#FF9999", "#FFCCCC"
]);
print ploty = tostring(strcat(
'{"data":[',
'{"x":', tostring(x),
',"y":', tostring(y),
',"type":"bar",',
'"marker":{"color":', tostring(colors), '}',
'}],',
'"layout":{"title":"",',
'"xaxis":{"title":"Machine (Site)","automargin":true},',
'"yaxis":{"title":"Failure Count"},',
'"margin":{"b":150}}}'
))
Resume Stats:
let r1="Continuous request message 'JobRequest' had failed to provide a response for a period of 10 seconds and has timed out.";
let r2="Transporter disconnected.";
let ids_with_disconnect=JobRunsTable
| where isnotempty(FailureReason)
| where FailureReason endswith r1 or FailureReason endswith r2
| distinct ID;
let latest_per_id=JobRunsTable
| summarize arg_max(CreatedTime, *) by ID
| extend LatestIsDisconnect=isnotempty(FailureReason) and (FailureReason endswith r1 or FailureReason endswith r2);
let totals=latest_per_id
| where ID in (ids_with_disconnect)
| summarize Resumed=countif(not(LatestIsDisconnect)), NotResumed=countif(LatestIsDisconnect);
totals
| extend ["Job Runs Recovered By Resume"]=Resumed, ["Job Runs Could not Resume"]=NotResumed, ["Total Disconnections"]=Resumed+NotResumed, ["Success Rate"]=round(100.0*todouble(Resumed)/todouble(Resumed+NotResumed),2)
| project-away Resumed, NotResumed
| extend keys=pack_array("Job Runs Recovered By Resume","Job Runs Could not Resume","Total Disconnections","Success Rate"),
values=pack_array(toreal(['Job Runs Recovered By Resume']),toreal(['Job Runs Could not Resume']),toreal(['Total Disconnections']),toreal(['Success Rate'])),
colors=pack_array("#28a745","#dc3545","#6c757d","#007bff")
| extend ploty=strcat('{"data":[{"type":"bar","x":', tostring(keys), ',"y":', tostring(values), ',"marker":{"color":', tostring(colors), '}}],"layout":{"title":"Job Resume Analysis","xaxis":{"title":""},"yaxis":{"title":"Value"},"showlegend":false}}')
--Ploty Examples--
|