Skip to content

feat(trace): in v3, add cadenceIsCron tag in the start workflow span - #1072

Merged
shijiesheng merged 2 commits into
cadence-workflow:v3.13.xfrom
shijiesheng:add-is-cron-v3
Aug 18, 2026
Merged

feat(trace): in v3, add cadenceIsCron tag in the start workflow span#1072
shijiesheng merged 2 commits into
cadence-workflow:v3.13.xfrom
shijiesheng:add-is-cron-v3

Conversation

@shijiesheng

Copy link
Copy Markdown
Member

What changed?
Same as #1071 but for v3

Why?

How did you test it?

Potential risks

Release notes

Documentation Changes

Comment thread src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java Outdated
Signed-off-by: Shijie Sheng <liouvetren@gmail.com>
Signed-off-by: Shijie Sheng <liouvetren@gmail.com>
@gitar-bot

gitar-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Adds the cadenceIsCron tag to the start workflow span for v3 tracing, addressing the unreliable string reference comparison finding for cron schedules.

✅ 1 resolved
Bug: String reference comparison (!= "") for cronSchedule is unreliable

📄 src/main/java/com/uber/cadence/internal/tracing/TracingPropagator.java:75
attributes.getCronSchedule() != "" compares String references, not contents. This produces a correct result in the unit test only because the test passes a literal "", which is interned and therefore reference-equal to the "" literal in the comparison. In production, getCronSchedule() returns a String produced by Thrift/gRPC deserialization, which is a distinct heap object. For a non-cron workflow whose server-side value is an empty string, deserializedEmpty != "" evaluates to true, so cadenceIsCron would be incorrectly tagged true. Additionally, if getCronSchedule() returns null for non-cron workflows, null != "" is also true, again mis-tagging non-cron workflows as cron.

Use content comparison with null-safety instead of reference comparison. For example: .withTag(TAG_IS_CRON, attributes.getCronSchedule() != null && !attributes.getCronSchedule().isEmpty()). Note the existing unit tests would not catch this because they rely on interned literals; consider testing with a non-interned string (e.g. new String("")) or a null value.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@shijiesheng
shijiesheng merged commit 43000ea into cadence-workflow:v3.13.x Aug 18, 2026
7 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.

1 participant