mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
test: reference test for encoding size
This commit is contained in:
parent
ee8542ea0e
commit
6e8877f177
3 changed files with 25 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
(tests
|
||||
(names test_trace_context)
|
||||
(names test_trace_context t_size)
|
||||
(package opentelemetry)
|
||||
(libraries opentelemetry))
|
||||
(libraries opentelemetry opentelemetry.client))
|
||||
|
|
|
|||
1
tests/core/t_size.expected
Normal file
1
tests/core/t_size.expected
Normal file
|
|
@ -0,0 +1 @@
|
|||
metrics size: 492B
|
||||
22
tests/core/t_size.ml
Normal file
22
tests/core/t_size.ml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(* test the size of serialized data *)
|
||||
|
||||
open Opentelemetry
|
||||
|
||||
let m =
|
||||
Metrics.make_resource_metrics
|
||||
[
|
||||
Metrics.sum ~name:"sum.foo"
|
||||
[
|
||||
Metrics.int ~start_time_unix_nano:42L ~now:45L 10;
|
||||
Metrics.int ~start_time_unix_nano:52L ~now:55L 20;
|
||||
];
|
||||
Metrics.gauge ~name:"gauge.bar"
|
||||
[
|
||||
Metrics.float ~start_time_unix_nano:42L ~now:45L 10.;
|
||||
Metrics.float ~start_time_unix_nano:52L ~now:55L 20.;
|
||||
];
|
||||
]
|
||||
|
||||
let () =
|
||||
let str = Opentelemetry_client.Signal.Encode.metrics [ m; m ] in
|
||||
Printf.printf "metrics size: %dB\n" (String.length str)
|
||||
Loading…
Add table
Reference in a new issue