Perfetto Server Extensions
February 12, 2026 · View on GitHub
Server extensions let you share reusable SQL modules and UI macros through the Perfetto UI — with your team or the open source community. Instead of everyone copy-pasting SQL queries or macro definitions, you host them on a server and anyone with access can load them directly in the UI.
Extension servers can be any HTTPS endpoint that serves the expected JSON format. This repo is a template for the easiest option: hosting on GitHub. For the full endpoint specification and other hosting options, see the Server Extensions RFC.
Getting started
-
Fork this repo, or import it if you want a private copy.
-
Edit
config.yamlto set your extension's name and namespace:name: My Extension namespace: com.example.myext -
Add SQL modules as
.sqlfiles undersrc/{module}/sql_modules/.The filename determines the module name. For example, with namespace
com.example.myext:src/default/sql_modules/helpers.sql→INCLUDE PERFETTO MODULE com.example.myext.helpers;src/default/sql_modules/foo/bar.sql→INCLUDE PERFETTO MODULE com.example.myext.foo.bar;
You can organise SQL files into subdirectories — each path component becomes a dot-separated part of the module name.
-
Add UI macros as
.yamlor.jsonfiles undersrc/{module}/macros/.Each macro has an
id, a displayname, and arunlist of commands to execute in sequence. YAML example (src/default/macros/show_long_tasks.yaml):id: com.example.myext.ShowLongTasks name: Show Long Tasks run: - id: dev.perfetto.RunQueryAndShowTab args: - "SELECT * FROM slice WHERE dur > 50000000"Equivalent JSON (
src/default/macros/show_long_tasks.json):{ "id": "com.example.myext.ShowLongTasks", "name": "Show Long Tasks", "run": [ {"id": "dev.perfetto.RunQueryAndShowTab", "args": ["SELECT * FROM slice WHERE dur > 50000000"]} ] }See the UI automation docs for the full list of available commands.
-
Push to
main. A GitHub Action will build and commit the generated endpoint files automatically.
Connecting to the Perfetto UI
-
Add your repo as a GitHub extension server.
Private repos
If your repo is private, you'll need a GitHub personal access token:
- Go to GitHub personal access tokens and click Generate new token.
- Under Repository access, select Only select repositories and choose your extension repo.
- Under Permissions → Repository permissions, set Contents to Read-only.
- Generate the token and enter it in the Perfetto UI extension settings when adding your server.