Skip to content

Commit 0a68639

Browse files
Merge branch 'main' into g-tracking
2 parents 207b15c + 97f40a9 commit 0a68639

File tree

8 files changed

+374
-15
lines changed

8 files changed

+374
-15
lines changed

.github/actions/setup-go-tip/action.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,18 @@ runs:
4141
4242
# If download failed, we will try to build tip from source.
4343
# This requires Go toolchain, so install it first.
44+
- name: Determine latest Go version
45+
if: steps.download.outputs.success == 'false'
46+
id: get_go_version
47+
run: |
48+
LATEST_GO_VERSION=$(curl -s "https://go.dev/VERSION?m=text")
49+
echo "LATEST_GO_VERSION=$LATEST_GO_VERSION" >> $GITHUB_OUTPUT
50+
4451
- name: Install Go toolchain
4552
if: steps.download.outputs.success == 'false'
4653
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
4754
with:
48-
go-version: 1.24.x
55+
go-version: ${{ steps.get_go_version.outputs.LATEST_GO_VERSION }}
4956

5057
- name: Build Go Tip from source
5158
if: steps.download.outputs.success == 'false'

.github/workflows/ci-comment.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Metrics Comparison and Post Comment
2+
on:
3+
workflow_run:
4+
workflows: ["E2E Tests"]
5+
types: [completed]
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
jobs:
10+
metrics-comparison:
11+
name: Compare Metrics
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.event.repository.default_branch }}
18+
19+
- name: Install adm-zip
20+
run: npm install adm-zip
21+
22+
- name: Download all metrics artifacts from triggering workflow
23+
id: download-artifacts
24+
uses: actions/github-script@v7
25+
with:
26+
script: |
27+
const { owner, repo } = context.repo;
28+
const workflowRunId = context.payload.workflow_run.id;
29+
30+
// List all artifacts from the triggering workflow run
31+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
32+
owner,
33+
repo,
34+
run_id: workflowRunId,
35+
});
36+
37+
// Download and extract each artifact
38+
const fs = require('fs');
39+
const path = require('path');
40+
const AdmZip = require('adm-zip');
41+
42+
for (const artifact of artifacts.data.artifacts) {
43+
const download = await github.rest.actions.downloadArtifact({
44+
owner,
45+
repo,
46+
artifact_id: artifact.id,
47+
archive_format: 'zip',
48+
});
49+
50+
const zip = new AdmZip(Buffer.from(download.data));
51+
zip.extractAllTo(path.join(process.env.GITHUB_WORKSPACE, '.metrics', artifact.name), true);
52+
console.log(`Extracted artifact: ${artifact.name}`);
53+
}
54+
55+
// Extract PR number (adapted from PDF logic)
56+
let prNumber = null;
57+
const pullRequest = await github.rest.pulls.list({
58+
owner,
59+
repo,
60+
head: `${context.payload.workflow_run.head_repository.full_name}:${context.payload.workflow_run.head_branch}`,
61+
});
62+
63+
if (pullRequest.data.length > 0) {
64+
prNumber = pullRequest.data[0].number;
65+
} else {
66+
// Fallback to commit SHA if needed
67+
const commitSha = context.payload.workflow_run.head_sha;
68+
const prsForCommit = await github.rest.repos.listPullRequestsAssociatedWithCommit({
69+
owner,
70+
repo,
71+
commit_sha: commitSha,
72+
});
73+
if (prsForCommit.data.length > 0) {
74+
prNumber = prsForCommit.data[0].number;
75+
}
76+
}
77+
78+
if (prNumber) {
79+
console.log(`Found PR Number: ${prNumber}`);
80+
core.setOutput('pr_number', prNumber);
81+
} else {
82+
console.log('Could not determine PR number. Skipping comment.');
83+
core.setFailed('Could not determine PR number for commenting.');
84+
}
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
88+
- name: Install dependencies
89+
if: success() && steps.download-artifacts.outputs.pr_number
90+
run: |
91+
python3 -m pip install prometheus-client
92+
npm install @actions/core @actions/github
93+
94+
- name: Compare metrics and generate summary
95+
if: success() && steps.download-artifacts.outputs.pr_number
96+
id: compare-metrics
97+
shell: bash
98+
run: |
99+
bash ./scripts/e2e/metrics_summary.sh
100+
env:
101+
LINK_TO_ARTIFACT: "https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}"
102+
103+
- name: Post PR comment with combined metrics summary
104+
if: steps.compare-metrics.outputs.DIFF_FOUND == 'true' && steps.download-artifacts.outputs.pr_number
105+
uses: thollander/actions-comment-pull-request@v3
106+
with:
107+
file-path: ./.metrics/combined_summary.md
108+
github-token: '${{ secrets.GITHUB_TOKEN }}'
109+
comment-tag: "## Metrics Comparison Summary"
110+
pr-number: ${{ steps.download-artifacts.outputs.pr_number }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
uses: ./.github/workflows/ci-e2e-opensearch.yml
3939

4040
query:
41-
uses: ./.github/workflows/ci-e2e-query.yml
41+
uses: ./.github/workflows/ci-e2e-query.yml
File renamed without changes.

cmd/jaeger/internal/extension/remotesampling/extension.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,25 +139,19 @@ func (ext *rsExtension) Shutdown(ctx context.Context) error {
139139
var errs []error
140140

141141
if ext.httpServer != nil {
142-
if err := ext.httpServer.Shutdown(ctx); err != nil {
143-
errs = append(errs, fmt.Errorf("failed to stop the sampling HTTP server: %w", err))
144-
}
142+
errs = append(errs, ext.httpServer.Shutdown(ctx))
145143
}
146144

147145
if ext.grpcServer != nil {
148146
ext.grpcServer.GracefulStop()
149147
}
150148

151149
if ext.distLock != nil {
152-
if err := ext.distLock.Close(); err != nil {
153-
errs = append(errs, fmt.Errorf("failed to stop the distributed lock: %w", err))
154-
}
150+
errs = append(errs, ext.distLock.Close())
155151
}
156152

157153
if ext.strategyProvider != nil {
158-
if err := ext.strategyProvider.Close(); err != nil {
159-
errs = append(errs, fmt.Errorf("failed to stop strategy provider: %w", err))
160-
}
154+
errs = append(errs, ext.strategyProvider.Close())
161155
}
162156
return errors.Join(errs...)
163157
}

0 commit comments

Comments
 (0)