elastic/devfiler

GitHub: elastic/devfiler

将 OTel eBPF Profiler 的采集、存储与可视化整合成桌面应用,让开发者无需部署 Elastic 栈即可快速进行性能分析。

Stars: 114 | Forks: 18

# devfiler devfiler 在一个桌面应用程序中重新实现了 [OTel eBPF Profiler] 的完整采集、数据存储、符号化和 UI 部分。这本质上允许开发者在几秒钟内开始使用性能分析 agent,而无需先搭建整套 Elastic 部署。 devfiler 目前支持在 macOS 和 Linux 上运行。请注意,这并不意味着该应用程序可以分析 macOS 应用程序:[OTel eBPF Profiler] 仍然需要在 Linux 机器上运行,但 UI 可以在 macOS 上使用。 screenshot1 screenshot2 ## 构建 ### Nix 目前主要的构建系统是 [Nix] 包管理器。一旦在系统上安装了 Nix,可以使用以下命令构建 devfiler: ``` nix --experimental-features 'flakes nix-command' build '.?submodules=1#' ``` 可执行文件被放置在 Nix store 中,并在此目录的根目录中创建一个符号链接 (symlink)。 然后你可以使用以下命令运行 devfiler: ``` result/bin/devfiler ``` 或者,你也可以直接让 Nix 为你构建并运行它: ``` nix --experimental-features 'flakes nix-command' run '.?submodules=1#' ``` 通过将以下内容放入 `~/.config/nix/nix.conf`,可以避免每次都传递 `--experimental-features` 参数。 ``` experimental-features = nix-command flakes ``` ### Cargo 或者,也可以仅使用普通的 cargo 构建 devfiler。目前这不允许为 macOS 生成适当的应用程序包,但对于开发和本地使用来说已经足够了。通常最好通过 [rustup] 安装 Cargo,但如果你的发行版仓库中的 `cargo` 和 `rustc` 版本足够新,使用它们也可能有效。 此外,请确保系统上安装了 `g++` (或 `clang`)、`libclang` 和 `protoc`。以下命令适用于 Debian 和 Ubuntu。这些包在其他发行版的仓库以及 MacPorts/Brew 中应该也有,但名称可能有所不同。 ``` sudo apt install g++ libclang-dev protobuf-compiler libprotobuf-dev cmake ``` 然后可以使用以下命令构建 devfiler: ``` # 仅在克隆仓库后或子模块更改时更新子模块。 git submodule update --init --recursive cargo build --release ``` 可执行文件位于 `target/release/devfiler`。 ## 添加 traces devfiler 在 `0.0.0.0:11000` 上监听性能分析 agent 的连接。要摄入 traces,请使用最新版本的 OTel eBPF profiler,然后像这样运行它: ``` sudo ./ebpf-profiler -collection-agent=127.0.0.1:11000 -disable-tls ``` ### 在远程主机上进行性能分析 一个常见的用例是通过 SSH 登录并在远程机器上运行性能分析 agent。在这种情况下,设置连接的最简单方法是使用 [ssh reverse tunnel](SSH 反向隧道)。只需在本地运行 devfiler,然后像这样连接到你的远程机器: ``` ssh -R11000:localhost:11000 someuser@somehost ``` 这将导致 sshd 在远程机器的 `11000` 端口上监听,并将所有连接转发到本地机器的 `11000` 端口。当你在远程运行性能分析 agent 并将其指向 `127.0.0.1:11000` 时,连接将被转发到你本地的 devfiler。 ## 开发者模式 一些仅与开发者相关的更内部的标签页默认是隐藏的。你可以通过双击左上角的 "devfiler" 文本来显示它们。 ## 发布
在本地创建发布构件 将 `Cargo.toml` 中的 `version` 更新为相应的发布版本号 ``` # 在 linux 机器上,只要安装了 qemu binfmt,架构无关: nix bundle --system aarch64-linux --inputs-from . --bundler 'github:ralismark/nix-appimage' '.?submodules=1#appImageWrapper' -L nix bundle --system x86_64-linux --inputs-from . --bundler 'github:ralismark/nix-appimage' '.?submodules=1#appImageWrapper' -L # 生成的 appimages 会符号链接到 CWD。 # 在安装了 Rosetta 的 ARM64 mac 上: nix build -L '.?submodules=1#packages.aarch64-darwin.macAppZip' -j20 cp result/devfiler.zip devfiler-apple-silicon-mac.zip nix build -L '.?submodules=1#packages.x86_64-darwin.macAppZip' -j20 cp result/devfiler.zip devfiler-intel-mac.zip ```
标签:Docker镜像, GET参数, GUI, Mutation, Nix, OpenTelemetry, Rust, 全栈监控, 可视化, 可视化界面, 威胁情报, 开发者工具, 性能分析, 持续性能分析, 桌面应用, 用户代理, 符号化, 系统追踪, 网络流量审计, 通知系统