Skip to content

Commit 4747b0a

Browse files
authored
Merge branch 'main' into kind
2 parents 3a578d4 + b04e0ba commit 4747b0a

File tree

158 files changed

+1489
-765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+1489
-765
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright (c) 2023 The Jaeger Authors.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: 'Verify Metric Snapshot and Upload Metrics'
5+
description: 'Upload or cache the metrics data after verification'
6+
inputs:
7+
snapshot:
8+
description: 'Path to the metric file'
9+
required: true
10+
artifact_key:
11+
description: 'Artifact key used for uploading and fetching artifacts'
12+
required: true
13+
runs:
14+
using: 'composite'
15+
steps:
16+
- name: Upload current metrics snapshot
17+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
18+
with:
19+
name: ${{ inputs.artifact_key }}
20+
path: ./.metrics/${{ inputs.snapshot }}.txt
21+
retention-days: 7
22+
23+
# The github cache restore successfully restores when cache saved has same key and same path.
24+
# Hence to restore release metric with name relese_{metric_name} , the name must be changed to the same.
25+
- name: Change file name before caching
26+
if: github.ref_name == 'main'
27+
shell: bash
28+
run: |
29+
mv ./.metrics/${{ inputs.snapshot }}.txt ./.metrics/baseline_${{ inputs.snapshot }}.txt
30+
31+
- name: Cache metrics snapshot on main branch for longer retention
32+
if: github.ref_name == 'main'
33+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
34+
with:
35+
path: ./.metrics/baseline_${{ inputs.snapshot }}.txt
36+
key: ${{ inputs.artifact_key }}_${{ github.run_id }}
37+
38+
# Use restore keys to match prefix and fetch the latest cache
39+
# Here , restore keys is an ordered list of prefixes that need to be matched
40+
- name: Download the cached tagged metrics
41+
id: download-release-snapshot
42+
if: github.ref_name != 'main'
43+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
44+
with:
45+
path: ./.metrics/baseline_${{ inputs.snapshot }}.txt
46+
key: ${{ inputs.artifact_key }}
47+
restore-keys: |
48+
${{ inputs.artifact_key }}
49+
50+
- name: Calculate diff between the snapshots
51+
id: compare-snapshots
52+
if: ${{ (github.ref_name != 'main') && (steps.download-release-snapshot.outputs.cache-matched-key != '') }}
53+
shell: bash
54+
run: |
55+
python3 -m pip install prometheus-client
56+
python3 ./scripts/e2e/compare_metrics.py --file1 ./.metrics/${{ inputs.snapshot }}.txt --file2 ./.metrics/baseline_${{ inputs.snapshot }}.txt --output ./.metrics/diff_${{ inputs.snapshot }}.txt
57+
if [ $? -eq 1 ]; then
58+
echo "🛑 Differences found in metrics"
59+
exit 1
60+
fi
61+
62+
- name: Upload the diff artifact
63+
if: ${{ (github.ref_name != 'main') && (steps.compare-snapshots.outcome == 'failure') }}
64+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
65+
with:
66+
name: diff_${{ inputs.artifact_key }}
67+
path: ./.metrics/diff_${{ inputs.snapshot }}.txt
68+
retention-days: 7
69+
70+

.github/workflows/ci-e2e-all.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,3 @@ jobs:
3636
opensearch:
3737
uses: ./.github/workflows/ci-e2e-opensearch.yml
3838

39-
40-
41-
42-

.github/workflows/ci-e2e-badger.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
2626

2727
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
28-
2928
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
3029
with:
3130
go-version: 1.23.x
@@ -41,6 +40,12 @@ jobs:
4140
;;
4241
esac
4342
43+
- uses: ./.github/actions/verify-metrics-snapshot
44+
if: matrix.version == 'v2'
45+
with:
46+
snapshot: metrics_snapshot_badger
47+
artifact_key: metrics_snapshot_badger_${{ matrix.version }}
48+
4449
- name: Upload coverage to codecov
4550
uses: ./.github/actions/upload-codecov
4651
with:

