Schedule metrics to avoid API limits

To balance data freshness with system performance and API rate limits, you can customize the collection frequency for Scorecard metrics. Scorecard uses the Backstage built-in scheduler service. The default refresh frequency is hourly, but you can adjust it for each metric.

Before you begin

Procedure

  1. Open your RHDH app-config.yaml file.
  2. Navigate to the scorecard.metricProviders section.
  3. Add a schedule configuration for your specific data source and metric using the following structure:
    scorecard:
      metricProviders:
        my_datasource:
          example_metric:
            schedule:
              frequency:
                cron: '0 6 * * *'
              timeout:
                minutes: 5
              initialDelay:
                minutes: 1
    
  4. Define the schedule parameters based on the Backstage SchedulerServiceTaskScheduleDefinitionConfig schema.
  5. Save the file.
  6. Restart the RHDH backend to apply the changes.
    Important

    Constraints: You must make sure the configured frequency does not exceed the API rate limits of your metric provider.

Results

  1. Review the backend logs to make sure the task is scheduled without errors.
  2. Verify that new metric data appears in the database according to the defined interval.