-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add query_samples to workflow_monitoring (#404)
Co-authored-by: Yuu Ohmura <[email protected]>
- Loading branch information
Showing
9 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
scenarios/monitoring/workflow_monitoring/query_samples/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This document is a list of query samples for each table of workflow_monitoring database. | ||
|
||
| # | file | reference table | description | result | | ||
|----|----|----|----|----| | ||
| 1 | [project_list.sql](project_list.sql) | workflow_monitoring.projects | extract a list of Project with last updated user | ![](images/1.png) | | ||
| 2 | [workflow_list.sql](workflow_list.sql) | workflow_monitoring.workflows | extract a list of Workflow | ![](images/2.png) | | ||
| 3 | [schedule_list.sql](schedule_list.sql) | workflow_monitoring.schedules | extract a list of scheduled workflow | ![](images/3.png) | | ||
| 4 | [session_attempt_list_for_specific_workflow.sql](session_attempt_list_for_specific_workflow.sql) | workflow_monitoring.attempts | extract a list of session/attempt for specific workflow | ![](images/4.png) | | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
scenarios/monitoring/workflow_monitoring/query_samples/project_list.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
with latest_revision_per_project as ( | ||
select | ||
projectid, | ||
revision, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(MAX_BY(userinfo, createdat)), '$.td.user.id') as user_id, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(MAX_BY(userinfo, createdat)), '$.td.user.name') as user_name, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(MAX_BY(userinfo, createdat)), '$.td.user.email') as user_email | ||
from revisions | ||
group by projectid, revision | ||
) | ||
select | ||
p.id as project_id, | ||
p.name as project_name, | ||
p.createdat, | ||
p.updatedat, | ||
r.user_id, | ||
r.user_name, | ||
r.user_email | ||
from projects p | ||
join latest_revision_per_project r on p.revision = r.revision and p.metadata = '[]' | ||
order by 1 |
10 changes: 10 additions & 0 deletions
10
scenarios/monitoring/workflow_monitoring/query_samples/schedule_list.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
select | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(project), '$.id') as project_id, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(project), '$.name') as project_name, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(workflow), '$.id') as workflow_id, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(workflow), '$.name') as workflow_name, | ||
nextruntime, | ||
nextscheduletime | ||
from schedules | ||
where disabledat is null | ||
order by 5 |
12 changes: 12 additions & 0 deletions
12
...nitoring/workflow_monitoring/query_samples/session_attempt_list_for_specific_workflow.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
select | ||
sessionid, | ||
id as attemptid, | ||
createdat, | ||
finishedat, | ||
DATE_DIFF('second', DATE_PARSE(createdat, '%Y-%m-%dT%H:%i:%sZ'), DATE_PARSE(finishedat, '%Y-%m-%dT%H:%i:%sZ')) as duration | ||
from attempts | ||
where TD_INTERVAL(time, '-30d/now') | ||
and project like '%xxxx%' | ||
and workflow like '%xxxx%' | ||
and status = 'success' | ||
order by 1, 2 |
22 changes: 22 additions & 0 deletions
22
scenarios/monitoring/workflow_monitoring/query_samples/workflow_list.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
with latest_revision_per_project as ( | ||
select | ||
projectid, | ||
revision, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(MAX_BY(userinfo, createdat)), '$.td.user.id') as user_id, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(MAX_BY(userinfo, createdat)), '$.td.user.name') as user_name, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(MAX_BY(userinfo, createdat)), '$.td.user.email') as user_email | ||
from revisions | ||
group by projectid, revision | ||
) | ||
select | ||
w.id as workflow_id, | ||
w.name as workflow_name, | ||
w.timezone, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(w.project), '$.id') as project_id, | ||
JSON_EXTRACT_SCALAR(JSON_PARSE(w.project), '$.name') as project_name, | ||
r.user_id, | ||
r.user_name, | ||
r.user_email | ||
from workflows w | ||
join latest_revision_per_project r on w.revision = r.revision | ||
order by 4,1 |