-
Notifications
You must be signed in to change notification settings - Fork 61
Return assignees with issues queries #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new Assignees
column to the issues query, so consumers can see who is assigned on each GitHub issue in Grafana dashboards.
- Extend the GraphQL
Issue
model andFrames()
logic to serialize assignees into the dataframe. - Update unit tests to include various assignee scenarios.
- Refresh the golden JSON fixture to reflect the new column.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
pkg/github/issues.go | Added Assignees in the Issue struct and appended its JSON field in Frames() . |
pkg/github/issues_test.go | Populated and asserted the new Assignees nodes in test cases. |
pkg/github/testdata/issues.golden.jsonc | Updated comments, schema, and example rows to include assignees . |
Comments suppressed due to low confidence (1)
pkg/github/issues.go:33
- The GraphQL query limits assignees to the first 10, while labels use a limit of 100. Consider increasing this (e.g.,
first: 100
) or making it configurable to avoid missing assignees on issues with more than 10.
} `graphql:"assignees(first: 10)"`
labelsBytes, _ := json.Marshal(labels) | ||
rawLabelArray := json.RawMessage(labelsBytes) | ||
|
||
assigneesBytes, _ := json.Marshal(assignees) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignoring the error returned by json.Marshal
can mask serialization failures. Consider capturing and handling or logging the error to aid troubleshooting.
labelsBytes, _ := json.Marshal(labels) | |
rawLabelArray := json.RawMessage(labelsBytes) | |
assigneesBytes, _ := json.Marshal(assignees) | |
labelsBytes, err := json.Marshal(labels) | |
if err != nil { | |
fmt.Printf("Error marshaling labels for issue %d: %v\n", v.Number, err) | |
continue | |
} | |
rawLabelArray := json.RawMessage(labelsBytes) | |
assigneesBytes, err := json.Marshal(assignees) | |
if err != nil { | |
fmt.Printf("Error marshaling assignees for issue %d: %v\n", v.Number, err) | |
continue | |
} |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go with array of strings, then we probably don't need this logic.
Just in case this goes beyond POC - please ensure to update the docs https://github.com/grafana/github-datasource/blob/main/docs/sources/query/_index.md#issues |
labelsBytes, _ := json.Marshal(labels) | ||
rawLabelArray := json.RawMessage(labelsBytes) | ||
|
||
assigneesBytes, _ := json.Marshal(assignees) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go with array of strings, then we probably don't need this logic.
Return a new column in the issues query:
Assignees
. This change allows users to see who is assigned to each GitHub issue directly in their Grafana dashboards and queries.BEFORE THE CHANGE

AFTER THE CHANGE
