Skip to content

Commit c7f6386

Browse files
authored
Merge branch 'main' into fix-redis-multi-spans
2 parents fedac52 + 23c5f4e commit c7f6386

File tree

417 files changed

+7280
-6751
lines changed

Some content is hidden

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

417 files changed

+7280
-6751
lines changed

.github/workflows/ossf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
persist-credentials: false
2525

26-
- uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
26+
- uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
2727
with:
2828
results_file: results.sarif
2929
results_format: sarif

.github/workflows/pr-review.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: PR review
2+
# This workflow is triggered when a PR review is submitted. It checks if the review is approved and runs a script to add labels to the PR based on the review.
3+
on:
4+
pull_request_review:
5+
types:
6+
- submitted
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
add-owner-approved-label:
13+
if: github.event.review.state == 'approved'
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Run add-labels-to-reviewed-pr.sh
23+
run: |
24+
chmod +x ./.github/workflows/scripts/add-labels-to-reviewed-pr.sh
25+
./.github/workflows/scripts/add-labels-to-reviewed-pr.sh
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
REPO: ${{ github.repository }}
29+
PR: ${{ github.event.pull_request.number }}

.github/workflows/release-please.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@ jobs:
5252
token: ${{ steps.otelbot-token.outputs.token }}
5353
fetch-depth: 0
5454

