exometer_core icon indicating copy to clipboard operation
exometer_core copied to clipboard

Problem with spec of function match datapoints

Open mmzeeman opened this issue 4 years ago • 0 comments

There is a problem with the match spec when registering a datapoint like this:

ok = exometer:new([erlang, gc],
    {function, erlang, statistics, [garbage_collection], match, {total_coll, rec_wrd, '_'}})

Dialyzer Error

 289: The call exometer:new(['erlang', 'gc'], {'function', 'erlang', 'statistics', ['garbage_collection'], 'match', {'total_coll', 'rec_wrd', '_'}}) will never return since the success typing is ([any()], atom() | {atom(),_} | {'function',atom(),atom()} | {'function',atom(),atom(),[any()],atom(),[any()]}) -> 'ok' and the contract is (name(), type()) -> 'ok'

Dialyzer flags this as a type error because the datapoints() in match expressions is defined as a list. But for match expressions it is defined in the documentation that this should be a match expression. See: https://github.com/Feuerlabs/exometer_core/blob/master/doc/exometer_function.md

mmzeeman avatar Jan 13 '21 10:01 mmzeeman