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

feat: benchmarking option in CLI #70

Merged
merged 4 commits into from
Apr 10, 2024
Merged

feat: benchmarking option in CLI #70

merged 4 commits into from
Apr 10, 2024

Conversation

polok
Copy link
Contributor

@polok polok commented Apr 6, 2024

What's done

Introduced an option to benchmark feature/variation/variable evaluations from CLI as JS SDK did (more info here)

API

Read more in README (in diff).

To run benchmarking for a feature:

$  FeaturevisorTestRunner benchmark \
  --environment staging \
  --feature feature_key \
  --context '{"user_id":"123"}' \
  -n 100

Output will be similar to this:

Running benchmark for feature mob_eos_ios...
Building datafile containing all features for staging...
Datafile build duration: 0.197859334s
...SDK initialized
Against context: ["user_id": FeaturevisorTypes.AttributeValue.string("123")]
Evaluating flag 100 times...
Evaluated value : Optional(true)
Total duration  : 0.9339580000000001ms
Average duration: 0.00933958ms

@polok polok requested a review from a team as a code owner April 6, 2024 22:06
@fahad19
Copy link
Member

fahad19 commented Apr 7, 2024

great stuff as always, @polok!

a note about future (not this PR), given the test runner in Swift is going a bit beyond just running tests, we may want to rethink how we wish to name it more generic instead of FeaturevisorTestRunner.

@polok
Copy link
Contributor Author

polok commented Apr 8, 2024

@fahad19 Yessss, I thought about the same when introduced new command benchmark and putting existing under command test. It's more like featurevisor-swift CLI now (maybe FeaturevisorSwift or FeaturevisorSwiftCLI). What do you think?

@fahad19
Copy link
Member

fahad19 commented Apr 8, 2024

@polok: I like your suggestion very much!

I expect more SDKs to be released this year, and having language specific command names for each of them would be very handy, like:

  • $ featurevisor-swift
  • $ featurevisor-go

I also understand that not all languages would want to expose their CLIs as an independent binary (like Go might).

so it's perfectly fine if they are run via task runners like $ gradle and in the case of Swift $ swift.

it's the subcommands like benchmark, test, evaluate along with their options/flags that I would focus more on for maintaining feature parity: https://featurevisor.com/docs/cli/

@polok polok merged commit 3d6eb94 into main Apr 10, 2024
1 check passed
@polok polok deleted the feature_benchmark branch April 10, 2024 17:19
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.

4 participants