-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: add metrics YAML export for documentation website #8385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -163,3 +163,45 @@ jobs: | |
| overwrite: ${{ inputs.overwrite }} | ||
| tag: ${{ env.BRANCH }} | ||
| repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Download metrics YAML from latest CI run | ||
| # Download the metrics YAML artifact produced by ci-summary-report.yml | ||
| # on the main branch. This file documents all Prometheus metrics emitted | ||
| # by Jaeger and is consumed by the documentation website. | ||
| continue-on-error: true | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GH_REPO: ${{ github.repository }} | ||
| run: | | ||
| echo "Downloading jaeger-metrics-yaml artifact from latest CI Orchestrator run on main" | ||
| LATEST_RUN=$(gh run list \ | ||
| --repo "${GH_REPO}" \ | ||
| --workflow "CI Orchestrator" \ | ||
| --branch main \ | ||
| --status success \ | ||
| --limit 1 \ | ||
| --json databaseId \ | ||
| --jq '.[0].databaseId') | ||
| if [ -z "$LATEST_RUN" ]; then | ||
| echo "::warning::No successful CI Orchestrator run found on main; skipping metrics YAML upload" | ||
| exit 0 | ||
| fi | ||
|
Comment on lines
+192
to
+217
|
||
| echo "Using CI Orchestrator run: $LATEST_RUN" | ||
| gh run download "$LATEST_RUN" \ | ||
| --repo "${GH_REPO}" \ | ||
| --name jaeger-metrics-yaml \ | ||
| --dir .metrics-export || { | ||
| echo "::warning::jaeger-metrics-yaml artifact not found in run $LATEST_RUN; skipping" | ||
| exit 0 | ||
| } | ||
| ls -la .metrics-export/ | ||
|
Comment on lines
+167
to
+226
|
||
|
|
||
| - name: Upload metrics YAML as release asset | ||
| if: ${{ inputs.dry_run != true }} | ||
| uses: svenstaro/upload-release-action@5e35e583720436a2cc5f9682b6f55657101c1ea1 # 2.11.1 | ||
| continue-on-error: true | ||
| with: | ||
| file: .metrics-export/jaeger-metrics.yaml | ||
| overwrite: ${{ inputs.overwrite }} | ||
| tag: ${{ env.BRANCH }} | ||
| repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,7 @@ jobs: | |
| --repo "${{ github.repository }}" --dir .artifacts | ||
|
|
||
| - name: Install dependencies | ||
| run: python3 -m pip install prometheus-client | ||
| run: python3 -m pip install prometheus-client pyyaml | ||
|
|
||
|
Comment on lines
38
to
40
|
||
| - name: Compare metrics and generate summary | ||
| id: compare-metrics | ||
|
|
@@ -45,6 +45,23 @@ jobs: | |
| shell: bash | ||
| run: bash ./scripts/e2e/metrics_summary.sh | ||
|
|
||
| - name: Export metrics to YAML for documentation | ||
| if: github.ref == 'refs/heads/main' | ||
| run: | | ||
| python3 ./scripts/e2e/export_metrics_to_yaml.py \ | ||
| --snapshot-dir .artifacts \ | ||
| --output .artifacts/jaeger-metrics.yaml || \ | ||
| echo "::warning::Metrics YAML export failed (non-fatal)" | ||
|
|
||
| - name: Upload metrics YAML artifact | ||
| if: github.ref == 'refs/heads/main' | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: jaeger-metrics-yaml | ||
| path: .artifacts/jaeger-metrics.yaml | ||
| retention-days: 90 | ||
| if-no-files-found: ignore | ||
|
|
||
| - name: Set up Go for coverage tools | ||
| uses: ./.github/actions/setup-go | ||
| with: | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,303 @@ | ||||
| # Copyright (c) 2025 The Jaeger Authors. | ||||
| # SPDX-License-Identifier: Apache-2.0 | ||||
|
|
||||
| """Export Prometheus metrics snapshots to a structured YAML data file. | ||||
|
|
||||
| This script reads raw Prometheus text-format snapshot files (as scraped from | ||||
| Jaeger's /metrics endpoint by the integration tests) and produces a single | ||||
| YAML file suitable for consumption by the documentation website. | ||||
|
|
||||
| The output follows a similar pattern to the CLI flags YAML files stored in | ||||
| ``data/cli/{version}/`` in the jaegertracing/documentation repository. The | ||||
| documentation site can place this output in ``data/metrics/{version}/`` and | ||||
| render it with a Hugo template, keeping all styling and layout decisions in | ||||
| the template layer rather than generating HTML or Markdown directly. | ||||
|
|
||||
| Usage:: | ||||
|
|
||||
| python3 scripts/e2e/export_metrics_to_yaml.py \\ | ||||
| --snapshot-dir .metrics \\ | ||||
| --output metrics.yaml | ||||
|
|
||||
| The ``--snapshot-dir`` should contain one or more ``metrics_snapshot_*.txt`` | ||||
| files produced by the E2E integration tests. | ||||
| """ | ||||
|
|
||||
| from __future__ import annotations | ||||
|
|
||||
| import argparse | ||||
| import os | ||||
| import re | ||||
| import sys | ||||
| from collections import defaultdict | ||||
|
||||
| from collections import defaultdict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This downloads the metrics YAML from the latest successful main-branch run, which may not correspond to the commit/tag being released (main could have advanced). To avoid publishing mismatched metrics for a release, consider selecting the CI Orchestrator run for the release commit (e.g., filter by commit SHA) or otherwise ensuring the artifact matches
env.BRANCH/the tag.