Search before asking
What happened
I filtered on the "Last 2 days" drop down in the Grafana dashboard and didn't see any metrics related to my application.
What do you expect to happen
I would expect to see metrics related to my application regardless of the time frame selected.
How to reproduce
- Make one or more commits in a new month
- Wait at least three days into the month
- Select the "Last 2 days" filter in the Grafana dashboard
Important: The last two days should not overlap the beginning or end of a month. Make sure the "Last 2 days" are in the middle of the month.
Anything else
I'm not sure if this is a bug or a design decision.
The SQL query appears to use the BETWEEN keyword in place of the $__timeFilter function. This results in the query looking something like this:
SELECT
cm.month,
case when d.deployment_count is null then 0 else d.deployment_count end as deployment_count
FROM
calendar_months cm
LEFT JOIN _deployments d on cm.month = d.month
WHERE cm.month_timestamp BETWEEN '2024-07-09T15:15:33.784Z' AND '2024-07-11T15:15:33.784Z'
ORDER BY cm.month;
The calendar_months table appears to be truncating the month_timestamp column, so the WHERE clause doesn't catch anything.
Here's the full SQL query:
-- Metric 1: Number of deployments per month
with
_deployments as (
-- When deploying multiple commits in one pipeline, GitLab and BitBucket may generate more than one deployment. However, DevLake consider these deployments as ONE production deployment and use the last one's finished_date as the finished date.
SELECT
date_format(deployment_finished_date, '%y/%m') as month,
count(cicd_deployment_id) as deployment_count
FROM
(
SELECT
cdc.cicd_deployment_id,
max(cdc.finished_date) as deployment_finished_date
FROM
cicd_deployment_commits cdc
JOIN project_mapping pm on cdc.cicd_scope_id = pm.row_id
and pm.`table` = 'cicd_scopes'
WHERE
pm.project_name in ($project)
and cdc.result = 'SUCCESS'
and cdc.environment = 'PRODUCTION'
GROUP BY
1
HAVING
$__timeFilter (max(cdc.finished_date))
) _production_deployments
GROUP BY
1
)
SELECT
cm.month,
case
when d.deployment_count is null then 0
else d.deployment_count
end as deployment_count
FROM
calendar_months cm
LEFT JOIN _deployments d on cm.month = d.month
WHERE
$__timeFilter (cm.month_timestamp)
Version
v0.19.0
Are you willing to submit PR?
Code of Conduct
Search before asking
What happened
I filtered on the "Last 2 days" drop down in the Grafana dashboard and didn't see any metrics related to my application.
What do you expect to happen
I would expect to see metrics related to my application regardless of the time frame selected.
How to reproduce
Important: The last two days should not overlap the beginning or end of a month. Make sure the "Last 2 days" are in the middle of the month.
Anything else
I'm not sure if this is a bug or a design decision.
The SQL query appears to use the
BETWEENkeyword in place of the$__timeFilterfunction. This results in the query looking something like this:The
calendar_monthstable appears to be truncating themonth_timestampcolumn, so theWHEREclause doesn't catch anything.Here's the full SQL query:
Version
v0.19.0
Are you willing to submit PR?
Code of Conduct