Steps to reproduce
cd build
cmake --build . --target all
./examples/metrics_simple/metrics_ostream_example
What is the expected behavior?
The keys should be randomized between key1 through key5. If the program is run many times, key5 should statistically show up.
What is the actual behavior?
No matter how many times I run the example program, I never see key5.
Additional context
I was going through the examples and noticed this bug when running the metrics_ostream_example. I investigated the library and found that the get_random_attr method in examples/common/metrics_foo_library/foo_library.cc mods random_int() by labels.size() - 1 rather than just labels.size(). This means that the last key-val pair in labels (key5) will never be returned. The fix is to update the method to mod by labels.size() rather than labels.size() - 1
Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Steps to reproduce
What is the expected behavior?
The keys should be randomized between key1 through key5. If the program is run many times, key5 should statistically show up.
What is the actual behavior?
No matter how many times I run the example program, I never see key5.
Additional context
I was going through the examples and noticed this bug when running the
metrics_ostream_example. I investigated the library and found that theget_random_attrmethod inexamples/common/metrics_foo_library/foo_library.ccmodsrandom_int()bylabels.size() - 1rather than justlabels.size(). This means that the last key-val pair in labels (key5) will never be returned. The fix is to update the method to mod bylabels.size()rather thanlabels.size() - 1Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.