55-
# If we've created/updated a PR:
56-
# Sync the legacy "dependencies" key in package-lock.json.
57-
- name: Update package-lock.json in PR
58-
if: ${{ steps.release.outputs.pr }}
59-
run: |
60-
git config user.name otelbot
61-
git config user.email [email protected]
62-
npm install --ignore-scripts --package-lock-only
63-
git add package-lock.json
64-
git commit -m "chore: sync package-lock.json 'dependencies' key"
65-
git push
66-
6755
# If releases have been created, then publish to npm.
6856
npm-publish:
6957
needs: release-please
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright The OpenTelemetry Authors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Adds a "has:owner-approval" label to a PR if a reviewer who approved it is a component owner.
18+
19+
set -euo pipefail
20+
21+
if [[ -z "${REPO:-}" || -z "${PR:-}" ]]; then
22+
echo "One or more of REPO and PR have not been set. Please ensure each is set."
23+
exit 0
24+
fi
25+
26+
main () {
27+
CUR_DIRECTORY=$(dirname "$0")
28+
29+
# The latestReviews key returns the latest review for each reviewer cutting out any other reviews.
30+
JSON=$(gh pr view "${PR}" --json "files,author,latestReviews" | tr -dc '[:print:]' | sed -E 's/\\[a-z]//g')
31+
FILES=$(echo -n "${JSON}"| jq -r '.files[].path')
32+
LATEST_REVIEWS=$(echo -n "${JSON}" | jq -c '.latestReviews')
33+
34+
# Fetch components
35+
COMPONENTS=$(bash "${CUR_DIRECTORY}/get-components.sh" | tac) # Reversed so we visit subdirectories first
36+
37+
declare -A PROCESSED_COMPONENTS
38+
39+
for COMPONENT in ${COMPONENTS}; do
40+
COMPONENT_OWNERS=$(COMPONENT="${COMPONENT}" bash "${CUR_DIRECTORY}/get-codeowners.sh")
41+
42+
for FILE in ${FILES}; do
43+
MATCH=$(echo -n "${FILE}" | grep -E "^${COMPONENT}" || true)
44+
45+
if [[ -z "${MATCH}" ]]; then
46+
continue
47+
fi
48+
49+
# If we match a file with a component, skip further processing for this file
50+
if [[ -v PROCESSED_COMPONENTS["${COMPONENT}"] ]]; then
51+
continue
52+
fi
53+
PROCESSED_COMPONENTS["${COMPONENT}"]=true
54+
55+
# Check if updated file is owned by one of the reviewers"
56+
echo "${LATEST_REVIEWS}" | jq -c '.[]' | while IFS= read -r REVIEW; do
57+
REVIEW_AUTHOR=$(echo -n "${REVIEW}"| jq -r '.author.login')
58+
REVIEW_STATE=$(echo -n "${REVIEW}"| jq -r '.state')
59+
if [[ "${REVIEW_STATE}" == "APPROVED" ]]; then
60+
# Review is approved. Checking if reviewer is a component owner
61+
for OWNER in ${COMPONENT_OWNERS}; do
62+
if [[ "${REVIEW_AUTHOR}" == "${OWNER}" ]]; then
63+
echo "Reviewer $REVIEW_AUTHOR is a component owner. Adding 'has:owner-approval' label."
64+
gh pr edit "${PR}" --repo "${REPO}" --add-label "has:owner-approval"
65+
exit 0
66+
fi
67+
done
68+
fi
69+
done
70+
done
71+
done
72+
}
73+
74+
# Ensure the script does not block a PR even if it fails
75+
main || echo "Failed to run $0"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright The OpenTelemetry Authors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Gets the owners for a given component from the component_owners.yml file.
18+
19+
# Define the file path
20+
YML_FILE=".github/component_owners.yml"
21+
22+
if [[ -z "${COMPONENT:-}" ]]; then
23+
echo "COMPONENT has not been set, please ensure it is set."
24+
exit 1
25+
fi
26+
27+
FOUND=0
28+
29+
# Parse the YAML file and extract owners for the given component
30+
while IFS= read -r line; do
31+
# Check if the line matches the given component
32+
if [[ "$line" =~ ^[[:space:]]*${COMPONENT}:[[:space:]]*$ ]]; then
33+
FOUND=1
34+
continue
35+
fi
36+
37+
# If the component is found, extract owners
38+
if [[ $FOUND -eq 1 ]]; then
39+
# Stop if we encounter another component or an empty line
40+
if [[ "$line" =~ ^[[:space:]]*[^#]+: || -z "$line" ]]; then
41+
break
42+
fi
43+
44+
# Extract the owner (remove leading spaces and '- ')
45+
if [[ "$line" =~ ^[[:space:]]*-[[:space:]]*[^#]+ ]]; then
46+
OWNER=$(echo "$line" | sed -E 's/^[[:space:]]*-[[:space:]]*([^#]+).*/\1/')
47+
echo "$OWNER"
48+
fi
49+
fi
50+
done < "$YML_FILE"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright The OpenTelemetry Authors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# Gets the components from the component_owners.yml file.
18+
19+
20+
# Define the file path
21+
YML_FILE=".github/component_owners.yml"
22+
23+
# Parse the YAML file and extract components and their owners
24+
while IFS= read -r line; do
25+
# Check if the line contains a component (ends with ':')
26+
if [[ "$line" =~ ^[[:space:]]*[^#]+: ]]; then
27+
# Extract the component name (remove leading spaces and trailing ':')
28+
COMPONENT=$(echo "$line" | sed -E 's/^[[:space:]]*([^:]+):.*/\1/')
29+
echo "$COMPONENT"
30+
fi
31+
done < "$YML_FILE"

.github/workflows/test-all-versions.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ jobs:
168168
with:
169169
node-version: ${{ matrix.node }}
170170
- name: Install
171-
run: npm ci --ignore-scripts
171+
# Post install scripts are required for some deps for successful test
172+
# runs: sqlite3, better-sqlite3, and possibly esbuild.
173+
run: npm ci
172174
- name: Download Build Artifacts
173175
uses: actions/download-artifact@v5
174176
with:

.github/workflows/test.yml

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454

5555
unit-test:
5656
needs: compile
57+
runs-on: ubuntu-latest
5758
strategy:
5859
fail-fast: false
5960
matrix:
@@ -64,8 +65,9 @@ jobs:
6465
- "20"
6566
- "22"
6667
- "24"
67-
runs-on: ubuntu-latest
68-
services:
68+
# `&foo` syntax is a YAML anchor. See:
69+
# https://docs.github.com/en/actions/reference/workflows-and-actions/reusing-workflow-configurations#yaml-anchors-and-aliases
70+
services: &test_services
6971
memcached:
7072
image: memcached:1.6.39-alpine
7173
ports:
@@ -147,7 +149,7 @@ jobs:
147149
env:
148150
RABBITMQ_DEFAULT_USER: username
149151
RABBITMQ_DEFAULT_PASS: password
150-
env:
152+
env: &test_env
151153
RUN_CASSANDRA_TESTS: 1
152154
RUN_MEMCACHED_TESTS: 1
153155
RUN_MONGODB_TESTS: 1
@@ -218,6 +220,45 @@ jobs:
218220
run: npm run test:browser:ci:affected
219221
- name: Unit tests (Nodejs - Delta)
220222
run: npm run test:ci:affected
223+
224+
test-all-versions:
225+
needs: compile
226+
runs-on: ubuntu-latest
227+
strategy:
228+
fail-fast: false
229+
matrix:
230+
node:
231+
- "18"
232+
- "20"
233+
- "22"
234+
- "24"
235+
services: *test_services
236+
env: *test_env
237+
steps:
238+
- uses: actions/checkout@v5
239+
with:
240+
fetch-depth: 0
241+
- uses: actions/setup-node@v5
242+
with:
243+
node-version: ${{ matrix.node }}
244+
- run: npm ci
245+
- name: Download Build Artifacts
246+
uses: actions/download-artifact@v5
247+
with:
248+
name: compile-cache-${{ github.run_number }}
249+
path: .nx
250+
# Note: see comment in the compile job
251+
- name: Set base and head commits
252+
run: |
253+
if [ "${{github.event_name}}" == "push" ]; then
254+
echo "NX_BASE=origin/main~1" >> "$GITHUB_ENV"
255+
echo "NX_HEAD=origin/main" >> "$GITHUB_ENV"
256+
else
257+
echo "NX_BASE=origin/main" >> "$GITHUB_ENV"
258+
echo "NX_HEAD=HEAD" >> "$GITHUB_ENV"
259+
fi
260+
- name: Compile (Delta)
261+
run: npm run compile:ci:affected
221262
- name: Test All Versions (Delta)
222263
run: npm run test-all-versions:ci:affected
223264
- name: Upload Test Artifacts
@@ -232,9 +273,9 @@ jobs:
232273
packages/*/.nyc_output/**
233274
LICENSE
234275
235-
test-coverage-report:
276+
coverage-report:
277+
needs: test-all-versions
236278
runs-on: ubuntu-latest
237-
needs: unit-test
238279
steps:
239280
- name: Checkout
240281
uses: actions/checkout@v5
@@ -245,27 +286,17 @@ jobs:
245286
node-version: 18
246287
- name: Install
247288
run: npm ci --ignore-scripts
248-
# NOTE: keep this in sync with the node versions from `unit-test` job
289+
# Note: Keep this in sync with the node versions from `test-all-versions` job.
249290
- name: Download Test Artifacts (18)
250291
uses: actions/download-artifact@v5
251292
with:
252293
name: tests-coverage-cache-${{ github.run_number }}-18
253294
path: .
254-
- name: Download Test Artifacts (18.19.0)
255-
uses: actions/download-artifact@v5
256-
with:
257-
name: tests-coverage-cache-${{ github.run_number }}-18.19.0
258-
path: .
259295
- name: Download Test Artifacts (20)
260296
uses: actions/download-artifact@v5
261297
with:
262298
name: tests-coverage-cache-${{ github.run_number }}-20
263299
path: .
264-
- name: Download Test Artifacts (20.6.0)
265-
uses: actions/download-artifact@v5
266-
with:
267-
name: tests-coverage-cache-${{ github.run_number }}-20.6.0
268-
path: .
269300
- name: Download Test Artifacts (22)
270301
uses: actions/download-artifact@v5
271302
with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,5 @@ docs
8383
# version.ts file is automatically generated at compile time
8484
version.ts
8585
/.vs
86+
.cursor/rules/nx-rules.mdc
87+
.github/instructions/nx.instructions.md

.nycrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"src/platform/browser/*.ts",
1616
"test/*.ts",
1717
"webpack/*.js",
18-
".eslintrc.js"
18+
"eslint.config.mjs"
1919
],
2020
"all": true
2121
}

0 commit comments

Comments
 (0)