.github/workflows/ci-e2e-cassandra.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,17 @@ jobs:
4848
run: bash scripts/e2e/cassandra.sh ${{ matrix.version.major }} ${{ matrix.version.schema }} ${{ matrix.jaeger-version }}
4949
env:
5050
SKIP_APPLY_SCHEMA: ${{ matrix.create-schema == 'auto' && true || false }}
51+
52+
- uses: ./.github/actions/verify-metrics-snapshot
53+
if: matrix.jaeger-version == 'v2'
54+
with:
55+
snapshot: metrics_snapshot_cassandra
56+
artifact_key: metrics_snapshot_cassandras_${{ matrix.version.major }}_${{ matrix.version.schema }}_${{ matrix.jaeger-version }}_${{ matrix.create-schema }}
5157

5258
- name: Upload coverage to codecov
5359
uses: ./.github/actions/upload-codecov
5460
with:
5561
files: cover.out
5662
flags: cassandra-${{ matrix.version.major }}-${{ matrix.jaeger-version }}-${{ matrix.create-schema }}
63+
64+

.github/workflows/ci-e2e-elasticsearch.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ jobs:
4040
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
4141
with:
4242
submodules: true
43-
44-
- name: Fetch git tags
45-
run: |
46-
git fetch --prune --unshallow --tags
47-
43+
4844
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
4945
with:
5046
go-version: 1.23.x
@@ -58,6 +54,12 @@ jobs:
5854
- name: Run ${{ matrix.version.distribution }} integration tests
5955
id: test-execution
6056
run: bash scripts/e2e/elasticsearch.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }}
57+
58+
- uses: ./.github/actions/verify-metrics-snapshot
59+
if: matrix.version.jaeger == 'v2'
60+
with:
61+
snapshot: metrics_snapshot_elasticsearch
62+
artifact_key: metrics_snapshot_elasticsearch_${{ matrix.version.major }}_${{ matrix.version.jaeger}}
6163

6264
- name: Upload coverage to codecov
6365
uses: ./.github/actions/upload-codecov

.github/workflows/ci-e2e-grpc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ jobs:
4141
;;
4242
esac
4343
44+
- uses: ./.github/actions/verify-metrics-snapshot
45+
if: matrix.version == 'v2'
46+
with:
47+
snapshot: metrics_snapshot_grpc
48+
artifact_key: metrics_snapshot_grpc_${{ matrix.version }}
49+
4450
- name: Upload coverage to codecov
4551
uses: ./.github/actions/upload-codecov
4652
with:

.github/workflows/ci-e2e-kafka.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ jobs:
3535
- name: Run kafka integration tests
3636
id: test-execution
3737
run: bash scripts/e2e/kafka.sh -j ${{ matrix.jaeger-version }} -v ${{ matrix.kafka-version }}
38+
39+
- uses: ./.github/actions/verify-metrics-snapshot
40+
if: matrix.jaeger-version == 'v2'
41+
with:
42+
snapshot: metrics_snapshot_kafka
43+
artifact_key: metrics_snapshot_kafka_${{ matrix.jaeger-version }}
3844

3945
- name: Upload coverage to codecov
4046
uses: ./.github/actions/upload-codecov

.github/workflows/ci-e2e-memory.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,20 @@ jobs:
2121
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
2222

2323
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
24-
24+
2525
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
2626
with:
2727
go-version: 1.23.x
2828

2929
- name: Run Memory storage integration tests
3030
run: |
3131
STORAGE=memory_v2 make jaeger-v2-storage-integration-test
32-
32+
33+
- uses: ./.github/actions/verify-metrics-snapshot
34+
with:
35+
snapshot: metrics_snapshot_memory
36+
artifact_key: metrics_snapshot_memory
37+
3338
- name: Upload coverage to codecov
3439
uses: ./.github/actions/upload-codecov
3540
with:

