Skip to content

Conversation

Normal
Copy link
Contributor

@Normal Normal commented Jul 30, 2025

Detailed Description
Added a new method HasActivityInfo to activity.go.

We use GetActivityInfo a lot to create some metrics in one core component. This component is heavily used in the system and called not only from cadence activities but also in other places. The current implementation of GetActivityInfo panicking if called not from the activity, it forces us to use panic-recover pattern which works but pollutes logs a lot:

defer func() {
    if r := recover(); r != nil {
        // Recovered from panic, context is not an activity context
    }
}()
info = activity.GetInfo(ctx)

We would like to avoid it with this:

if activity.HasInfo(ctx) {
    info = activity.GetInfo(ctx)
}

Impact Analysis

  • Backward Compatibility: it is compatible as the changeset only introduces a new method, current functions are unchanged
  • Forward Compatibility: it is compatible as the changeset doesn't introduce any new types, contracts and new function doesn't store any data

Testing Plan

  • Unit Tests: Yes
  • Persistence Tests: N/A
  • Integration Tests: No
  • Compatibility Tests: No

Rollout Plan

  • What is the rollout plan?
    Merge it and release a new client version
  • Does the order of deployment matter?
    No
  • Is it safe to rollback? Does the order of rollback matter?
    Safe to rollback, the order doesn't matter
  • Is there a kill switch to mitigate the impact immediately?
    No, not needed

@Normal Normal marked this pull request as ready for review July 30, 2025 22:46
Copy link

codecov bot commented Jul 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.20%. Comparing base (ba6fe77) to head (c232cf2).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Coverage Δ
internal/activity.go 89.90% <100.00%> (+0.18%) ⬆️
internal/internal_activity.go 62.15% <100.00%> (+0.45%) ⬆️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba6fe77...c232cf2. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sankari165 sankari165 merged commit 9ee0f06 into cadence-workflow:master Jul 31, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants