Skip to content

Commit

Permalink
add query_samples to workflow_monitoring (#404)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuu Ohmura <[email protected]>
  • Loading branch information
o-mura and Yuu Ohmura authored Jun 28, 2024
1 parent 944b6c4 commit 0ee80ba
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 0 deletions.
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.
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
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
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
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

0 comments on commit 0ee80ba

Please sign in to comment.