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: make agent stats' cardinality configurable#12535

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

Conversation

dannykopping
Copy link
Contributor

@dannykoppingdannykopping commentedMar 11, 2024
edited
Loading

Part 2 of#12468

We initially had torevert the above PR because of a panic from Prometheus.

This was caused by the 4 default labels being passed in toAgentStats(), however these metrics do not contain a value for thetemplate_name label. This was masked in a test by passing innil for the aggregation labels which defaulted them to the 3 correct ones, but I subsequently changed the default value fromnil in the actual code to all 4 labels for various reasons.

I implemented the fix in3c1d016. I can't think of a cleaner approach than this; if you come up with a better approach, please share!

Note to reviewers: the code is otherwise identical to#12468, so simply reviewing3c1d016 should suffice.

dannykoppingand others added18 commitsMarch 11, 2024 16:38
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
…ebug worksSigned-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
@dannykoppingdannykopping marked this pull request as ready for reviewMarch 12, 2024 07:31
Comment on lines 14 to 18
"github.com/coder/coder/v2/coderd/agentmetrics"

"github.com/coder/coder/v2/coderd/batchstats"
"github.com/coder/coder/v2/coderd/database/dbtestutil"
"github.com/coder/coder/v2/coderd/database/dbtime"
Copy link
Member

Choose a reason for hiding this comment

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

nit: sorting?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Hhmm, I ranmake fmt and it didn't correct it so I think we have some things to fix in our CI. Will manually sort though 👍

Copy link
Member

Choose a reason for hiding this comment

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

goimports only ensures that imports are grouped, but doesn't handle merging multiple import groups from the same source. I recall thathttps://github.com/indeedeng/go-groups was built in anger to address this, but it has not been updated in a while.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oh nice. I just ran it and it... changesa lot.
I'll raise a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

It isextremely opinionated

Comment on lines 18 to 22
"github.com/coder/coder/v2/coderd/agentmetrics"

"github.com/coreos/go-oidc/v3/oidc"

"github.com/coder/coder/v2/buildinfo"
Copy link
Member

Choose a reason for hiding this comment

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

nit: here too

dannykopping reacted with thumbs up emoji
func filterInvalidLabels(labels []string) []string {
var out []string

for _, label := range labels {
Copy link
Member

Choose a reason for hiding this comment

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

maybe optimize it this way?

validLabels := make([]string, 0, len(labels))for _, label := range labels {if label != agentmetrics.LabelTemplateName {validLabels = append(validLabels, label)}}

dannykopping reacted with thumbs up emoji
// filterInvalidLabels handles a slightly messy situation whereby `prometheus-aggregate-agent-stats-by` can control on
// which labels agent stats are aggregated, but for these specific metrics in this file there is no `template` label value,
// and therefore we have to exclude it from the list of acceptable labels.
func filterInvalidLabels(labels []string) []string {
Copy link
Member

Choose a reason for hiding this comment

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

Should we add aninternal_test.go to verify this function?

dannykopping reacted with thumbs up emoji
Copy link
Member

@johnstcnjohnstcn left a comment
edited
Loading

Choose a reason for hiding this comment

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

Only a couple of nits from me. Tested locally with a small scaletest.

"golang.org/x/xerrors"

"github.com/coder/coder/v2/coderd/agentmetrics"
Copy link
Member

Choose a reason for hiding this comment

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

nit: sorting

dannykopping reacted with thumbs up emoji
Signed-off-by: Danny Kopping <danny@coder.com>
Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

👍

@dannykoppingdannykopping merged commit7a7105a intocoder:mainMar 13, 2024
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMar 13, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@mtojekmtojekmtojek approved these changes

Assignees

@dannykoppingdannykopping

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@dannykopping@johnstcn@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp