Skip to content

OpenSearch Dashboards CI Stats reporter

We're working on building a new service, the OpenSearch Dashboards CI Stats service, which will collect information about CI runs and metrics produced while testing OpenSearch Dashboards, and then provide tools for reporting on those metrics in specific PRs and overall as a way to spot trends.

CiStatsReporter

This class integrates with the ciStats.trackBuild {} Jenkins Pipeline function, consuming the OPENSEARCH_DASHBOARDS_CI_STATS_CONFIG variable produced by that wrapper, and then allowing test code to report stats to the service.

To create an instance of the reporter, import the class and call CiStatsReporter.fromEnv(log) (passing it a tooling log).

CiStatsReporter#metrics(metrics: Metric[])

Use this method to record metrics in the OpenSearch Dashboards CI Stats service.

interface Metric {
  group: string,
  id: string,
  value: number,
  // optional limit, values which exceed the limit will fail PRs
  limit?: number
  // optional path, relative to the root of the repo, where config values
  // are defined. Will be linked to in PRs which have overages.
  limitConfigPath?: string
}

Example:

import { CiStatsReporter, ToolingLog } from '@osd/dev-utils';

const log = new ToolingLog(...);
const reporter = CiStatsReporter.fromEnv(log)
reporter.metrics([
  {
    group: 'Build size',
    id: specificBuildName,
    value: sizeOfBuild
  }
])