Glean's query language is called Angle. Read the Angle Guide to learn about how to write Angle queries.
The shell can be used for testing queries and schema changes, and exploring the data.
There is currently only a Haskell API; APIs in other languages are coming soon.
All client layers are wrappers around the Thrift API.
The results of queries will be returned as instances of the Thrift
glean/schema/thrift that are generated automatically from
The client layers provide a few useful things over the raw Thrift API:
- Connecting to the most recent database for a given repository;
- Sharding to ensure we connect to a suitable server for that database;
- In some cases, an API for building queries programmatically.
Glean exposes a Thrift API.
The two methods for querying are
userQuery- general queries returning an arbitrary number of results
userQueryFacts- fetch the definition of a single fact given its ID
Queries are in Angle syntax, and results are encoded as JSON or Thrift compact which you can encode/decode into the Thrift types.
A VS Code plugin for Angle syntax highlighting is available in this repository, under
glean/vscode/. It can either be built from source and installed, or one can download and
install the .vsix file generated by our CI system.
Assuming you have Node JS installed on your system, run the following commands:
cd glean/vscodenpx vsce package
npx command should produce a
glean-x.y.z.vsix file in the
that you can install in VS Code by following the instructions of the Installing section below.
Simply visit this CI page,
click on the latest successful CI run, scroll down to the Artifacts section and click on
glean-vsix. This should give you a
.zip archive that contains a
that you can install in VS Code by following the instructions in the next section.
code --install-extension path/to/glean-x.y.z.vsix
The VS Code documentation
describes alternative ways to install an extension from a
.vsix file, from within the editor,
in case the above command does not work or a more graphical, user-friendly is preferable.