Skip to content

fix(client): propagate resolved instance ID and version to schedule request builder - #345

Merged
andystaples merged 4 commits into
microsoft:mainfrom
hardikkaurani:fix/schedule-orchestration-span-instance-id
Nov 6, 2026
Merged

andystaples merged 4 commits into
microsoft:mainfrom
hardikkaurani:fix/schedule-orchestration-span-instance-id

Conversation

@hardikkaurani

@hardikkaurani Hardik K (hardikkaurani) commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

Closes #343

When schedule_new_orchestration() is invoked without an explicit instance_id, resolved_instance_id is computed for the OpenTelemetry create-orchestration producer span. Previously, however, instance_id=instance_id (which is None) was passed to build_schedule_new_orchestration_req().

As a result, build_schedule_new_orchestration_req() generated a second random UUID for the backend CreateInstanceRequest. This caused the emitted OpenTelemetry span to record an instance ID that did not match the actual scheduled orchestration instance ID.

Changes Across Commits

  1. Commit 1: fix(client): pass resolved instance ID and version to schedule request builder

    • Updated both TaskHubGrpcClient.schedule_new_orchestration() and AsyncTaskHubGrpcClient.schedule_new_orchestration() to pass instance_id=resolved_instance_id and version=resolved_version to build_schedule_new_orchestration_req().
  2. Commit 2: test(tracing): verify sync schedule_new_orchestration matches OTel span instance ID

    • Added a unit test asserting that the instance ID generated by synchronous schedule_new_orchestration() matches the durabletask.task.instance_id attribute on the emitted producer span.
  3. Commit 3: test(tracing): verify async schedule_new_orchestration matches OTel span instance ID

    • Added an async unit test verifying that AsyncTaskHubGrpcClient.schedule_new_orchestration() with an auto-generated instance ID records the same ID in the emitted producer span.
  4. Commit 4: docs(client): document instance ID and version resolution propagation in schedule_new_orchestration

    • Documented instance ID and version resolution propagation in both client docstrings.

Verification

  • pytest tests/durabletask/test_client.py tests/durabletask/test_tracing.py
  • 147 tests passed.

…t builder

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…an instance ID

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
…pan instance ID

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
… in schedule_new_orchestration

Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 17:22
@hardikkaurani

Hardik K (hardikkaurani) commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi Bernd Verst (@berndverst) andystaples,

I've opened this PR to address #343 across four focused commits.

When instance_id is auto-generated by the client, schedule_new_orchestration() now forwards resolved_instance_id and resolved_version to build_schedule_new_orchestration_req(). This ensures that the emitted OpenTelemetry producer span and the outgoing service request use exactly the same instance ID.

Unit tests covering both synchronous and asynchronous clients have also been added.

Thank you for your time!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@andystaples
andystaples merged commit 17ec055 into microsoft:main Nov 6, 2026
24 checks passed
@andystaples

Copy link
Copy Markdown
Contributor

Hardik K (@hardikkaurani) Please make sure additions, changes, removals, and fixes, including small ones like these, are documented in the CHANGELOG files for all three libraries in the future. Just this once, I've approved and merged this one, and we will handle it in a follow-up, but expect it to block approvals in the future.

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.

TaskHubGrpcClient.schedule_new_orchestration records mismatched instanceId in OpenTelemetry producer span when instance_id is auto-generated

3 participants