No description
- Python 100%
| .forgejo/workflows | ||
| action.yml | ||
| README.md | ||
| send_metrics.py | ||
CI Metrics Action
A reusable GitHub Action designed to collect CI job metrics, manage execution state persistently within an S3 bucket, and export data directly to an OpenTelemetry (OTel) collector via gRPC.
This action helps eliminate metrics "staleness" issues by syncing historical execution states from S3 before pushing UpAndDownCounter metrics to OpenTelemetry.
Features
- Persistent State Syncing: Keeps a historical count of job statuses (
success,failure, etc.) in an S3 JSON file to prevent metrics from dropping to 0 after 5 minutes of inactivity. - OpenTelemetry Native: Streams telemetry metrics directly over gRPC using standard OTel SDKs.
- Dynamic Job Monitoring: Flexible configuration that handles arbitrary job names and results.
Inputs
| Input | Description | Required | Default |
|---|---|---|---|
state-file-name |
The name of the CI state file to be used for storing job execution metrics in S3. | Yes | — |
s3-access-key-id |
The S3 access key ID for authentication. | Yes | — |
s3-secret-access-key |
The S3 secret access key for authentication. | Yes | — |
job-name |
The name of the CI job whose metrics are being collected. | Yes | — |
job-result |
The result of the CI job (e.g., success, failure, cancelled). |
Yes | — |
bucket-name |
The S3 bucket name. | No | 'ci-metrics' |
s3-endpoint-url |
The S3 endpoint URL. | No | 'https://object.storage.eu01.onstackit.cloud' |
otlp-endpoint |
The OTLP endpoint URL for the gRPC metrics exporter. | No | 'https://otlp-grpc.k8s.infra.eu01.int.stackit.cloud' |
Usage Example
Below is an example of how to import and use the metrics action within a dedicated downstream job (metrics-summary) that collects metrics for a previous workflow step (job-alpha).
name: CI Pipeline
on: [push, pull_request]
jobs:
job-alpha:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Tests
run: echo "Executing critical build and test workflows..."
metrics-summary:
needs: [job-alpha]
if: always()
runs-on: linux
steps:
- name: Checkout Action Repo
uses: [https://stackit-iaas.git.onstackit.cloud/actions/checkout@v6](https://stackit-iaas.git.onstackit.cloud/actions/checkout@v6)
with:
repository: 'iaas/ci-metrics'
server-url: '[https://stackit-iaas.git.onstackit.cloud](https://stackit-iaas.git.onstackit.cloud)'
token: ${{ github.token }}
- name: Export Metrics
id: ci-metrics
uses: ./ci-metrics
with:
state-file-name: 'development-metrics-state.json'
s3-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
s3-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
job-name: "job-alpha"
job-result: ${{ needs.job-alpha.result }}