-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stats formatting for riak-admin and http stats output #304
Changes from 7 commits
a3586aa
90ff951
0007f5c
c0c835f
24a8423
f8123cf
f7a5cb8
10d23ff
8710478
e1bf9b2
f044373
8e0b5ac
3b01e1c
aad62c4
b89702d
c53c138
2779987
a62d641
f2607cd
6288cc1
d331b94
fa1c284
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
%% -type microseconds() :: integer(). | ||
-define(SERVER, ?MODULE). | ||
-define(NOTIFY(A, B, Type, Arg), | ||
folsom_metrics:notify_existing_metric({?YZ_APP_NAME, A, B}, Arg, Type)). | ||
folsom_metrics:notify_existing_metric({search, A, B}, Arg, Type)). | ||
|
||
%% ------------------------------------------------------------------- | ||
%% API | ||
|
@@ -51,8 +51,14 @@ register_stats() -> | |
ok. | ||
|
||
%% @doc Return current aggregation of all stats. | ||
-spec get_stats() -> proplists:proplist() | {error, term()}. | ||
-spec get_stats() -> proplists:proplist() | []. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
get_stats() -> | ||
get_stats(?YZ_ENABLED). | ||
|
||
%% @doc Return current aggregation of all stats. | ||
-spec get_stats(false | true) -> proplists:proplist() | []. | ||
get_stats(false) -> []; | ||
get_stats(true) -> | ||
case riak_core_stat_cache:get_stats(?YZ_APP_NAME) of | ||
{ok, Stats, _TS} -> Stats; | ||
Error -> Error | ||
|
@@ -85,6 +91,41 @@ search_fail() -> | |
search_end(ElapsedTime) -> | ||
update({search_end, ElapsedTime}). | ||
|
||
%% @doc Optionally produce stats map based on ?YZ_ENABLED | ||
%% | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove empty comment line. |
||
-spec stats_map() -> [] | proplists:proplist(). | ||
stats_map() -> | ||
stats_map(?YZ_ENABLED). | ||
|
||
%% @doc Map to format stats for legacy "blob" if YZ_ENABLED, | ||
%% else [] | ||
%% | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty comment line. |
||
-spec stats_map(true | false) -> [] | proplists:proplist(). | ||
stats_map(false) -> []; | ||
stats_map(true) -> | ||
[ | ||
%% Query stats | ||
{search_query_throughput_count, {{search, 'query', throughput}, count}, spiral}, | ||
{search_query_throughput_one, {{search, 'query', throughput}, one}, spiral}, | ||
{search_query_latency_min, {{search, 'query', latency}, min}, histogram}, | ||
{search_query_latency_max, {{search, 'query', latency}, max}, histogram}, | ||
{search_query_latency_median, {{search, 'query', latency}, median}, histogram}, | ||
{search_query_latency_95, {{search, 'query', latency}, 95}, histogram_percentile}, | ||
{search_query_latency_99, {{search, 'query', latency}, 99}, histogram_percentile}, | ||
{search_query_latency_999, {{search, 'query', latency}, 999}, histogram_percentile}, | ||
|
||
%% Index stats | ||
{search_index_throughput_count, {{search, index, throughput}, count}, spiral}, | ||
{search_index_throughtput_one, {{search, index, throughput}, one}, spiral}, | ||
{search_index_fail_count, {{search, index, fail}, count}, spiral}, | ||
{search_index_fail_one, {{search, index, fail}, one}, spiral}, | ||
{search_index_latency_min, {{search, index, latency}, min}, histogram}, | ||
{search_index_latency_max, {{search, index, latency}, max}, histogram}, | ||
{search_index_latency_median, {{search, index, latency}, median}, histogram}, | ||
{search_index_latency_95, {{search, index, latency}, 95}, histogram_percentile}, | ||
{search_index_latency_99, {{search, index, latency}, 99}, histogram_percentile}, | ||
{search_index_latency_999, {{search, index, latency}, 999}, histogram_percentile}]. | ||
|
||
%% ------------------------------------------------------------------- | ||
%% Callbacks | ||
%% ------------------------------------------------------------------- | ||
|
@@ -126,10 +167,10 @@ notify({index_end, Time}) -> | |
notify(index_fail) -> | ||
?NOTIFY(index, fail, spiral, 1); | ||
notify({search_end, Time}) -> | ||
?NOTIFY(search, latency, histogram, Time), | ||
?NOTIFY(search, throughput, spiral, 1); | ||
?NOTIFY('query', latency, histogram, Time), | ||
?NOTIFY('query', throughput, spiral, 1); | ||
notify(search_fail) -> | ||
?NOTIFY(search, fail, spiral, 1). | ||
?NOTIFY('query', fail, spiral, 1). | ||
|
||
%% @private | ||
get_sample_type(Name) -> | ||
|
@@ -154,15 +195,15 @@ stats() -> | |
{[index, fail], spiral}, | ||
{[index, latency], histogram}, | ||
{[index, throughput], spiral}, | ||
{[search, fail], spiral}, | ||
{[search, latency], histogram}, | ||
{[search, throughput], spiral} | ||
{['query', fail], spiral}, | ||
{['query', latency], histogram}, | ||
{['query', throughput], spiral} | ||
]. | ||
|
||
%% @private | ||
-spec stat_name(riak_core_stat_q:path()) -> riak_core_stat_q:stat_name(). | ||
stat_name(Name) -> | ||
list_to_tuple([?YZ_APP_NAME|Name]). | ||
list_to_tuple([search|Name]). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert back to |
||
|
||
%% @private | ||
%% | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure all other systems using stats use the application name as first part of namespace. Part of me likes having the root of the namespace be
search
as that's what yokozuna is for but a bigger part of me wants to stay consistent with other areas of Riak which all namespace based on application.Change it back to
?YZ_APP_NAME
. The renaming will happen in thestats_map
.