Skip to content

Commit f6f1550

Browse files
committed
Merge branch 'release/v1.28.x-0.49bx' into cherrypick-4270
2 parents 463061b + 2929ebd commit f6f1550

File tree

4 files changed

+16
-78
lines changed

4 files changed

+16
-78
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -129,80 +129,3 @@ jobs:
129129
--notes-file /tmp/release-notes.txt \
130130
--discussion-category announcements \
131131
v$STABLE_VERSION
132-
133-
- uses: actions/checkout@v4
134-
with:
135-
# the step below is creating a pull request against main
136-
ref: main
137-
138-
- name: Copy change log updates to main
139-
env:
140-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141-
run: |
142-
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
143-
# this was not a patch release, so the version exists already in the CHANGELOG.md
144-
145-
# update the release date
146-
date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
147-
sed -Ei "s/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} .*/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/" CHANGELOG.md
148-
149-
# the entries are copied over from the release branch to support workflows
150-
# where change log entries may be updated after preparing the release branch
151-
152-
# copy the portion above the release, up to and including the heading
153-
sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/p" CHANGELOG.md > /tmp/CHANGELOG.md
154-
155-
# copy the release notes
156-
cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
157-
158-
# copy the portion below the release
159-
sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} /d;0,/^## Version /{/^## Version/!d};p" CHANGELOG.md \
160-
>> /tmp/CHANGELOG.md
161-
162-
# update the real CHANGELOG.md
163-
cp /tmp/CHANGELOG.md CHANGELOG.md
164-
else
165-
# this was a patch release, so the version does not exist already in the CHANGELOG.md
166-
167-
# copy the portion above the top-most release, not including the heading
168-
sed -n "0,/^## Version /{ /^## Version /!p }" CHANGELOG.md > /tmp/CHANGELOG.md
169-
170-
# add the heading
171-
date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
172-
echo "## Version ${STABLE_VERSION}/${UNSTABLE_VERSION} ($date)" >> /tmp/CHANGELOG.md
173-
174-
# copy the release notes
175-
cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
176-
177-
# copy the portion starting from the top-most release
178-
sed -n "/^## Version /,\$p" CHANGELOG.md >> /tmp/CHANGELOG.md
179-
180-
# update the real CHANGELOG.md
181-
cp /tmp/CHANGELOG.md CHANGELOG.md
182-
fi
183-
184-
- name: Use CLA approved github bot
185-
run: .github/scripts/use-cla-approved-github-bot.sh
186-
187-
- name: Create pull request against main
188-
env:
189-
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
190-
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
191-
run: |
192-
message="Copy change log updates from $GITHUB_REF_NAME"
193-
body="Copy log updates from \`$GITHUB_REF_NAME\`."
194-
branch="opentelemetrybot/copy-change-log-updates-from-${GITHUB_REF_NAME//\//-}"
195-
196-
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
197-
if git diff --quiet; then
198-
echo there are no updates needed to the change log on main, not creating pull request
199-
exit 0 # success
200-
fi
201-
fi
202-
203-
git commit -a -m "$message"
204-
git push origin HEAD:$branch
205-
gh pr create --title "$message" \
206-
--body "$body" \
207-
--head $branch \
208-
--base main

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- Fix crash exporting a log record with None body
11+
([#4276](https://github.com/open-telemetry/opentelemetry-python/pull/4276))
1012
- sdk: setup EventLogger when OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED is set
1113
([#4270](https://github.com/open-telemetry/opentelemetry-python/pull/4270))
1214

exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/_log_encoder/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ def _encode_log(log_data: LogData) -> PB2LogRecord:
4848
if log_data.log_record.trace_id == 0
4949
else _encode_trace_id(log_data.log_record.trace_id)
5050
)
51+
body = log_data.log_record.body
5152
return PB2LogRecord(
5253
time_unix_nano=log_data.log_record.timestamp,
5354
observed_time_unix_nano=log_data.log_record.observed_timestamp,
5455
span_id=span_id,
5556
trace_id=trace_id,
5657
flags=int(log_data.log_record.trace_flags),
57-
body=_encode_value(log_data.log_record.body),
58+
body=_encode_value(body) if body is not None else None,
5859
severity_text=log_data.log_record.severity_text,
5960
attributes=_encode_attributes(log_data.log_record.attributes),
6061
dropped_attributes_count=log_data.log_record.dropped_attributes,

exporter/opentelemetry-exporter-otlp-proto-common/tests/test_log_encoder.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ def test_encode(self):
5151
sdk_logs, expected_encoding = self.get_test_logs()
5252
self.assertEqual(encode_logs(sdk_logs), expected_encoding)
5353

54+
def test_encode_no_body(self):
55+
sdk_logs, expected_encoding = self.get_test_logs()
56+
for log in sdk_logs:
57+
log.log_record.body = None
58+
59+
for resource_log in expected_encoding.resource_logs:
60+
for scope_log in resource_log.scope_logs:
61+
for log_record in scope_log.log_records:
62+
log_record.ClearField("body")
63+
64+
self.assertEqual(encode_logs(sdk_logs), expected_encoding)
65+
5466
def test_dropped_attributes_count(self):
5567
sdk_logs = self._get_test_logs_dropped_attributes()
5668
encoded_logs = encode_logs(sdk_logs)

0 commit comments

Comments
 (0)