Skip to content

Latest commit

 

History

History
55 lines (28 loc) · 4.06 KB

architecture.md

File metadata and controls

55 lines (28 loc) · 4.06 KB

source{d} Lookout Architecture

source{d} Lookout service sequence diagram

You can edit this image using mermaid. (sourcecode)

source{d} Lookout consists of the following components:

Server

It is the main component, running in a separate process. It is responsible for orchestrating all the other services. It takes review requests made by an external code review system, calls the registered analyzers to review the changes, and posts the results back.

The server also exposes DataService as a gRPC service.

DataService

DataService gRPC can be called by the analyzers to request a stream (ie. go, python) of all the files in the repository being analyzed (FilesRequest), or only the ones that changed (ChangesRequest). Both requests can be configured to also require either the files content, UASTs and language; the requests can also filter by programming languages, file paths (by regexp), and exclude the vendored paths.

DataServer also acts as a proxy to Babelfish, so if an analyzer needs to access the Babelfish API, it can point its Babelfish client to the same DataServer address.

DataServer gRPC URL is defined by LOOKOUT_DATA_SERVER enviroment value, and its default value is localhost:10301.

For the gRPC DataService service definiton you can take al look to service_data.proto

Analyzer

Find more info about what an analyzer is and how to develop your own analyzer in the source{d} Lookout Analyzers documentation

An analyzer is a gRPC service that will be called by the Server to perform the smart code analysis, and it will return a set of Comments as the result of the analysis.

They are not part of source{d} Lookout repository so they can be developed by third parties.

source{d} Lookout Server will call all the registered Analyzers to produce comments for the opened Pull Request in the watched repositories. To register new Analyzers in the configuration file, lookoutd will need to be restarted.

External Services

source{d} Lookout will call some external services, some of them depending on the configuration.

Babelfish

Babelfish is used to parse files into UAST when the DataService GetChanges or GetFiles methods are asked to include UASTs.

Babelfish can also be directly called through DataService proxy.

RabbitMQ

If source{d} Lookout is run in distributed mode, the watcher will enqueue in RabbitMQ all new repository and PR events, and the workers will take from there the events to be processed.

PostgreSQL

source{d} Lookout uses PostgreSQL to store application internal state.