Skip to content

Commit 9d42292

Browse files
authored
update 4x branch 20240424 (#3987)
1 parent 218f926 commit 9d42292

File tree

10 files changed

+332
-207
lines changed

10 files changed

+332
-207
lines changed

.tav.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ undici:
481481
- versions:
482482
mode: max-7
483483
include: '>=6.0.0 <7'
484-
node: '>=18'
484+
node: '>=18.17.0'
485485
commands: node test/instrumentation/modules/undici/undici.test.js
486486
- versions:
487487
mode: max-7

CHANGELOG.asciidoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ Notes:
3333
3434
See the <<upgrade-to-v4>> guide.
3535
36+
[[release-notes-4.5.3]]
37+
==== 4.5.3 - 2024/04/23
38+
39+
[float]
40+
===== Bug fixes
41+
42+
* Fix message handling for tombstone messages in `kafkajs` instrumentation.
43+
({pull}3985[#3985])
44+
45+
3646
[[release-notes-4.5.2]]
3747
==== 4.5.2 - 2024/04/12
3848

CONTRIBUTING.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,27 @@ A release involves the following published artifacts:
202202
```
203203
If there are particular highlights for the release, then it can be helpful
204204
to point those out in the PR description.
205+
205206
2. Get your PR reviewed, ensure PR checks pass, then merge.
207+
206208
3. Working on the elastic repo now (not a fork), tag the merged commit with:
207209
`git tag vx.y.x && git push origin vx.y.z`.
208210
For example: `git tag v1.2.3 && git push origin v1.2.3`.
209211
(The GitHub Actions CI "release" workflow will handle all the release
210212
steps -- including the `npm publish`. See the appropriate run at:
211213
https://github.com/elastic/apm-agent-nodejs/actions/workflows/release.yml)
214+
212215
4. If this is for the latest major (currently `4.x`), then the "4.x" branch
213-
needs to be updated to the same state as the release tag on "main".
214-
**Open a PR to rebase all commits from main on to the "4.x" branch,
215-
get it approved, merge with the rebase strategy.**
216-
(The periodic [docs CI job](https://elasticsearch-ci.elastic.co/view/Docs/job/elastic+docs+master+build/)
217-
uses this branch to update the [published docs](https://www.elastic.co/guide/en/apm/agent/nodejs/current/release-notes-4.x.html).)
216+
needs to be updated to the same state as the release tag on "main". Use
217+
the [update-4x-branch.sh](./dev-utils/update-4x-branch.sh) script for this.
218+
219+
- Run `./dev-utils/update-4x-branch.sh` to create a working dir with the
220+
needed changes.
221+
- Follow its instructions to create a PR from this working dir.
222+
- Ensure the "buildkite/docs-build-pr" workflow passes for this branch.
223+
- "Squash and merge" the PR.
224+
- The periodic docs CI will update the
225+
[published docs](https://www.elastic.co/guide/en/apm/agent/nodejs/current/release-notes-4.x.html).
218226
219227
If this is a new major release, then:
220228

dev-utils/update-4x-branch.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
#
3+
# Create a PR to update the 4.x branch to match the state of "main" for the
4+
# just-tagged release. The 4.x branch needs to be updated for the current docs
5+
# build.
6+
#
7+
8+
if [ "$TRACE" != "" ]; then
9+
export PS4='${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
10+
set -o xtrace
11+
fi
12+
set -o errexit
13+
set -o pipefail
14+
15+
function fatal {
16+
echo "$(basename $0): error: $*"
17+
exit 1
18+
}
19+
20+
TOP=$(cd $(dirname $0)/../ >/dev/null; pwd)
21+
WRKDIR=${TOP}/build/update-4x-branch
22+
23+
echo "# Creating working git clone in: ${WRKDIR}/apm-agent-nodejs"
24+
rm -rf $WRKDIR
25+
mkdir -p $WRKDIR
26+
cd $WRKDIR
27+
git clone [email protected]:elastic/apm-agent-nodejs.git
28+
cd apm-agent-nodejs
29+
30+
TARGTAG=$(git tag --points-at HEAD)
31+
if [[ ! ("$TARGTAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]$) ]]; then
32+
fatal "the tag on HEAD, '${TARGTAG}', does not look like a release tag"
33+
fi
34+
# echo "TARGTAG=$TARGTAG"
35+
36+
readonly NUM_COMMITS_SANITY_GUARD=200
37+
LASTTAG=$(
38+
git log --pretty=format:%h -$NUM_COMMITS_SANITY_GUARD | tail -n +2 | while read sha; do
39+
possible=$(git tag --points-at $sha)
40+
if [[ "$possible" =~ ^v[0-9]+\.[0-9]+\.[0-9]$ ]]; then
41+
echo $possible
42+
break
43+
fi
44+
done
45+
)
46+
if [[ -z "$LASTTAG" ]]; then
47+
fatal "could not find previous release tag in last $NUM_COMMITS_SANITY_GUARD commits"
48+
fi
49+
# echo "LASTTAG=$LASTTAG"
50+
51+
52+
# Merging generally fails, IME. Let's attempt to cherry-pick each commit.
53+
# - That 'awk' command is to reverse the lines of commit shas.
54+
# `tac` works on Linux, `tail -r` works on BSD/macOS.
55+
# https://stackoverflow.com/a/744093/14444044
56+
echo
57+
echo "# Creating PR to update 4.x branch with commits from $LASTTAG to $TARGTAG."
58+
FEATBRANCH=update-4x-branch-$(date +%Y%m%d)
59+
git checkout 4.x
60+
git checkout -b "$FEATBRANCH"
61+
git log --pretty=format:"%h" $LASTTAG...$TARGTAG \
62+
| awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }' \
63+
| while read sha; do
64+
echo "$ git cherry-pick $sha"
65+
git cherry-pick $sha
66+
done
67+
68+
echo
69+
echo "# You can create a PR now with:"
70+
echo " cd $WRKDIR/apm-agent-nodejs"
71+
echo " gh pr create --fill -w -B 4.x -t 'docs: update 4.x branch for $TARGTAG release'"
72+

lib/instrumentation/modules/kafkajs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ module.exports = function (mod, agent, { version, enabled }) {
138138
config.captureBody === 'all' ||
139139
config.captureBody === 'transactions'
140140
) {
141-
messageCtx.body = message.value.toString();
141+
messageCtx.body = message.value?.toString();
142142
}
143143

144144
if (message.headers && config.captureHeaders) {

0 commit comments

Comments
 (0)