Skip to main content

Dependencies

In Cortex, you have the ability to define outgoing dependencies on other entities. Cortex can also automatically discover dependencies for some integrations. Having dependencies defined powers the ability to notify owners when a dependency deprecates its API or makes backwards incompatible changes, and the ability to visualize dependencies in a relationship graph.

Incoming dependencies are inferred based the outgoing dependency definitions.

Visualize dependencies in the relationship graph

In Cortex, you can visualize dependencies using the relationship graph at Tools > Relationship graphs. See the Relationship graph documentation for more information.

Automated dependency notifications

When a dependency deprecates its API or makes backwards incompatible changes, Cortex surfaces these issues via these methods:

  • Breaking API changes are listed in your Cortex workspace under Settings > Breaking API changes.
  • Cortex attempts to automatically make comments on PRs containing breaking OpenAPI changes that have downstream dependencies that Cortex knows about.
  • If a breaking change is merged to the default branch, Cortex alerts dependency owners via Slack that a breaking change was merged.

Discovery

Cortex can automatically discover dependencies from your integrations:

How to define dependencies

You can define dependencies manually via an entity's YAML descriptor, via the Cortex UI (if UI editing is enabled), or via the API.

Your user or API key need the Edit entities permission.

To define dependencies in the Cortex UI:

  1. Navigate to the entity where you need to define a dependency.
  2. In the upper right corner of the entity details page, click Configure entity.
  3. In the entity's left sidebar, click Dependencies.
  4. Click Add dependencies next to services or resources. Add dependencies to an entity
  5. In the form, select an entity to add as a dependency.
  6. Optionally, select an endpoint.
  7. Click Save dependency.

Set an endpoint for a dependency

Before you can select an endpoint from the dropdown when manually defining a dependency, that endpoint must be defined as a path in the entity's YAML file. See the example below:

openapi: 3.0.1
info:
title: Endpoint Example Service
description: "This is an example"
x-cortex-tag: endpoint-example-service
x-cortex-type: service
paths:
/hello/world:
get:
description: Some description
requestBody:
description: optional
responses:
"200":
description: optional
deprecated: false
/this/also/works:
put:
deprecated: false

In the UI, the paths will appear in the Endpoint dropdown:
The paths appear in the Endpoint dropdown

Sync dependencies

Cortex syncs dependencies every day at 12:00 a.m. UTC.

If you need to sync dependencies manually:

  1. Navigate to Tools > Relationship graphs.
  2. Click Sync dependencies at the top of the page.