Skip to content

feat(coderd/telemetry): add telemetry for database Tasks - #20279

Merged
johnstcn merged 5 commits into
mainfrom
cj/gh-coder-internal-981
Oct 17, 2025
Merged

johnstcn merged 5 commits into
mainfrom
cj/gh-coder-internal-981

Conversation

@johnstcn

@johnstcn johnstcn commented Oct 13, 2025 •

Copy link
Copy Markdown
Member

@johnstcn johnstcn self-assigned this Oct 13, 2025
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981 branch from 5eefbd7 to 7b7d778 Compare October 13, 2025 17:01
@johnstcn
johnstcn changed the base branch from main to cj/gh-coder-internal-981-list-tasks October 13, 2025 17:01
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981 branch from 7b7d778 to 0f0801f Compare October 13, 2025 17:07
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981-list-tasks branch from ee92a76 to e901f8d Compare October 13, 2025 17:11
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981 branch 2 times, most recently from d15c472 to 55e34c6 Compare October 13, 2025 17:19
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981-list-tasks branch from e901f8d to 7b6e819 Compare October 13, 2025 20:00
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981 branch from 55e34c6 to 777681a Compare October 13, 2025 20:01
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981-list-tasks branch from 7b6e819 to 4c1b0b2 Compare October 14, 2025 11:14
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981 branch from d87670a to 9cc8e53 Compare October 14, 2025 11:17
Base automatically changed from cj/gh-coder-internal-981-list-tasks to main October 14, 2025 16:33
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981 branch 5 times, most recently from 4e74abd to ebe0908 Compare October 15, 2025 17:13
@johnstcn
johnstcn force-pushed the cj/gh-coder-internal-981 branch from ebe0908 to 213da47 Compare October 15, 2025 17:46
Comment on lines 1564 to +1589
@@ -1581,7 +1581,12 @@ func Task(t testing.TB, db database.Store, orig database.TaskTable) database.Tas
})
require.NoError(t, err, "failed to insert task")

return task
// Return the Task from the view instead of the TaskTable
fetched, err := db.GetTaskByID(genCtx, task.ID)
require.NoError(t, err, "failed to fetch task")
require.Equal(t, task.ID, fetched.ID)

return fetched

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by: modified this to return the view type instead

Comment thread coderd/telemetry/telemetry.go Outdated
Comment on lines +1798 to +1799
TemplateParametersHash: fmt.Sprintf("%x", sha256.New().Sum(task.TemplateParameters)),
PromptHash: fmt.Sprintf("%x", sha256.New().Sum([]byte(task.Prompt))),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I "defaulted" to sha256 here, but I'm open to other suggestions.

@johnstcn
johnstcn marked this pull request as ready for review October 15, 2025 18:07

@DanielleMaywood DanielleMaywood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but will defer to Hugo for approval

@mafredri mafredri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the sha256, looks good 👍🏻

Comment thread coderd/telemetry/telemetry.go Resolved
Co-authored-by: Mathias Fredriksson <[email protected]>
Comment thread coderd/telemetry/telemetry.go Resolved
@johnstcn
johnstcn requested a review from hugodutka October 17, 2025 09:18
@johnstcn
johnstcn merged commit dc6e50d into main Oct 17, 2025
@johnstcn
johnstcn deleted the cj/gh-coder-internal-981 branch October 17, 2025 09:48
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants