Skip to main content

Tech Insights

The Tech Insights integration plugin for Soundcheck exposes facts from Tech Insight backend, allowing them to be used in Soundcheck checks.

Prerequisites

Add the TechInsightsHubFactCollector to Soundcheck

First, add the @spotify/backstage-plugin-soundcheck-backend-module-techinsights package:

yarn workspace backend add @spotify/backstage-plugin-soundcheck-backend-module-techinsights

Then add the following to your packages/backend/src/index.ts file:

packages/backend/src/index.ts
const backend = createBackend();

backend.add(import('@spotify/backstage-plugin-soundcheck-backend'));
backend.add(
import('@spotify/backstage-plugin-soundcheck-backend-module-techinsights'),
);
// ...

backend.start();

Consult the Soundcheck Backend documentation for additional details on setting up the Soundcheck backend.

Legacy Backend

warning

If you are still using the Legacy Backend you can follow these instructions but we highly recommend migrating to the New Backend System.

First add the package: yarn workspace backend add @spotify/backstage-plugin-soundcheck-backend-module-techinsights

If you are still using the legacy backend, in packages/backend/src/plugins/soundcheck.ts, add the TechInsightsFactCollector:

  import { SoundcheckBuilder } from '@spotify/backstage-plugin-soundcheck-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
+ import { TechInsightsFactCollector } from '@spotify/backstage-plugin-soundcheck-backend-module-techinsights';

export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
return SoundcheckBuilder.create({ ...env })
+ .addFactCollectors(
+ TechInsightsFactCollector.create({
+ discovery: env.discovery,
+ tokenManager: env.tokenManager,
+ logger: env.logger,
+ }),
+ )
.build();
}

Rate Limiting (Optional)

This fact collector can be rate limited in Soundcheck using the following configuration:

soundcheck:
job:
workers:
techinsights:
limiter:
max: 1000
duration: 60000

In this example, the fact collector is limited to 1000 executions per minute.

This fact collector handles 429 rate limit errors from Tech Insights. Soundcheck will automatically wait and retry requests that are rate limited.

Using TechInsight facts in Soundcheck

Soundcheck fact references for this plugin follow the format techinsights:default/<id> where <id> is the fact retriever identifier from Tech Insights.

For example, if there is a Tech Insights fact retriever with an ID of entityOwnershipFactRetriever, its Soundcheck fact reference would be techinsights:default/entityOwnershipFactRetriever.

Soundcheck fact references enable facts from Tech Insights to be used in Soundcheck check. Here is an example of a Soundcheck check that makes use of a fact from Tech Insights.

id: has-owner
rule:
factRef: techinsights:default/entityOwnershipFactRetriever
path: $.hasOwner
operator: equal
value: true

When this check is executed, it will pull the fact(s) with a fact retriever identifier of entityOwnershipFactRetriever from Tech Insights and perform the specified check logic on it.

Currently, the collection of facts from Tech Insights is not scheduled or cached. Tech Insights facts are only collected on demand, when a check using a Tech Insights fact is executed (which can be scheduled).