🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

[Bug][Grafana] Work Log / Code Commits panel error #8833

Closed

Description

@mcseemz

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

invalid number of commits per user in Code Commits panel, Work Logs dashboard, when user has multiple accounts and his email does not match the one in GitHub.

What do you expect to happen

original sql

with _accounts as (
  select ua.account_id, ua.user_id, u.name, u.email
    from accounts a 
    join user_accounts ua on a.id = ua.account_id
    join users u on ua.user_id = u.id
  where ua.user_id in (${users:singlequote})
)

SELECT  count(distinct c.sha)
FROM commits c
join _accounts a on c.author_id = a.email
where $__timeFilter(authored_date)

proper sql

with _accounts as (
  select ua.account_id, ua.user_id, u.name, a.email <------ should be account email, not user email
    from accounts a 
    join user_accounts ua on a.id = ua.account_id
    join users u on ua.user_id = u.id
  where ua.user_id in (${users:singlequote})
)

SELECT  count(distinct c.sha)
FROM commits c
join _accounts a on c.author_id = a.email
where $__timeFilter(authored_date)

How to reproduce

create teams and users with user email not equal to his Github email, open panel and observe 0 commits.

Anything else

No response

Version

v1.0.3-beta10@99376a8

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    type/bug
    on Apr 13, 2026
  2. added
    component/ext
    severity/p1
    on Apr 13, 2026
  3. dosubot commented on Apr 13, 2026

    @dosubot

    The bug analysis looks correct. The _accounts CTE in the "Code Commits" panel selects u.email from the users table, but the outer query joins on c.author_id = a.email — so when a user's DevLake user email differs from their GitHub account email, the join fails and returns 0 commits [1].

    Interestingly, other panels in the same dashboard (e.g., "Lines of code") use c.author_id = a.account_id instead of an email-based join [2], which avoids this issue entirely. The fix proposed here — changing u.email to a.email in the CTE — should resolve the mismatch.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about incubator-devlake with Dosu Add Dosu to your team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/extseverity/p1type/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions