Skip to content

Commit 1837af9

Browse files
authored
Merge branch 'main' into temporality
2 parents d446938 + efc87f3 commit 1837af9

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- [Add `instrument_unit` to view criteria](https://github.com/open-telemetry/opentelemetry-erlang/pull/604)
2626
- [Validate instrument name](https://github.com/open-telemetry/opentelemetry-erlang/pull/604)
2727

28-
### Fixed
28+
### Changes
29+
30+
- [Align histogram default boundaries with specification](https://github.com/open-telemetry/opentelemetry-erlang/pull/614)
31+
32+
### Fixes
2933

30-
- [Readers should use a default cumulative temporality if not specified](https://github.com/open-telemetry/opentelemetry-erlang/pull/613)
34+
- [Correctly record histogram values greater than last boundary](https://github.com/open-telemetry/opentelemetry-erlang/pull/614)
35+
- [Readers should use a default cumulative temporality if not specified](https://github.com/open-telemetry/opentelemetry-erlang/pull/613)
3136

3237
## SDK 1.3.1 - 2023-08-15
3338

apps/opentelemetry_experimental/src/otel_aggregation_histogram_explicit.erl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
-export_type([t/0]).
3434

35-
-define(DEFAULT_BOUNDARIES, [0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 1000.0]).
35+
-define(DEFAULT_BOUNDARIES, [0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 750.0, 1000.0, 2500.0, 5000.0, 7500.0, 10000.0]).
3636

3737
-include_lib("stdlib/include/ms_transform.hrl").
3838

@@ -280,8 +280,6 @@ find_bucket(Boundaries, Value) ->
280280

281281
find_bucket([X | _Rest], Value, Pos) when Value =< X ->
282282
Pos;
283-
find_bucket([_X], _Value, Pos) ->
284-
Pos;
285283
find_bucket([_X | Rest], Value, Pos) ->
286284
find_bucket(Rest, Value, Pos+1);
287285
find_bucket(_, _, Pos) ->
@@ -290,12 +288,12 @@ find_bucket(_, _, Pos) ->
290288
get_buckets(BucketCounts, Boundaries) ->
291289
lists:foldl(fun(Idx, Acc) ->
292290
Acc ++ [counters_get(BucketCounts, Idx)]
293-
end, [], lists:seq(1, length(Boundaries))).
291+
end, [], lists:seq(1, length(Boundaries) + 1)).
294292

295293
counters_get(undefined, _) ->
296294
0;
297295
counters_get(Counter, Idx) ->
298296
counters:get(Counter, Idx).
299297

300298
new_bucket_counts(Boundaries) ->
301-
counters:new(length(Boundaries), [write_concurrency]).
299+
counters:new(length(Boundaries) + 1, [write_concurrency]).

apps/opentelemetry_experimental/test/otel_metrics_SUITE.erl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ float_histogram(_Config) ->
326326
min=Min,
327327
max=Max,
328328
sum=Sum} <- Datapoints],
329-
?assertEqual([], [{#{<<"c">> => <<"b">>}, [0,1,1,2,0,0,0,0,0,0], 5, 10.3, 31.1}]
329+
?assertEqual([], [{#{<<"c">> => <<"b">>}, [0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0], 5, 10.3, 31.1}]
330330
-- AttributeBuckets, AttributeBuckets)
331331
after
332332
5000 ->
@@ -529,11 +529,11 @@ explicit_histograms(_Config) ->
529529

530530
otel_meter_server:add_view(#{instrument_name => a_histogram}, #{}),
531531

532-
533532
?assertEqual(ok, otel_histogram:record(Histogram, 20, #{<<"c">> => <<"b">>})),
534533
?assertEqual(ok, otel_histogram:record(Histogram, 30, #{<<"a">> => <<"b">>, <<"d">> => <<"e">>})),
535534
?assertEqual(ok, otel_histogram:record(Histogram, 44, #{<<"c">> => <<"b">>})),
536535
?assertEqual(ok, otel_histogram:record(Histogram, 100, #{<<"c">> => <<"b">>})),
536+
?assertEqual(ok, otel_histogram:record(Histogram, 20000, #{<<"c">> => <<"b">>})),
537537

538538
otel_meter_server:force_flush(),
539539

@@ -546,8 +546,8 @@ explicit_histograms(_Config) ->
546546
min=Min,
547547
max=Max,
548548
sum=Sum} <- Datapoints]),
549-
?assertEqual([], [{#{<<"c">> => <<"b">>}, [0,0,0,1,1,0,1,0,0,0], 20, 100, 164},
550-
{#{<<"a">> => <<"b">>, <<"d">> => <<"e">>}, [0,0,0,0,1,0,0,0,0,0], 30, 30, 30}]
549+
?assertEqual([], [{#{<<"c">> => <<"b">>}, [0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1], 20, 20000, 20164},
550+
{#{<<"a">> => <<"b">>, <<"d">> => <<"e">>}, [0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0], 30, 30, 30}]
551551
-- AttributeBuckets, AttributeBuckets)
552552
after
553553
5000 ->
@@ -595,8 +595,8 @@ delta_explicit_histograms(_Config) ->
595595
min=Min,
596596
max=Max,
597597
sum=Sum} <- Datapoints]),
598-
?assertEqual([], [{#{<<"c">> => <<"b">>}, [0,0,0,1,1,0,1,0,0,0], 20, 100, 164},
599-
{#{<<"a">> => <<"b">>, <<"d">> => <<"e">>}, [0,0,0,0,1,0,0,0,0,0], 30, 30, 30}]
598+
?assertEqual([], [{#{<<"c">> => <<"b">>}, [0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0], 20, 100, 164},
599+
{#{<<"a">> => <<"b">>, <<"d">> => <<"e">>}, [0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0], 30, 30, 30}]
600600
-- AttributeBuckets, AttributeBuckets)
601601
after
602602
5000 ->
@@ -616,9 +616,9 @@ delta_explicit_histograms(_Config) ->
616616
min=Min,
617617
max=Max,
618618
sum=Sum} <- Datapoints1],
619-
?assertEqual([], [{#{<<"c">> => <<"b">>}, [0,0,0,0,0,0,1,0,0,0], 88, 88, 88},
619+
?assertEqual([], [{#{<<"c">> => <<"b">>}, [0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0], 88, 88, 88},
620620
{#{<<"a">> => <<"b">>,<<"d">> => <<"e">>},
621-
[0,0,0,0,0,0,0,0,0,0],
621+
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
622622
infinity,-9.223372036854776e18,0}
623623
]
624624
-- AttributeBuckets1, AttributeBuckets1)

0 commit comments

Comments
 (0)