Skip to content

Commit 19b2011

Browse files
authored
bump to 1.8.0 (#105)
* fix: doc don't show when otp 27 * feat: support show ets size and go to specific pid * chore: bump to 1.8.0 * chore: remove eqwalizer_rebar3 deps * chore: add dialyzer for ci
1 parent 505b3ac commit 19b2011

15 files changed

+210
-92
lines changed

.github/workflows/erlang.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ jobs:
2020
run: rebar3 compile
2121
- name: xref
2222
run: rebar3 xref
23+
- name: dialyzer
24+
run: rebar3 dialyzer
2325

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ Visualize Erlang/Elixir Nodes On The Command Line base on [recon](https://github
2727
%% rebar.config
2828
{deps, [observer_cli]}
2929
%% erlang.mk
30-
dep_observer_cli = hex 1.7.5
30+
dep_observer_cli = hex 1.8.0
3131
```
3232

3333
**Elixir**
3434

3535
```elixir
3636
# mix.exs
3737
def deps do
38-
[{:observer_cli, "~> 1.7"}]
38+
[{:observer_cli, "~> 1.8"}]
3939
end
4040
```
4141

@@ -89,7 +89,7 @@ _build/dev/rel/example/bin/example rpc ":observer_cli.start"
8989

9090
### DEMO
9191

92-
<img src="https://user-images.githubusercontent.com/3116225/39091211-55554414-4622-11e8-8b28-bd3b5c7e17a6.jpg" width="100%" alt="Home"> </img>
92+
<img src="https://github.com/user-attachments/assets/ce797033-732a-4178-a9c5-df4de559ed0c" width="100%" alt="Home"> </img>
9393

9494
### How to write your own plugin?
9595

@@ -255,7 +255,12 @@ Support F/B to page up/down.
255255
---
256256

257257
### Changelog
258-
258+
- 1.8.0
259+
- Support `<Pid` to jump to specific pid.
260+
- Show process's label if it's set with [proc_lib:set_label(Label)](https://www.erlang.org/doc/apps/stdlib/proc_lib.html#set_label/1)
261+
- Show The number of bytes in the output distribution queue on System View. This queue sits between the Erlang code and the port driver, using undocumented function`erlang:dist_get_stat/1`.
262+
- Fix Doc View not show when otp version = 27
263+
259264
- 1.7.5
260265
- Fix crash when mnesia table with external copies.
261266
Which `mnesia:table_info(TabName, storage_type)` returns tuple `{ext, _, _}`

mix.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ defmodule ObserverCli.MixProject do
44
def project do
55
[
66
app: :observer_cli,
7-
version: "1.7.5",
7+
version: "1.8.0",
88
language: :erlang,
99
description: "observer in shell",
1010
deps: [
11-
{:recon, "~> 2.5.1"},
11+
{:recon, "~> 2.5.6"},
1212
]
1313
]
1414
end

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
%{
2-
"recon": {:hex, :recon, "2.5.1", "430ffa60685ac1efdfb1fe4c97b8767c92d0d92e6e7c3e8621559ba77598678a", [:mix, :rebar3], [], "hexpm"},
2+
"recon": {:hex, :recon, "2.5.6", "9052588e83bfedfd9b72e1034532aee2a5369d9d9343b61aeb7fbce761010741", [:mix, :rebar3], [], "hexpm", "96c6799792d735cc0f0fd0f86267e9d351e63339cbe03df9d162010cefc26bb0"},
33
}

rebar.config

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,12 @@
1818
]}.
1919
{deps_dir, "deps"}.
2020
{deps, [
21-
recon,
22-
{eqwalizer_support,
23-
{git_subdir, "https://github.com/whatsapp/eqwalizer.git", {branch, "main"},
24-
"eqwalizer_support"}}
21+
recon
2522
]}.
2623

2724
{project_plugins, [
2825
rebar3_format,
29-
erlfmt,
30-
{eqwalizer_rebar3,
31-
{git_subdir, "https://github.com/whatsapp/eqwalizer.git", {branch, "main"},
32-
"eqwalizer_rebar3"}}
26+
erlfmt
3327
]}.
3428

3529
{escript_main_app, observer_cli}.

rebar.lock

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
{"1.2.0",
2-
[{<<"eqwalizer_support">>,
3-
{git_subdir,"https://github.com/whatsapp/eqwalizer.git",
4-
{ref,"0c099bbfa2fba1869d60e239c9b2cf2b6fb31ea9"},
5-
"eqwalizer_support"},
6-
0},
7-
{<<"recon">>,{pkg,<<"recon">>,<<"2.5.5">>},0}]}.
2+
[{<<"recon">>,{pkg,<<"recon">>,<<"2.5.6">>},0}]}.
83
[
94
{pkg_hash,[
10-
{<<"recon">>, <<"C108A4C406FA301A529151A3BB53158CADC4064EC0C5F99B03DDB8C0E4281BDF">>}]},
5+
{<<"recon">>, <<"9052588E83BFEDFD9B72E1034532AEE2A5369D9D9343B61AEB7FBCE761010741">>}]},
116
{pkg_hash_ext,[
12-
{<<"recon">>, <<"632A6F447DF7CCC1A4A10BDCFCE71514412B16660FE59DECA0FCF0AA3C054404">>}]}
7+
{<<"recon">>, <<"96C6799792D735CC0F0FD0F86267E9D351E63339CBE03DF9D162010CEFC26BB0">>}]}
138
].

src/observer_cli.app.src

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
{application, observer_cli,
2-
[
3-
{description, "Visualize Erlang Nodes On The Command Line"},
4-
{vsn, "1.7.5"},
5-
{modules, [
6-
observer_cli
7-
]},
8-
{registered, []},
9-
{applications, [
10-
kernel,
11-
stdlib,
12-
recon
13-
]},
14-
{files, ["include",
15-
"LICENSE*",
16-
"mix.exs",
17-
"mix.lock",
18-
"README.md",
19-
"rebar.config",
20-
"rebar.lock",
21-
"src"]},
22-
{build_tools, ["mix", "rebar3"]},
23-
{env, [
24-
{scheduler_usage, disable},
25-
{plugins,
26-
[
27-
%% module - Specific module implements plugin behavior. It's mandatory.
28-
%% title - Menu title. It's mandatory.
29-
%% shortcut - Switch plugin by shortcut. It's mandatory.
30-
%% interval - Refresh interval ms. It's options. default is 1500ms.
31-
%% sort_column - Sort the sheet by this index. It's options default is 2.
32-
33-
%% #{module => observer_cli_plug_1, title => "Example-1", interval => 1500, shortcut => "S", sort_column => 3},
34-
%% #{module => observer_cli_plug_2, title => "Example-2", interval => 1600, shortcut => "D", sort_column => 2}
35-
]}
36-
]},
37-
{licenses, ["MIT"]},
38-
{links, [{"Github", "https://github.com/zhongwencool/observer_cli"}]}
39-
]}.
1+
{application, observer_cli, [
2+
{description, "Visualize Erlang Nodes On The Command Line"},
3+
{vsn, "1.8.0"},
4+
{modules, [
5+
observer_cli
6+
]},
7+
{registered, []},
8+
{applications, [
9+
kernel,
10+
stdlib,
11+
recon
12+
]},
13+
{files, [
14+
"include",
15+
"LICENSE*",
16+
"mix.exs",
17+
"mix.lock",
18+
"README.md",
19+
"rebar.config",
20+
"rebar.lock",
21+
"src"
22+
]},
23+
{build_tools, ["mix", "rebar3"]},
24+
{env, [
25+
{scheduler_usage, disable},
26+
{plugins, [
27+
%% module - Specific module implements plugin behavior. It's mandatory.
28+
%% title - Menu title. It's mandatory.
29+
%% shortcut - Switch plugin by shortcut. It's mandatory.
30+
%% interval - Refresh interval ms. It's options. default is 1500ms.
31+
%% sort_column - Sort the sheet by this index. It's options default is 2.
32+
33+
%% #{module => observer_cli_plug_1, title => "Example-1", interval => 1500, shortcut => "S", sort_column => 3},
34+
%% #{module => observer_cli_plug_2, title => "Example-2", interval => 1600, shortcut => "D", sort_column => 2}
35+
]}
36+
]},
37+
{licenses, ["MIT"]},
38+
{links, [{"Github", "https://github.com/zhongwencool/observer_cli"}]}
39+
]}.

src/observer_cli.erl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
-spec start() -> no_return | {badrpc, term()}.
2424
start() -> start(#view_opts{}).
2525

26-
-spec start(Node) -> no_return | {badrpc, term()} when Node :: atom() | non_neg_integer().
26+
-spec start(Node) -> no_return | {badrpc, term()} when
27+
Node :: atom() | non_neg_integer() | #view_opts{}.
2728
start(Node) when Node =:= node() ->
2829
start(#view_opts{});
2930
start(Node) when is_atom(Node) ->
@@ -138,6 +139,9 @@ manager(StorePid, RenderPid, Opts, LastSchWallFlag) ->
138139
NewPages = observer_cli_lib:update_page_pos(StorePid, NewPage, Pages),
139140
clean(Resource),
140141
start(Opts#view_opts{home = Home#home{cur_page = NewPage, pages = NewPages}});
142+
{go_to_pid, Pid} ->
143+
clean(Resource),
144+
observer_cli_process:start(home, Pid, Opts);
141145
_ ->
142146
manager(StorePid, RenderPid, Opts, LastSchWallFlag)
143147
end.
@@ -289,6 +293,7 @@ render_memory_process_line(MemSum, PortParallelism, Interval) ->
289293
AtomMem = proplists:get_value(atom_used, Mem),
290294
BinMem = proplists:get_value(binary, Mem),
291295
EtsMem = proplists:get_value(ets, Mem),
296+
EtsLen = erlang:length(ets:all()),
292297
{
293298
BytesIn,
294299
BytesOut,
@@ -349,7 +354,7 @@ render_memory_process_line(MemSum, PortParallelism, Interval) ->
349354
?W("Gc Count", 20),
350355
?W(GcCount, 24),
351356
?NEW_LINE,
352-
?W("Ets", 10),
357+
?W("Ets/" ++ erlang:integer_to_list(EtsLen), 10),
353358
?W({byte, EtsMem}, 12),
354359
?W(EtsMemPercent, 6),
355360
?W(LogKey, 25),
@@ -777,6 +782,8 @@ choose_name(IsName) when is_atom(IsName) ->
777782
choose_name(_) ->
778783
undefined.
779784

785+
%% proc_lib:get_label/1 is not exported before OTP 27
786+
-dialyzer([{nowarn_function, [choose_lable/1]}]).
780787
choose_lable(Pid) ->
781788
case
782789
erlang:function_exported(proc_lib, get_label, 1) andalso

src/observer_cli_application.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
%% @doc List application info
1616

17-
-spec start(ViewOpts) -> no_return when ViewOpts :: view_opts().
17+
-spec start(ViewOpts) -> quit when ViewOpts :: view_opts().
1818
start(#view_opts{app = App, auto_row = AutoRow} = ViewOpts) ->
1919
Pid = spawn_link(fun() ->
2020
?output(?CLEAR),

src/observer_cli_help.erl

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,21 @@ render_worker(Interval) ->
3838
Text = "Interval: " ++ integer_to_list(Interval) ++ "ms",
3939
Menu = observer_cli_lib:render_menu(doc, Text),
4040
?output([?CURSOR_TOP, Menu]),
41+
render_doc(Text),
4142
erlang:send_after(Interval, self(), redraw),
4243
receive
4344
redraw ->
4445
render_worker(Interval);
4546
quit ->
46-
MenuQ = observer_cli_lib:render_menu(doc, Text),
47-
HelpQ = render_help(),
48-
LastLine = observer_cli_lib:render_last_line("q(quit)"),
49-
?output([?CURSOR_TOP, MenuQ, HelpQ, ?UNDERLINE, ?GRAY_BG, LastLine, ?RESET_BG, ?RESET])
47+
ok
5048
end.
5149

50+
render_doc(Text) ->
51+
MenuQ = observer_cli_lib:render_menu(doc, Text),
52+
HelpQ = render_help(),
53+
LastLine = observer_cli_lib:render_last_line("q(quit)"),
54+
?output([?CURSOR_TOP, MenuQ, HelpQ, ?UNDERLINE, ?GRAY_BG, LastLine, ?RESET_BG, ?RESET]).
55+
5256
render_help() ->
5357
[
5458
"|\e[44m1. Start Mode\e[49m \n",
@@ -57,22 +61,24 @@ render_help() ->
5761
"| \e[48;2;80;80;80m1.3\e[0m observer_start:start(Node, Cookie).\n",
5862

5963
"|\e[44m2. HOME(H) Commands\e[49m \n",
60-
"| \e[48;2;80;80;80m` \e[0m enable/disable schedule usage.\n",
61-
"| \e[48;2;80;80;80mPageDown \e[0m pd or F(forward).\n",
62-
"| \e[48;2;80;80;80mPageUp \e[0m pu or B(back).\n",
63-
"| \e[48;2;80;80;80mr \e[0m switch mode to reduction(proc_count).\n",
64-
"| \e[48;2;80;80;80mrr \e[0m switch mode to reduction(proc_window).\n",
65-
"| \e[48;2;80;80;80mm \e[0m switch mode to memory(proc_count).\n",
66-
"| \e[48;2;80;80;80mmm \e[0m switch mode to memory(proc_window).\n",
67-
"| \e[48;2;80;80;80mb \e[0m switch mode to bin memory(proc_count).\n",
68-
"| \e[48;2;80;80;80mbb \e[0m switch mode to bin memory(proc_window).\n",
69-
"| \e[48;2;80;80;80mmq \e[0m switch mode to message queue len(proc_count).\n",
70-
"| \e[48;2;80;80;80mmmq \e[0m switch mode to message queue len(proc_window).\n",
71-
"| \e[48;2;80;80;80mt \e[0m switch mode to total heap size(proc_count).\n",
72-
"| \e[48;2;80;80;80mtt \e[0m switch mode to total heap size(proc_window).\n",
73-
"| \e[48;2;80;80;80m3000 \e[0m set interval time to 3000ms, the integer must >= 1500.\n",
74-
"| \e[48;2;80;80;80m13 \e[0m choose the 13th process(green line), the integer must in top list.\n",
75-
"| \e[48;2;80;80;80mp \e[0m pause/unpause the view.\n",
64+
"| \e[48;2;80;80;80m` \e[0m enable/disable schedule usage.\n",
65+
"| \e[48;2;80;80;80mPageDown \e[0m pd or F(forward).\n",
66+
"| \e[48;2;80;80;80mPageUp \e[0m pu or B(back).\n",
67+
"| \e[48;2;80;80;80mr \e[0m switch mode to reduction(proc_count).\n",
68+
"| \e[48;2;80;80;80mrr \e[0m switch mode to reduction(proc_window).\n",
69+
"| \e[48;2;80;80;80mm \e[0m switch mode to memory(proc_count).\n",
70+
"| \e[48;2;80;80;80mmm \e[0m switch mode to memory(proc_window).\n",
71+
"| \e[48;2;80;80;80mb \e[0m switch mode to bin memory(proc_count).\n",
72+
"| \e[48;2;80;80;80mbb \e[0m switch mode to bin memory(proc_window).\n",
73+
"| \e[48;2;80;80;80mmq \e[0m switch mode to message queue len(proc_count).\n",
74+
"| \e[48;2;80;80;80mmmq \e[0m switch mode to message queue len(proc_window).\n",
75+
"| \e[48;2;80;80;80mt \e[0m switch mode to total heap size(proc_count).\n",
76+
"| \e[48;2;80;80;80mtt \e[0m switch mode to total heap size(proc_window).\n",
77+
"| \e[48;2;80;80;80m3000 \e[0m set interval time to 3000ms, the integer must >= 1500.\n",
78+
"| \e[48;2;80;80;80m13 \e[0m choose the 13th process(green line), the integer must in top list.\n",
79+
"| \e[48;2;80;80;80m<0.43.0> \e[0m choose the <0.43.0> process, the pid does not need to be in the top list.\n",
80+
"| \e[48;2;80;80;80m<431 or >431 \e[0m choose the <0.431.0> process, the pid does not need to be in the top list.\n",
81+
"| \e[48;2;80;80;80mp \e[0m pause/unpause the view.\n",
7682

7783
"|\e[44m5. Reference\e[49m \n",
7884
"|More information about recon:proc_count/2 and recon:proc_window/3 \n",

0 commit comments

Comments
 (0)