Permalink
Browse files

Update specs: counters and gauges can take negative ints too

  • Loading branch information...
RJ committed Jun 20, 2012
1 parent bdb4596 commit 370a703faa23824c53ad00d6bd037493ecc66b6c
Showing with 8 additions and 8 deletions.
  1. +4 −4 src/stetson.erl
  2. +4 −4 src/stetson_server.erl
View
@@ -40,19 +40,19 @@ start() -> application:start(?MODULE).
%% @doc
stop() -> application:stop(?MODULE).
--spec counter(atom(), pos_integer()) -> ok.
+-spec counter(atom(), integer()) -> ok.
%% @doc
counter(Stat, Step) -> stetson_server:cast({counter, Stat, Step}).
--spec counter(atom() | string(), pos_integer(), float()) -> ok.
+-spec counter(atom() | string(), integer(), float()) -> ok.
%% @doc
counter(Bucket, Step, Rate) -> stetson_server:cast({counter, Bucket, Step, Rate}).
--spec gauge(atom(), pos_integer()) -> ok.
+-spec gauge(atom(), integer()) -> ok.
%% @doc
gauge(Stat, Step) -> stetson_server:cast({gauge, Stat, Step}).
--spec gauge(atom() | string(), pos_integer(), float()) -> ok.
+-spec gauge(atom() | string(), integer(), float()) -> ok.
%% @doc
gauge(Bucket, Step, Rate) -> stetson_server:cast({gauge, Bucket, Step, Rate}).
View
@@ -28,8 +28,8 @@
-type message() :: {connect, pid(), inet:socket(), erlang:timestamp()} |
{establish, pid(), node()} |
- {counter | gauge | timer, atom(), pos_integer()} |
- {counter | gauge | timer, atom(), pos_integer(), float()}.
+ {counter | gauge | timer, atom(), integer()} |
+ {counter | gauge | timer, atom(), integer(), float()}.
-export_type([message/0]).
@@ -94,7 +94,7 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}.
%% Private
%%
--spec stat(#s{}, counter | gauge | timer, string() | atom(), pos_integer(), float()) -> ok.
+-spec stat(#s{}, counter | gauge | timer, string() | atom(), integer(), float()) -> ok.
%% @private Create a statistic entry with a sample rate
stat(State, Type, Bucket, N, Rate) when Rate < 1.0 ->
case {Type, random:uniform() =< Rate} of
@@ -104,7 +104,7 @@ stat(State, Type, Bucket, N, Rate) when Rate < 1.0 ->
_ -> ok
end.
--spec stat(#s{}, counter | gauge | timer, string() | atom(), pos_integer()) -> ok.
+-spec stat(#s{}, counter | gauge | timer, string() | atom(), integer()) -> ok.
%% @doc Create a statistic entry with no sample rate
stat(State, counter, Bucket, N) ->
send(State, "~s:~p|c", [Bucket, N]);

0 comments on commit 370a703

Please sign in to comment.