Skip to content

Commit

Permalink
Merge branch 'release/v1.28.x-0.49bx' into cherrypick-4270
Browse files Browse the repository at this point in the history
  • Loading branch information
aabmass committed Nov 15, 2024
2 parents 463061b + 2929ebd commit f6f1550
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 78 deletions.
77 changes: 0 additions & 77 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,80 +129,3 @@ jobs:
--notes-file /tmp/release-notes.txt \
--discussion-category announcements \
v$STABLE_VERSION
- uses: actions/checkout@v4
with:
# the step below is creating a pull request against main
ref: main

- name: Copy change log updates to main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
# this was not a patch release, so the version exists already in the CHANGELOG.md
# update the release date
date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
sed -Ei "s/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} .*/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/" CHANGELOG.md
# the entries are copied over from the release branch to support workflows
# where change log entries may be updated after preparing the release branch
# copy the portion above the release, up to and including the heading
sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/p" CHANGELOG.md > /tmp/CHANGELOG.md
# copy the release notes
cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
# copy the portion below the release
sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} /d;0,/^## Version /{/^## Version/!d};p" CHANGELOG.md \
>> /tmp/CHANGELOG.md
# update the real CHANGELOG.md
cp /tmp/CHANGELOG.md CHANGELOG.md
else
# this was a patch release, so the version does not exist already in the CHANGELOG.md
# copy the portion above the top-most release, not including the heading
sed -n "0,/^## Version /{ /^## Version /!p }" CHANGELOG.md > /tmp/CHANGELOG.md
# add the heading
date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
echo "## Version ${STABLE_VERSION}/${UNSTABLE_VERSION} ($date)" >> /tmp/CHANGELOG.md
# copy the release notes
cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
# copy the portion starting from the top-most release
sed -n "/^## Version /,\$p" CHANGELOG.md >> /tmp/CHANGELOG.md
# update the real CHANGELOG.md
cp /tmp/CHANGELOG.md CHANGELOG.md
fi
- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh

- name: Create pull request against main
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
message="Copy change log updates from $GITHUB_REF_NAME"
body="Copy log updates from \`$GITHUB_REF_NAME\`."
branch="opentelemetrybot/copy-change-log-updates-from-${GITHUB_REF_NAME//\//-}"
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
if git diff --quiet; then
echo there are no updates needed to the change log on main, not creating pull request
exit 0 # success
fi
fi
git commit -a -m "$message"
git push origin HEAD:$branch
gh pr create --title "$message" \
--body "$body" \
--head $branch \
--base main
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ def _encode_log(log_data: LogData) -> PB2LogRecord:
if log_data.log_record.trace_id == 0
else _encode_trace_id(log_data.log_record.trace_id)
)
body = log_data.log_record.body
return PB2LogRecord(
time_unix_nano=log_data.log_record.timestamp,
observed_time_unix_nano=log_data.log_record.observed_timestamp,
span_id=span_id,
trace_id=trace_id,
flags=int(log_data.log_record.trace_flags),
body=_encode_value(log_data.log_record.body),
body=_encode_value(body) if body is not None else None,
severity_text=log_data.log_record.severity_text,
attributes=_encode_attributes(log_data.log_record.attributes),
dropped_attributes_count=log_data.log_record.dropped_attributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ def test_encode(self):
sdk_logs, expected_encoding = self.get_test_logs()
self.assertEqual(encode_logs(sdk_logs), expected_encoding)

def test_encode_no_body(self):
sdk_logs, expected_encoding = self.get_test_logs()
for log in sdk_logs:
log.log_record.body = None

for resource_log in expected_encoding.resource_logs:
for scope_log in resource_log.scope_logs:
for log_record in scope_log.log_records:
log_record.ClearField("body")

self.assertEqual(encode_logs(sdk_logs), expected_encoding)

def test_dropped_attributes_count(self):
sdk_logs = self._get_test_logs_dropped_attributes()
encoded_logs = encode_logs(sdk_logs)
Expand Down

0 comments on commit f6f1550

Please sign in to comment.