Skip to content
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

roachprod: changes in promhelper client for modify labels #124460

Conversation

nameisbhaskar
Copy link
Contributor

When a test is run, a new label has to be added to prometheus. To do this, we need to first get the current config, add the new label and update the config. This change does that. Post this change, the label update will be integrated.

The change also needs a change in httputil client GET function to support headers being passed.

Fixes: #124319
Epic: none

@nameisbhaskar nameisbhaskar requested review from a team as code owners May 21, 2024 03:49
@nameisbhaskar nameisbhaskar requested review from renatolabs, vidit-bhat, wenyihu6 and kyle-a-wong and removed request for a team May 21, 2024 03:49
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nameisbhaskar nameisbhaskar changed the title roachprod: changes in promhelper client to for modify labels roachprod: changes in promhelper client for modify labels May 21, 2024
@nameisbhaskar nameisbhaskar force-pushed the user/bhaskar/client-change branch 2 times, most recently from e8b1b11 to be97a53 Compare May 21, 2024 05:29
@nameisbhaskar nameisbhaskar requested a review from a team as a code owner May 21, 2024 05:29
@nameisbhaskar nameisbhaskar force-pushed the user/bhaskar/client-change branch 4 times, most recently from e41e003 to 87646e9 Compare May 21, 2024 07:32
Copy link
Contributor

@DarrylWong DarrylWong left a comment

Choose a reason for hiding this comment

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

Can you explain to me why we need to update the config this way? By the time we call cluster.Start the first time, we should already the test name and the run ID, is there a reason we can't add it all in one shot?

pkg/util/httputil/client.go Outdated Show resolved Hide resolved
pkg/roachprod/roachprod.go Show resolved Hide resolved
pkg/roachprod/roachprod.go Show resolved Hide resolved
When a test is run, a new label has to be added to prometheus.
To do this, we need to first get the current config, add the
new label and update the config. This change does that. Post
this change, the label update will be integrated.

The change also needs a change in httputil client GET function
to support headers being passed.

Fixes: cockroachdb#124319
Epic: none
@nameisbhaskar nameisbhaskar requested review from DarrylWong and removed request for a team, wenyihu6 and kyle-a-wong May 22, 2024 05:12
@nameisbhaskar nameisbhaskar removed the request for review from a team May 22, 2024 05:13
@nameisbhaskar
Copy link
Contributor Author

Can you explain to me why we need to update the config this way? By the time we call cluster.Start the first time, we should already the test name and the run ID, is there a reason we can't add it all in one shot?

If a cluster is reused, do we always stop the nodes and then add the tags and start? If that is the case, we should be good without this change.

@DarrylWong
Copy link
Contributor

Yes, that's correct.

If we reuse a cluster, we call c.WipeForReuse.

// We found a test to run on this cluster. Wipe the cluster.
if err := c.WipeForReuse(ctx, l, testToRun.spec.Cluster); err != nil {

This eventually calls c.Stop

func (c *SyncedCluster) Wipe(ctx context.Context, l *logger.Logger, preserveCerts bool) error {
display := fmt.Sprintf("%s: wiping", c.Name)
if err := c.Stop(ctx, l, 9, true /* wait */, 0 /* maxWait */, ""); err != nil {

Same with removing labels. We call this at the end of runTest

defer func() {
t.end = timeutil.Now()
if err := c.removeLabels([]string{VmLabelTestName}); err != nil {

@nameisbhaskar
Copy link
Contributor Author

Thats great! Then we should be good without this change. I will close this PR! Thanks for pointing out!!

@nameisbhaskar nameisbhaskar deleted the user/bhaskar/client-change branch May 29, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

roachprod: prometheus file_sd_config has missing labels
3 participants