Skip to content

Commit

Permalink
make elvis happy again
Browse files Browse the repository at this point in the history
  • Loading branch information
deadtrickster committed Apr 27, 2021
1 parent 634ccc6 commit 2519bcd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion elvis.config
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
filter => "prometheus_model_helpers.erl",
rules => [
{elvis_style, line_length,
#{limit => 80}},
#{limit => 120}},
{elvis_style, invalid_dynamic_call,
#{ignore => [
%% FIXME: why create_mf calls collect_metrics??
Expand Down
8 changes: 4 additions & 4 deletions src/metrics/prometheus_quantile_summary.erl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ deregister(Registry, Name) ->
set_default(Registry, Name) ->
Configuration = get_configuration(Registry, Name),
#{compress_limit := CompressLimit} = Configuration,
ets:insert_new(?TABLE,{
ets:insert_new(?TABLE, {
key(Registry, Name, []),
0,
0,
Expand Down Expand Up @@ -340,7 +340,7 @@ collect_mf(Registry, Callback) ->

%% @private
collect_metrics(Name, {CLabels, Labels, Registry, DU, Configuration}) ->
#{quantiles := QNs} = Configuration,
#{quantiles := QNs} = Configuration,
MFValues = load_all_values(Registry, Name),
ReducedMap = lists:foldl(
fun([L, C, S, QE], ResAcc) ->
Expand Down Expand Up @@ -373,7 +373,7 @@ validate_summary_spec(Spec) ->
{Invariant, QNs} = invariant_and_quantiles_from_spec(Spec),
CompressLimit = compress_limit_from_spec(Spec),
[
{data,
{data,
#{quantiles => QNs,
invariant => Invariant,
compress_limit => CompressLimit}}
Expand Down Expand Up @@ -444,7 +444,7 @@ validate_targets(Targets) when is_list(Targets) ->
erlang:error({invalid_targets, "target quantile value should be float"});
({_Q, E}) when not is_float(E) ->
erlang:error({invalid_targets, "target error value should be float"});
({_, _}) ->
({_, _}) ->
ok;
(_) ->
erlang:error({invalid_targets, "targets should be tuples of quantile and error"})
Expand Down
28 changes: 14 additions & 14 deletions test/eunit/format/prometheus_protobuf_format_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ test_quantile_summary(_) ->
prometheus_quantile_summary:observe(orders_quantile_summary, 10),
prometheus_quantile_summary:observe(orders_quantile_summary, 15),

Expected = <<132,1,10,23,111,114,100,101,114,115,95,113,117,97,110,116,
105,108,101,95,115,117,109,109,97,114,121,18,28,84,114,97,
99,107,32,111,114,100,101,114,115,32,99,111,117,110,116,47,
116,111,116,97,108,32,115,117,109,24,2,34,73,34,71,8,2,17,0,
0,0,0,0,0,57,64,26,18,9,0,0,0,0,0,0,224,63,17,0,0,0,0,0,0,
46,64,26,18,9,205,204,204,204,204,204,236,63,17,0,0,0,0,0,0,
46,64,26,18,9,102,102,102,102,102,102,238,63,17,0,0,0,0,0,0,
46,64>>,
Expected = <<132, 1, 10, 23, 111, 114, 100, 101, 114, 115, 95, 113, 117, 97, 110, 116,
105, 108, 101, 95, 115, 117, 109, 109, 97, 114, 121, 18, 28, 84, 114, 97,
99, 107, 32, 111, 114, 100, 101, 114, 115, 32, 99, 111, 117, 110, 116, 47,
116, 111, 116, 97, 108, 32, 115, 117, 109, 24, 2, 34, 73, 34, 71, 8, 2, 17, 0,
0, 0, 0, 0, 0, 57, 64, 26, 18, 9, 0, 0, 0, 0, 0, 0, 224, 63, 17, 0, 0, 0, 0, 0, 0,
46, 64, 26, 18, 9, 205, 204, 204, 204, 204, 204, 236, 63, 17, 0, 0, 0, 0, 0, 0,
46, 64, 26, 18, 9, 102, 102, 102, 102, 102, 102, 238, 63, 17, 0, 0, 0, 0, 0, 0,
46, 64>>,
?_assertEqual(Expected,
prometheus_protobuf_format:format()).

Expand All @@ -99,12 +99,12 @@ test_quantile_dsummary(_) ->
prometheus_quantile_summary:observe(quantile_dsummary, 1.5),
prometheus_quantile_summary:observe(quantile_dsummary, 2.7),

Expected = <<101,10,17,113,117,97,110,116,105,108,101,95,100,115,117,109,
109,97,114,121,18,3,113,119,101,24,2,34,73,34,71,8,2,17,205,
204,204,204,204,204,16,64,26,18,9,0,0,0,0,0,0,224,63,17,154,
153,153,153,153,153,5,64,26,18,9,205,204,204,204,204,204,
236,63,17,154,153,153,153,153,153,5,64,26,18,9,102,102,102,
102,102,102,238,63,17,154,153,153,153,153,153,5,64>>,
Expected = <<101, 10, 17, 113, 117, 97, 110, 116, 105, 108, 101, 95, 100, 115, 117, 109,
109, 97, 114, 121, 18, 3, 113, 119, 101, 24, 2, 34, 73, 34, 71, 8, 2, 17, 205,
204, 204, 204, 204, 204, 16, 64, 26, 18, 9, 0, 0, 0, 0, 0, 0, 224, 63, 17, 154,
153, 153, 153, 153, 153, 5, 64, 26, 18, 9, 205, 204, 204, 204, 204, 204,
236, 63, 17, 154, 153, 153, 153, 153, 153, 5, 64, 26, 18, 9, 102, 102, 102,
102, 102, 102, 238, 63, 17, 154, 153, 153, 153, 153, 153, 5, 64>>,
?_assertEqual(Expected,
prometheus_protobuf_format:format()).

Expand Down

0 comments on commit 2519bcd

Please sign in to comment.