-
Notifications
You must be signed in to change notification settings - Fork 43
Conversation
common/context.go
Outdated
) | ||
|
||
var rnd = rand.New(rand.NewSource(time.Now().UnixNano())) //nolint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not happy with this global, but I don't think we need to pass it somewhere from BrowserType
, and it would be slightly awkward, so I don't mind it much. EDIT: Seems like I'll have to get rid of it, judging by the CI data race 😓
Though I'm currently running into an issue on this branch after a few minutes of stress testing that ends with:
panic: GoError: launching browser: inotify_init() failed: Too many open files (24)
... which is strange, since a) my ulimit -n
is set to 50000
, and b) I don't see how the changes here could cause it, unless this line does it somehow. Initially I had this inside WithTraceID()
, and thought that might be the issue, but I moved it to a global, and still see the error. I haven't run into it on Correction: I have now also seen this on main
, so I'm skeptical it's something here.main
, so it's not related to these changes.
Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I moved it to NewBrowserType()
in f01e97e.
Still, please (stress) test this and let me know if you run into any issues.
Cool! I like this idea. I'll review it tomorrow. By the way, IMO, Asking out of curiosity, what is the reason we don't just increment a counter for each iteration like |
Good point. I suppose we could, though I wanted to leave this open for other use cases besides tracking iterations. Though if we were to add another tracing ID then it should definitely be called something more unique. So, sure, I'll rename it to
I briefly considered exposing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This would've been very useful when debugging the issues i've worked on recently 🙂
Maybe worth renaming it to iterationID
, since traceID
is generally the term used in microservices to trace a request through a system... actually, i guess it's being used in the same way, so traceID
might be ok. I wonder if there's a way to feed the logs through Tempo 🤔 😄
@ankur22 Yeah, I renamed it to I do think we'll want to expand this if we want to fully implement grafana/k6#4441, so that we can trace unique components and actions. That's why I was somewhat reluctant to rename everything here to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I have some non-blocking suggestions. Feel free to apply them or not 👍
This allows us to trace a single k6 iteration across the application.
Co-authored-by: İnanç Gümüş <inanc.gumus@grafana.com>
7642c45
to
fd3e409
Compare
This adds an
iteration_id
field to all log events that uniquely identifies a k6 iteration, and thus a single browser start/stop cycle. I'm finding it relatively useful when testing issues like grafana/k6#4417 that only happen when stress testing the entiretests
package, and not a single test in isolation, since I can filter log events for a specific iteration.It's only added to events when
XK6_BROWSER_LOG
is set todebug
ortrace
.Related to grafana/k6#4441