.github/workflows/ci-e2e-opensearch.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ jobs:
3838
with:
3939
submodules: true
4040

41-
- name: Fetch git tags
42-
run: |
43-
git fetch --prune --unshallow --tags
44-
4541
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
4642
with:
4743
go-version: 1.23.x
@@ -52,6 +48,12 @@ jobs:
5248
id: test-execution
5349
run: bash scripts/e2e/elasticsearch.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }}
5450

51+
- uses: ./.github/actions/verify-metrics-snapshot
52+
if: matrix.version.jaeger == 'v2'
53+
with:
54+
snapshot: metrics_snapshot_opensearch
55+
artifact_key: metrics_snapshot_opensearch_${{ matrix.version.major }}
56+
5557
- name: Upload coverage to codecov
5658
uses: ./.github/actions/upload-codecov
5759
with:

.github/workflows/ci-lint-checks.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,70 @@ jobs:
117117
- name: Run unit tests for scripts
118118
run: |
119119
SHUNIT2=.tools/shunit2 bash scripts/utils/compute-tags.test.sh
120+
121+
binary-size-check:
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
125+
with:
126+
egress-policy: audit
127+
128+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
129+
with:
130+
submodules: true
131+
132+
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
133+
with:
134+
go-version: 1.23.x
135+
136+
- name: Setup Node.js version
137+
uses: ./.github/actions/setup-node.js
138+
139+
- name: Build jaeger binary
140+
run: make build-jaeger
141+
142+
- name: Calculate jaeger binary size
143+
run: |
144+
TOTAL_SIZE=$(du -sb ./cmd/jaeger/jaeger-linux-amd64 | cut -f1)
145+
echo "$TOTAL_SIZE" > ./new_jaeger_binary_size.txt
146+
echo "Total binary size: $TOTAL_SIZE bytes"
147+
148+
- name: Restore previous binary size
149+
id: cache-binary-size
150+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 #v4.2.0
151+
with:
152+
path: ./jaeger_binary_size.txt
153+
key: jaeger_binary_size
154+
restore-keys: |
155+
jaeger_binary_size
156+
157+
- name: Compare jaeger binary sizes
158+
if: steps.cache-binary-size.outputs.cache-matched-key != ''
159+
run: |
160+
OLD_BINARY_SIZE=$(cat ./jaeger_binary_size.txt)
161+
NEW_BINARY_SIZE=$(cat ./new_jaeger_binary_size.txt)
162+
echo "Previous binary size: $OLD_BINARY_SIZE bytes"
163+
echo "New binary size: $NEW_BINARY_SIZE bytes"
164+
165+
SIZE_CHANGE=$(( $NEW_BINARY_SIZE - $OLD_BINARY_SIZE ))
166+
PERCENTAGE_CHANGE=$(( SIZE_CHANGE * 100 / $OLD_BINARY_SIZE ))
167+
echo "Size change: $PERCENTAGE_CHANGE%"
168+
if [ $PERCENTAGE_CHANGE -gt 2 ]; then
169+
echo "❌ binary size increased by more than 2% ($PERCENTAGE_CHANGE%)"
170+
exit 1
171+
else
172+
echo "✅ binary size change is within acceptable range ($PERCENTAGE_CHANGE%)"
173+
fi
174+
175+
176+
- name: Remove previous *_binary_*.txt
177+
run: |
178+
rm -rf ./jaeger_binary_size.txt
179+
mv ./new_jaeger_binary_size.txt ./jaeger_binary_size.txt
180+
181+
- name: Save new jaeger binary size
182+
if: ${{ (github.event_name == 'push') && (github.ref == 'refs/heads/main') }}
183+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 #v4.2.0
184+
with:
185+
path: ./jaeger_binary_size.txt
186+
key: jaeger_binary_size_${{ github.run_id }}

0 commit comments

Comments
 (0)