Skip to content

Commit

Permalink
updated formating of alert properties
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyBarnes committed Sep 27, 2023
1 parent bd020cf commit 868023e
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 22 deletions.
45 changes: 45 additions & 0 deletions docs/layouts/partials/activityAlertProperties.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

<table>
<tr>
<th>Category</th>
{{ if eq .category "Administrative" }}
<th>Operation Name</th>
<th>Status</th>
{{ else if eq .category "ResourceHealth" }}
<th>Causes</th>
<th>Health Status</th>
{{ else if eq .category "ServiceHealth" }}
<th>Incident Type</th>
{{ end }}
</tr>

<tr>
<td>{{ .category }}</td>
{{ if eq .category "Administrative" }}
<td>{{ .operationName }}</td>
<td>
{{ if or (reflect.IsMap .status) (reflect.IsSlice .status) }}
{{ transform.Highlight (encoding.Jsonify (dict "prefix" "\n" "indent" " ") .status) "json" }}
{{ else }}
{{ .status }}
{{ end }} </td>
{{ else if eq .category "ResourceHealth" }}
<td>
{{ if or (reflect.IsMap .causes) (reflect.IsSlice .causes) }}
{{ transform.Highlight (encoding.Jsonify (dict "prefix" "\n" "indent" " ") .causes) "json" }}
{{ else }}
{{ .causes }}
{{ end }}
</td>
<td>
{{ if or (reflect.IsMap .currentHealthStatus) (reflect.IsSlice .currentHealthStatus) }}
{{ transform.Highlight (encoding.Jsonify (dict "prefix" "\n" "indent" " ") .currentHealthStatus) "json" }}
{{ else }}
{{ .currentHealthStatus }}
{{ end }}
</td>
{{ else if eq .category "ServiceHealth" }}
<td>{{ .incidentType }}</td>
{{ end }}
</tr>
</table>
40 changes: 40 additions & 0 deletions docs/layouts/partials/logAlertProperties.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

<div><table>
<tr>
<th>Dimensions</th>
<th>Failing Periods</th>
<th>Aggregation</th>
<th>Operator</th>
<th>Threshold</th>
<th>Window</th>
<th>Frequency</th>
<th>Severity</th>
<th>Metric Measure Column</th>
<th>Resource ID Column</th>
</tr>

<tr>
<td>
{{ if or (reflect.IsMap .dimensions) (reflect.IsSlice .dimensions) }}
{{ transform.Highlight (encoding.Jsonify (dict "prefix" "\n" "indent" " ") .dimensions) "json" }}
{{ else }}
{{ .dimensions }}
{{ end }}
</td>
<td>
{{ if or (reflect.IsMap .failingPeriods) (reflect.IsSlice .failingPeriods) }}
{{ transform.Highlight (encoding.Jsonify (dict "prefix" "\n" "indent" " ") .failingPeriods) "json" }}
{{ else }}
{{ .failingPeriods }}
{{ end }}
</td>
<td>{{ .timeAggregation }}</td>
<td>{{ .operator }}</td>
<td>{{ .threshold }}</td>
<td>{{ .windowSize }}</td>
<td>{{ .evaluationFrequency }}</td>
<td>{{ .severity }}</td>
<td>{{ .metricMeasureColumn }}</td>
<td>{{ .resouceIdColumn }}</td>
</tr>
</table></div>
44 changes: 44 additions & 0 deletions docs/layouts/partials/metricAlertProperties.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

<div><table>
<tr>
<th>Criterion Type</th>
<th>Dimensions</th>
{{ if eq .criterionType "DynamicThresholdCriterion" }}
<th>Alert Sensitivity</th>
<th>Failing Periods</th>
{{ end }}
<th>Aggregation</th>
<th>Operator</th>
<th>Threshold</th>
<th>Window</th>
<th>Frequency</th>
<th>Severity</th>
</tr>

<tr>
<td>{{ .criterionType }}</td>
<td>
{{ if or (reflect.IsMap .dimensions) (reflect.IsSlice .dimensions) }}
{{ transform.Highlight (encoding.Jsonify (dict "prefix" "\n" "indent" " ") .dimensions) "json" }}
{{ else }}
{{ .dimensions }}
{{ end }}
</td>
{{ if eq .criterionType "DynamicThresholdCriterion" }}
<td>{{ .alertSensitivity }}</td>
<td>
{{ if or (reflect.IsMap .failingPeriods) (reflect.IsSlice .failingPeriods) }}
{{ transform.Highlight (encoding.Jsonify (dict "prefix" "\n" "indent" " ") .failingPeriods) "json" }}
{{ else }}
{{ .failingPeriods }}
{{ end }}
</td>
{{ end }}
<td>{{ .timeAggregation }}</td>
<td>{{ .operator }}</td>
<td>{{ .threshold }}</td>
<td>{{ .windowSize }}</td>
<td>{{ .evaluationFrequency }}</td>
<td>{{ .severity }}</td>
</tr>
</table></div>
28 changes: 6 additions & 22 deletions docs/layouts/shortcodes/alertList.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,12 @@
<h3>{{ .name }} - {{ .type }} Alert</h3>
<div style="text-indent: 1%;"><i>{{ .description }}</i></div>
<h4>Recommended Properties:</h4>
{{ range $key, $value := .properties }}
<div style="text-indent: 1%;">
{{ if reflect.IsMap $value }}
{{ humanize $key }}:
{{ range $key, $value := $value }}
<div style="text-indent: 2%;">
{{ if reflect.IsMap $value }}
{{ humanize $key }}:
{{ range $key, $value := $value }}
<div style="text-indent: 3%;">
{{ humanize $key }}: {{ $value }}
</div>
{{ end }}
{{ else }}
{{ humanize $key }}: {{ $value }}
{{ end }}
</div>
{{ end }}
{{ else if ne $key "query" }}
{{ humanize $key }}: {{ $value }}
{{ end }}
</div>
{{ if eq .type "Metric" }}
{{- partial "metricAlertProperties" .properties }}
{{ else if eq .type "Log" }}
{{- partial "logAlertProperties" .properties }}
{{ else if eq .type "ActivityLog" }}
{{- partial "activityAlertProperties" .properties }}
{{ end }}
{{ if .properties.query }}
<div>
Expand Down

0 comments on commit 868023e

Please sign in to comment.