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

fix: correctly handle __raw_url__ by replacing url with it if present #72

Merged
merged 4 commits into from
Mar 5, 2025

Conversation

nadiamoe
Copy link
Member

@nadiamoe nadiamoe commented Mar 3, 2025

This PR introduced special handling for the __raw_url__ tag, which matches what the agent would expect as per grafana/synthetic-monitoring-agent#683.

It also adds tests to assert that the label is correclty replaced, and that __raw_url__ is removed from the output, as otherwise it would make the output invalid as per the prometheus spec.

@nadiamoe nadiamoe force-pushed the raw-url-handling branch 2 times, most recently from 8a92a01 to f92bd13 Compare March 3, 2025 10:08
@nadiamoe
Copy link
Member Author

nadiamoe commented Mar 3, 2025

Still testing this in dev, but should be reviewable in the meantime.

@nadiamoe nadiamoe marked this pull request as ready for review March 3, 2025 14:00
@nadiamoe nadiamoe requested a review from a team as a code owner March 3, 2025 14:00
@nadiamoe nadiamoe requested review from mem and ka3de March 3, 2025 14:00
Comment on lines -38 to +46
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
t.Cleanup(cancel)

outFile := filepath.Join(t.TempDir(), "metrics.txt")

cmd := exec.CommandContext(ctx, smk6, "run", "-", "-o=sm="+outFile)
cmd.Stdin = bytes.NewReader(testScript)
err = cmd.Run()
if err != nil {
t.Fatalf("running sm-k6: %v", err)
if k6out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("running sm-k6: %v\n%s", errors.Join(err, ctx.Err()), string(k6out))
Copy link
Member Author

Choose a reason for hiding this comment

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

I struggled to reliably get tests to pass without this. I'll probably get rid of these changes in favor of #73, when and if it gets merged.

@nadiamoe
Copy link
Member Author

nadiamoe commented Mar 3, 2025

To my best knowledge, nothing seems broken. I deployed the change in dev at 15:21 in this screenshot time.

image

Omw to test multihttp with interpolation now.

@nadiamoe nadiamoe requested a review from d0ugal March 5, 2025 13:10
@nadiamoe
Copy link
Member Author

nadiamoe commented Mar 5, 2025

Sorry for tagging you directly @d0ugal, but I think you now have a decent hunk of context for this. Hopefully this is a simple change to review!

@nadiamoe nadiamoe merged commit 8873a57 into main Mar 5, 2025
11 checks passed
@nadiamoe nadiamoe deleted the raw-url-handling branch March 5, 2025 15:20
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.

2 participants