Adding custom data

Custom data extends the out-of-the-box metadata that Cortex provides via integrations, enhancing your use of catalogs and augmenting details available for your entities. This data can also be used to write CQL queries and Scorecard rules.

Custom data can be defined manually in the entity descriptor, added to entities programmatically via a REST API, or sent through a webhook. To learn about sending data via webhook, see Custom webhook integrations.

Defining custom data

There are a few ways you can add custom data to an entity:

  • In the entity descriptor

    • This is optimal for low-volume, human-maintained data because it requires updating the entity's YAML when the data changes.

  • Via a POST REST API endpoint

    • Using a REST API is a better option for data that comes from an automated process, like a CI/CD pipeline.

  • A webhook.

    • This can be done without auth or an explicit entity tag in the URL if you do not have access to the entity tag or the ability to add authentication headers.

Editing the entity descriptor

Learn more about entity YAML descriptors in the Managing entities documentation.

The simplest way to describe information in the YAML is to define an object.

x-cortex-custom-metadata:
  key-example: value-example
  arbitrary-custom-data: hippocampus
  regions-of-brain:
    value: 3
    description: cerebrum, cerebellum, brainstem
  cognition: true
Field
Description
Required

key

Key or title for the custom data. Anything defined before the : will serve as the key.

value

Value for the custom data. Anything defined after the : is the value.

Custom data can be of any type, including scalars (strings, numbers, booleans), objects, and lists.

When you add custom data to an entity's YAML, you'll see the key and value pairs on an entity's Custom data page.

Custom data added via entity descriptor will display with a YAML tag.

Adding descriptions

You can add a description to data by explicitly defining it along with the key and value pairs. While key and value pairs can be defined with any terms when a description is not added, value: must explicitly be defined when a description is included.

x-cortex-custom-metadata:
  regions-of-brain:
    value: 3
    description: cerebrum, cerebellum, brainstem
  brain-hemispheres:
    value: 2
    description: The brain has a left and a right hemisphere.
Field
Description
Required

key

Key or title for the custom data. Anything defined before the : will serve as the key.

value

Value for the key; should be defined explicitly with value:

description

Description of the custom data

Note: While the description field is always optional, it is technically "required" to add a description to custom data.

Data source hierarchy

Cortex applies a data source hierarchy to determine how to handle a case where the same key is defined from multiple sources.

  • The entity descriptor is the source of truth. If a key is defined there, the API or webhooks cannot override the key.

  • The API and webhook approaches are at the same level and can override each other.

You can override keys defined in the YAML by adding a force=true parameter when using an API, but when the entity descriptor is eventually re-processed, the data provided via the API will be overwritten.

Use cases

Cataloging

Catalogs contain a lot of useful metadata about entities, including ownership and data from integrations. However, you may have your own custom fields that you want to include that would make exploring the catalog easier.

These can include things like:

  • Which AWS zones is this deployed in?

  • What databases does the entity consume?

  • When was the last successful CI run?

Custom data can then be queried against by using the Query builder, explored with CQL reports, or viewed on an entity's details page.

Scorecards

Cortex makes it easy to write Scorecard rules based on custom data that exists in your catalogs. When adding a rule, you can select Custom data from Choose an integration in the form editor and follow the flow. Cortex will automatically supply variables based on the custom data you've defined.

Last updated

Was this helpful?