Skip to content

Commit

Permalink
chore: add status in scraper and topology crd card
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra authored and moshloop committed Jul 30, 2024
1 parent 9ba5e88 commit 5a56c40
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions chart/templates/topology.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ spec:
expr: |
results.rows.map(r, {
'name': r.name,
'status': r.status == 'SUCCESS' ? 'healthy' : 'unhealthy',
'status_reason': r.status == 'SUCCESS' ? '': r.details.toJSON(),
'properties': [
{'name': 'Last runtime', 'text': r.time_end},
{'name': 'Duration', 'value': r.duration_millis, 'unit': 'ms', 'headline': true},
Expand All @@ -160,7 +162,7 @@ spec:
SELECT * FROM (
SELECT
ROW_NUMBER() OVER (PARTITION BY t.name ORDER BY time_end DESC) AS rn, t.name, jh.status, jh.success_count,
jh.error_count, jh.duration_millis, jh.time_end
jh.error_count, jh.duration_millis, jh.time_end, jh.details
FROM topologies t
INNER JOIN job_history jh ON t.id::text = jh.resource_id
WHERE jh.status NOT in ('RUNNING', 'STALE', 'SKIPPED')
Expand Down Expand Up @@ -278,6 +280,8 @@ spec:
expr: |
results.rows.map(r, {
'name': r.name,
'status': r.status == 'SUCCESS' ? 'healthy' : 'unhealthy',
'status_reason': r.status == 'SUCCESS' ? '': r.details.toJSON(),
'properties': [
{'name': 'Last runtime', 'text': r.time_end},
{'name': 'Duration', 'value': r.duration_millis, 'unit': 'ms', 'headline': true},
Expand All @@ -290,7 +294,7 @@ spec:
SELECT * FROM (
SELECT
ROW_NUMBER() OVER (PARTITION BY c.name ORDER BY time_end DESC) AS rn, c.name, jh.status, jh.success_count,
jh.error_count, jh.duration_millis, jh.time_end
jh.error_count, jh.duration_millis, jh.time_end, jh.details
FROM config_scrapers c
INNER JOIN job_history jh ON c.id::text = jh.resource_id
WHERE jh.status NOT in ('RUNNING', 'STALE', 'SKIPPED')
Expand Down Expand Up @@ -384,8 +388,8 @@ spec:
'name': r.name,
'icon': 'clock',
'type': 'JobHistory',
'status': r.status in ['SUCCESS', 'FINISHED'] ? 'healthy': 'unhealthy',
'status_reason': r.status in ['SUCCESS', 'FINISHED'] ? '': r.details.toJSON(),
'status': r.status == 'SUCCESS' ? 'healthy': 'unhealthy',
'status_reason': r.status == 'SUCCESS' ? '': r.details.toJSON(),
'properties': [
{'name': 'success_count', 'value': r.success_count, 'headline': true},
{'name': 'error_count', 'value': r.error_count, 'headline': true},
Expand Down Expand Up @@ -424,7 +428,7 @@ spec:
- name: pass-rate
lookup:
prometheus:
- query: '100 * sum by (name) (count_over_time(job{namespace="{{ .Release.Namespace}}",status=~"FINISHED|SUCCESS"}[1h])) / sum by (name) (count_over_time(job{namespace="{{ .Release.Namespace}}"}[1h]))'
- query: '100 * sum by (name) (count_over_time(job{namespace="{{ .Release.Namespace}}",status="SUCCESS"}[1h])) / sum by (name) (count_over_time(job{namespace="{{ .Release.Namespace}}"}[1h]))'
url: {{ .Values.prometheusURL | quote }}
display:
expr: |
Expand Down

0 comments on commit 5a56c40

Please sign in to comment.