|
61 | 61 | %% Raises telemetry event
|
62 | 62 | %% name: [?MODULE, request]
|
63 | 63 | %% measurements: #{hit => boolean(), time => microsecond()}
|
| 64 | +%% metadata: #{name => atom()} |
64 | 65 | -spec is_member(name(), term()) -> boolean().
|
65 | 66 | is_member(Name, Key) when is_atom(Name) ->
|
66 | 67 | T1 = erlang:monotonic_time(),
|
67 | 68 | Value = iterate_fun_in_tables(Name, Key, fun ?MODULE:is_member_fun/2),
|
68 | 69 | T2 = erlang:monotonic_time(),
|
69 | 70 | Time = erlang:convert_time_unit(T2 - T1, native, microsecond),
|
70 |
| - telemetry:execute([?MODULE, request], (measurements())#{time := Time, hit := Value =:= true}), |
| 71 | + telemetry:execute([?MODULE, request], |
| 72 | + (measurements())#{time := Time, hit := Value =:= true}, |
| 73 | + #{name => Name}), |
71 | 74 | Value.
|
72 | 75 |
|
73 | 76 | %% @doc Get the entry for Key in cache
|
74 | 77 | %%
|
75 | 78 | %% Raises telemetry event
|
76 | 79 | %% name: [?MODULE, request]
|
77 | 80 | %% measurements: #{hit => boolean(), time => microsecond()}
|
| 81 | +%% metadata: #{name => atom()} |
78 | 82 | -spec get_entry(name(), term()) -> term() | not_found.
|
79 | 83 | get_entry(Name, Key) when is_atom(Name) ->
|
80 | 84 | T1 = erlang:monotonic_time(),
|
81 | 85 | Value = iterate_fun_in_tables(Name, Key, fun ?MODULE:get_entry_fun/2),
|
82 | 86 | T2 = erlang:monotonic_time(),
|
83 | 87 | Time = erlang:convert_time_unit(T2 - T1, native, microsecond),
|
84 |
| - telemetry:execute([?MODULE, request], (measurements())#{time := Time, hit := Value =/= not_found}), |
| 88 | + telemetry:execute([?MODULE, request], |
| 89 | + (measurements())#{time := Time, hit := Value =/= not_found}, |
| 90 | + #{name => Name}), |
85 | 91 | Value.
|
86 | 92 |
|
87 | 93 | %% @doc Add an entry to the first table in the segments.
|
|
0 commit comments