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

User metadata #141

Closed
mfateev opened this issue Jan 11, 2021 · 9 comments
Closed

User metadata #141

mfateev opened this issue Jan 11, 2021 · 9 comments
Labels
enhancement New feature or request

Comments

@mfateev
Copy link
Member

mfateev commented Jan 11, 2021

Is your feature request related to a problem? Please describe.
There is a need to attach additional information to commands for troubleshooting and diagraming purposes. For example thread-id of a thread that invoked an activity or scheduled a timer.

Describe the solution you'd like
The proposal is to add a metadata field to the Command protobuf. Then SDKs would be able to add use case specific information to commands.

@mfateev mfateev added the enhancement New feature or request label Jan 11, 2021
@yiminc yiminc transferred this issue from temporalio/temporal Oct 8, 2022
@williambanfield
Copy link

williambanfield commented May 31, 2023

This would be pretty helpful for us. At the moment, I am planning on creating a small activity called 'annotate' that takes a list of strings so that the list of strings will be stored and output alongside workflow information.

@cretz
Copy link
Member

cretz commented May 31, 2023

We have since added a SDK metadata command at temporalio/api#259 but it is task level meant for SDK internal use.

I am planning on creating a small activity called 'annotate'

Note, you'll probably want to make this a local activity that is a single-event marker instead of a full activity. But agreed, we should support arbitrary metadata on commands (and maybe an arbitrary log marker).

@Quinn-With-Two-Ns
Copy link
Contributor

Another user ask that would be solved if we could attach metadata to commands

@williambanfield
Copy link

@cretz

single-event marker instead of a full activity

How does one go about doing this?

@cretz
Copy link
Member

cretz commented May 31, 2023

Use a local activity. It's automatically an inline single-command/event thing as opposed to activities which is multi-event and may execute on a remote worker.

@cretz
Copy link
Member

cretz commented Jan 5, 2024

To be more specific here, I think we take an approach similar to temporalio/api#259 but for commands/events. We should add temporal.api.sdk.v1.WorkflowEventMetadata to both temporal.api.command.v1.Command and temporal.api.history.v1.HistoryEvent (or just to specific attributes we know can handle them). And server should put the metadata on the events created from the commands. WorkflowEventMetadata can have common, well-typed fields like string friendly_name or in generic cases in cahoots with UI, there can be a map<string, string> ui_info or similar.

@cretz
Copy link
Member

cretz commented Mar 5, 2024

After internal discussion, it was decided that the approach here is an event metadata that, for now, is a map of enumerate keys and payload values. The enumerate keys are well-known metadata keys that UI can leverage, and the payload values are encryptable. I will link an API PR when available. Arbitrary user-defined keys is not going to be available at this time, but the well-known keys will have lots of opportunity for users to provide extra event information.

@cretz cretz changed the title Add metadata to command Event metadata Mar 5, 2024
@cretz cretz changed the title Event metadata User metadata Mar 18, 2024
@cretz
Copy link
Member

cretz commented Mar 18, 2024

This has been changed to "user metadata" and after internal discussion, the initial API PR for public discussion is available at temporalio/api#371.

@cretz
Copy link
Member

cretz commented May 22, 2024

I am closing this in favor of the clearer #486.

@cretz cretz closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants