-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Couch Stats Resource Tracker (CSRT) #5491
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
Changes from 1 commit
175a76d
d99c812
922b3f8
375ec28
ada453e
9aadac4
1421a50
cba2e9c
020743f
975818e
a8dd0d6
f280d1b
ae419d6
57c19cd
2bfefd4
089f02d
a999033
e070513
befdfcb
11f9755
6fd6a29
fbd7455
04c588d
1063b8a
f6a7bf6
d973007
7211093
a7f3342
b58e04a
c9371ee
06da5f2
c41ac4f
e4198ed
720649d
0a6c556
7b96f89
3e4736a
7de1d96
e41e441
3074f77
5919cc2
39c4675
c489a61
9735ca7
6224242
97329a7
5166762
45a94e5
24d5626
6533bc7
7497f09
9016bd1
1db2e8d
73a5893
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -433,7 +433,12 @@ fabric_conf_key(Key) -> | |
| %% Double underscore to separate Mod and Func | ||
| "fabric_rpc__" ++ atom_to_list(Key). | ||
|
Contributor
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. That would be a great place to optimize in the future. Maybe add a TODO. One strategy is to implement the
Contributor
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. Maybe use memoize here fabric_conf_key(Key) ->
case persistent_term:get({{?MODULE, fabric_conf_key}, Key}, undefined) of
undefined ->
%% Double underscore to separate Mod and Func
ConfKey = "fabric_rpc__" ++ atom_to_list(Key),
ok = persistent_term:put({{?MODULE, fabric_conf_key}, Key}, ConfKey),
ConfKey;
ConfKey ->
ConfKey
end.
Contributor
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. I also came up with this ugly monster. -define(MEMOIZED(Id, Key, Body),
case persistent_term:get({{?MODULE, Id}, Key}, undefined) of
undefined ->
V = Body,
ok = persistent_term:put({{?MODULE, Id}, Key}, V),
V;
Value ->
Value
end
).
fabric_conf_key_m(Key) ->
?MEMOIZED(?FUNCTION_NAME, Key, "fabric_rpc__" ++ atom_to_list(Key)).This also works -define(MEMOIZED(Key, Body),
case persistent_term:get({{?MODULE, ?FUNCTION_NAME}, Key}, undefined) of
undefined ->
V = Body,
ok = persistent_term:put({{?MODULE, ?FUNCTION_NAME}, Key}, V),
V;
Value ->
Value
end
).
fabric_conf_key_m(Key) ->
?MEMOIZED(Key, "fabric_rpc__" ++ atom_to_list(Key)).
Contributor
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. And finally a version suitable for inclusion into couch_util to update similar places in CouchDB codebase % src/couch/include/couch_db.hrl
-define(PREFIXED_ATOM_AS_STRING(Prefix, Key), couch_util:prefixed_atom_as_string(?MODULE, Prefix, Key)).
% src/couch/src/couch_util.erl
prefixed_atom_as_string(Scope, Prefix, Key) ->
case persistent_term:get({{Scope, Prefix}, Key}, undefined) of
undefined ->
V = Prefix ++ atom_to_list(Key),
ok = persistent_term:put({{Scope, Prefix}, Key}, V),
V;
Value ->
Value
end.
% src/couch_stats/src/csrt_util.erl
fabric_conf_key(Key) ->
?PREFIXED_ATOM_AS_STRING("fabric_rpc__", Key). |
||
|
|
||
| -spec rctx_record_info() -> #{fields => [rctx_field()], size => pos_integer(), field_idx => #{rctx_field() => pos_integer()}}. | ||
| -spec rctx_record_info() -> | ||
| #{ | ||
| fields => [rctx_field()], | ||
| size => pos_integer(), | ||
| field_idx => #{rctx_field() => pos_integer()} | ||
| }. | ||
| rctx_record_info() -> | ||
| Fields = record_info(fields, rctx), | ||
| Size = record_info(size, rctx), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.