temporalio / temporalio/temporal

Support custom search attributes of type Duration

Open
#6,924 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
23.2k
Forks
1.9k
Avg merge
2d 8h
Merged PRs (30d)
228

Description

Is your feature request related to a problem? Please describe.
Yes, I'm trying to add a custom search attribute that capture duration between a collection of steps in the workflow execution. These are the subset of steps that define a business usecase in my workflow execution and hence being able to filter on workflows that exceeded a threshold is important. I'm trying to create a custom search attribute that behaves similar to the default ExecutionDuration filter. Currently temporal supports creating custom search attributes of type Int or Datetime. Neither of them support my usecase of being able to apply a filter using duration strings.

Describe the solution you'd like
Add support for creating custom search attributes of type Duration that allow users to filter using duration strings like 1m, 1h or 1d etc.

Describe alternatives you've considered
Currently I'm limited to creating a custom search attribute of the type Int and using numeric filters. Using Int as the type here is limiting users from applying the correct filters.
For example: If UserA creates a custom search attribute of type Int named myCustomDuration and stores milliseconds in it. UserB won't know that they have to provide milliseconds as values for applying the numeric filter.

Being able to use search attributes of type Duration would be very useful in such cases.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how custom Int and Datetime search attributes are created and how the default ExecutionDuration filter parses duration strings. Identify the entry points for attribute type validation and search filtering. Done means custom Duration attributes can be created and queried with values such as 1m, 1h, and 1d.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.