Product
Platform overview Tomosu engine (open source) Tomosu Cloud Reliability rules
Solutions
Prevent outages before merge Reliability Radar Fix safety For developers For SRE and platform teams
Developers
Quickstart Documentation Contribute a rule
Resources
Blog Case studies Learn FAQ News
Company
Pricing About Contact Join the Waitlist
Theme

Production Context Graph

The Production Context Graph draws your code and your production as one graph. Repositories, files, functions, services, endpoints, dependencies, findings and fixes are nodes; calls and links are edges. It is in the console and on every finding, and tomosu graph exports it.

  • tomosu graph
  • JSON, GraphML, Cypher
  • Console: Context graph
  • Updated

What is in the graph?

Nodes are repositories, files, functions, services, endpoints, dependencies, findings and fixes. Edges say how they relate:

EdgeJoins
CONTAINSA repository to its files, a file to its functions
RUNSA service to the repository whose code it runs
SERVESA service to its endpoints
HANDLED_BYAn endpoint to the function that handles it
CALLSCode or a service to a dependency
FOUND_INA finding to the function it is in
FIRED_ONA finding to the endpoint or dependency production showed it on
FIXED_BYA finding to its fix

It is built from your code indexes and the production data the engine receives, so it answers questions such as “which endpoints does this function serve?” and “which findings sit behind this failing dependency?”.

How do I open it in the console?

Context graph in the menu opens the Production Context Graph for one repository at a time, with business areas, the services behind them and what they depend on. What needs you most is highlighted first.

The Production Context Graph page: counts of business areas, services linked to code, endpoints linked to functions and findings placed on the graph, then a map from findings that need you to business areas and services, with export buttons for JSON, GraphML and Cypher.
Production Context Graph for demo/partners.

The same graph is on every finding, as How this connects, and on every service page, as Map.

How do I export it?

tomosu graph exports the graph from a running engine, or from code indexes alone with --index-dir:

$ tomosu graph --engine http://localhost:7600 --format json
{
  "nodes": [
    {
      "id": "repo:demo/partners",
      "type": "repository",
      "label": "demo/partners",
      "sub": "demo-1",
      "repo": "demo/partners",
      "props": {
        "commit": "demo-1",
        "files": 1
      }
    },
    {
      "id": "file:demo/partners:app.py",
      "type": "file",
      "label": "app.py",
      "repo": "demo/partners",
      "hot": true,
      "severity": "Low",
      "props": {
        "language": "python",
        "lines": 54
      }
    },
    {
      "id": "fn:demo/partners:app.py:charge",
      "type": "function",
      "label": "charge",
      "sub": "app.py:14",
…
$ tomosu graph --engine http://localhost:7600 --format cypher
// Production Context Graph, exported by the engine. Load with cypher-shell.
CREATE CONSTRAINT IF NOT EXISTS FOR (n:Dependency) REQUIRE n.id IS UNIQUE;
CREATE CONSTRAINT IF NOT EXISTS FOR (n:Endpoint) REQUIRE n.id IS UNIQUE;
CREATE CONSTRAINT IF NOT EXISTS FOR (n:File) REQUIRE n.id IS UNIQUE;
CREATE CONSTRAINT IF NOT EXISTS FOR (n:Finding) REQUIRE n.id IS UNIQUE;
CREATE CONSTRAINT IF NOT EXISTS FOR (n:Fix) REQUIRE n.id IS UNIQUE;
CREATE CONSTRAINT IF NOT EXISTS FOR (n:Function) REQUIRE n.id IS UNIQUE;
CREATE CONSTRAINT IF NOT EXISTS FOR (n:Repository) REQUIRE n.id IS UNIQUE;
CREATE CONSTRAINT IF NOT EXISTS FOR (n:Service) REQUIRE n.id IS UNIQUE;
MERGE (n:Repository {id: 'repo:demo/partners'}) SET n.label = 'demo/partners', n.sub = 'demo-1', n.repo = 'demo/partners', n.severity = '';
MERGE (n:File {id: 'file:demo/partners:app.py'}) SET n.label = 'app.py', n.sub = '', n.repo = 'demo/partners', n.severity = 'Low';
MERGE (n:Function {id: 'fn:demo/partners:app.py:charge'}) SET n.label = 'charge', n.sub = 'app.py:14', n.repo = 'demo/partners', n.severity = 'Critical';
MERGE (n:Function {id: 'fn:demo/partners:app.py:price'}) SET n.label = 'price', n.sub = 'app.py:24', n.repo = 'demo/partners', n.severity = 'High';
MERGE (n:Function {id: 'fn:demo/partners:app.py:notify'}) SET n.label = 'notify', n.sub = 'app.py:30', n.repo = 'demo/partners', n.severity = 'Critical';
…
OptionWhat it does
--format json|graphml|cypherJSON for scripts, GraphML for graph tools, Cypher for Neo4j
--focus ID --depth NOnly the neighbourhood of one node, such as fn:demo/shop:app.py:orders, up to 4 hops
--view system / --view area --area NAMEThe system map, or one business area
--out FILEWrite to a file

The API is GET /api/graph, with the same options as query parameters.

What does the free graph cover?

The free engine draws the graph for up to five repositories; scanning, findings and linking stay unlimited. The paid enterprise graph in Tomosu Cloud adds every repository, history, infrastructure (Kubernetes, AWS, Terraform) and what fixes held at other organisations. Those layers show locked in the free console.