Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orchestrator Instance ID not accessible from Activity function #242

Open
richardweaver opened this issue Feb 2, 2021 · 3 comments
Open
Labels
Enhancement New feature or request Needs: Investigation 🔍 A deeper investigation needs to be done by the project maintainers. P2 Priority 2 item

Comments

@richardweaver
Copy link

Describe the bug
I have a process that runs on Durable Functions that consists of a couple of Orchestrators, with some Sub-Orchestrators and a series of Activity functions. Within the Activity functions I am writing to Table storage with any data exceptions that can be used as a report. I'd like to group these reports by specifying the parent Orchestrator's InstanceId as the PartitionKey on the table.

Investigative information

  • Durable Functions extension version:
  • durable-functions npm module version:
  • Language (JavaScript/TypeScript) and version: Javascript
  • Node.js version: 12

To Reproduce
Steps to reproduce the behavior:

  1. Set a debugger break point inside a function with an activityTrigger
  2. Inspect the context parameter

While not required, providing your orchestrator's source code in anonymized form is often very helpful when investigating unexpected orchestrator behavior.

Expected behavior
Data regarding the calling orderstrator's instanceId and parentInstanceId to be included in the context object, much as it is part of the bindingData for a sub-orchestrator.

Actual behavior
Context includes the activity function's invocation ID but nothing related to the parent orchestrator,

Screenshots
subOrchestrationContext
activity

@ghost ghost added the Needs: Triage 🔍 label Feb 2, 2021
@davidmrdavid davidmrdavid added Needs: Investigation 🔍 A deeper investigation needs to be done by the project maintainers. P2 Priority 2 item and removed Needs: Triage 🔍 labels Feb 2, 2021
@davidmrdavid
Copy link
Collaborator

Hi @richardweaver,

Thank you for reaching out! This is an interesting use-case. I think this isn't a bug, just a currently unsupported use-case, but this would be good to have! I can investigate ways to make this happen during our next sprint, although that might take a few weeks since our current sprint just started.

In the meantime, I do want to provide you with a workaround. Technically, the orchestrator function could pass, as input to their activities, their instanceID. I believe the context object of the orchestrator function has an instanceID property as defined here. So, while we investigate adding this functionality, would this workaround satisfy your use-case?

Thanks! ⚡ ⚡

@davidmrdavid davidmrdavid self-assigned this Feb 2, 2021
@richardweaver
Copy link
Author

Thanks, yes I'd worked out that I can pass the orchestration ID as part of the input to activities. It's just a bit repetitive to do (I have about 20 functions that need to take this input) and I guess I'd just assumed that as an activity function is intrinsically a "child" of an orchestrator it would be there somewhere.

@davidmrdavid
Copy link
Collaborator

That's good to hear, I do think your intuition makes sense, and we should probably provide that metadata anyways. As I mentioned, I'll look to prioritizing this in the near future, but I'm glad to hear we at least have a workaround

@lilyjma lilyjma added the Enhancement New feature or request label Jan 6, 2024
@davidmrdavid davidmrdavid removed their assignment Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Needs: Investigation 🔍 A deeper investigation needs to be done by the project maintainers. P2 Priority 2 item
Projects
None yet
Development

No branches or pull requests

3 participants