Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: expose template insights as Prometheus metrics#10325

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 21 commits intomainfrom9983-insights-metrics-only-template
Oct 19, 2023

Conversation

mtojek
Copy link
Member

@mtojekmtojek commentedOct 18, 2023
edited
Loading

Related:#9983

part 1/3 - I decided to split this PR into 3 parts to simplify code reviews. Unfortunately, we need to implement 3 extra DB queries with matchingdbfake implementation.

This PR exposes "active users" metric from Coder template insights.

@mtojekmtojek marked this pull request as ready for reviewOctober 18, 2023 13:43
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment on lines 96 to 106
templateNames := map[uuid.UUID]string{}
if len(templateIDs) > 0 {
templates, err := mc.database.GetTemplatesWithFilter(ctx, database.GetTemplatesWithFilterParams{
IDs: templateIDs,
})
if err != nil {
mc.logger.Error(ctx, "unable to fetch template details from database", slog.Error(err))
return
}
templateNames = onlyTemplateNames(templates)
}
Copy link
Member

Choose a reason for hiding this comment

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

non-blocking, potential improvement: cache template ID -> template name to avoid DB fetches

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Thanks for your suggestion. Honestly, I wouldn't cache it yet unless we face performance issues. We would have to define the cache expiry and call db when templates are gone. Loop iterations are scheduled every 5 minutes by default, so I hope it won't impact performance. For sure, insights calls are heavier.

johnstcn reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

Agreed, just something to think about later!

mtojek reacted with thumbs up emoji
@mtojekmtojekenabled auto-merge (squash)October 19, 2023 08:39
@mtojekmtojek merged commitc4f5905 intomainOct 19, 2023
@mtojekmtojek deleted the 9983-insights-metrics-only-template branchOctober 19, 2023 08:45
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 19, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@mtojekmtojek

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@mtojek@mafredri@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp