File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
examples/common/metrics_foo_library Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 44#include < stdint.h>
55#include < stdlib.h>
66#include < chrono>
7+ #include < cmath>
78#include < map>
89#include < thread>
910#include < utility>
@@ -168,9 +169,10 @@ void foo_library::semconv_histogram_example()
168169 for (uint32_t i = 0 ; i < 20 ; ++i)
169170 {
170171 double val = (rand () % 700 ) + 1.1 ;
172+ uint64_t int_val = std::llround (val);
171173 std::map<std::string, std::string> labels = get_random_attr ();
172174 auto labelkv = opentelemetry::common::KeyValueIterableView<decltype (labels)>{labels};
173- histogram_counter->Record (val , labelkv, context);
175+ histogram_counter->Record (int_val , labelkv, context);
174176 std::this_thread::sleep_for (std::chrono::milliseconds (250 ));
175177 }
176178}
You can’t perform that action at this time.
0 commit comments