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

Report usage of the crypto #4575

Open
olegbespalov opened this issue Feb 20, 2025 · 0 comments
Open

Report usage of the crypto #4575

olegbespalov opened this issue Feb 20, 2025 · 0 comments
Labels
area: webcrypto evaluation needed proposal needs to be validated or tested before fully implementing it in k6

Comments

@olegbespalov
Copy link
Contributor

olegbespalov commented Feb 20, 2025

What?

We've made the webcrypto available as crypto globally in #4278. The way how we report module statistics excludes it, but for us, it's still good to know what's the usage which could help us understand if we should invest more into the development.

@mstoykov made a solid statement that we might not need statistics because WebCrypto API is a standard, so we should invest in it regardless, that's why it's worth firstly trying to find consensus if this task makes sense at all. But for now, I'm just documenting this fact of excluding from reports.

As the potential way of doing that could be

k6/internal/js/bundle.go

Lines 403 to 413 in 1e9994c

globalThis := rt.GlobalObject()
err = globalThis.DefineAccessorProperty("global",
rt.ToValue(func() sobek.Value {
if err := b.preInitState.Usage.Uint64("usage/global", 1); err != nil {
b.preInitState.Logger.WithError(err).Warn("couldn't report usage")
}
return globalThis
}), rt.ToValue(func(newGlobal *sobek.Object) { // probably not a thing that will happen but still
globalThis = newGlobal
}),
sobek.FLAG_TRUE, sobek.FLAG_TRUE)

Why?

Even the crypto (WebCrypto API) is a standard it doesn't look so far from the other k6's modules and having numbers along with the others to make a future decisions might be a good idea.

@olegbespalov olegbespalov added area: webcrypto evaluation needed proposal needs to be validated or tested before fully implementing it in k6 labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: webcrypto evaluation needed proposal needs to be validated or tested before fully implementing it in k6
Projects
None yet
Development

No branches or pull requests

1 participant