dhiaayachi / temporal

Temporal service
https://docs.temporal.io
MIT License
0 stars 0 forks source link

Support registering search attributes as an option/config #22

Open dhiaayachi opened 2 months ago

dhiaayachi commented 2 months ago

Describe the solution you'd like

In CLI we foolishly used operator service to register search attributes immediately after start, but users just check whether port is available to see if started and therefore it may race against operator service.

What we'd like is the ability to set search attributes. Basically something like go.temporal.io/server/temporal.WithSearchAttributes that accepts a map[string]enums.IndexedValueType (or any other structure) and does not start the server until those are confirmed set with that value type. I think the best way is to register if attr name not there, do nothing if attr name there and the proper type, and fail startup if attr there but wrong type. It's possible this can be used for general server config too.

dhiaayachi commented 2 months ago

Thanks for the feature request! It's great to hear that you're finding ways to use Temporal in new and creative ways.

The ability to set search attributes as a server-level configuration would be a nice addition to the Temporal CLI. However, the current version of the Temporal CLI doesn't have this capability.

You can achieve the desired behavior by adding search attributes for a specific namespace using the temporal operator search-attribute create command as detailed in the Temporal CLI operator command reference.

Temporal will continue to evolve with feature additions and improvements over time. We appreciate your feedback as we build the future of Temporal.

dhiaayachi commented 2 months ago

Thanks for the feature request!

Temporal currently doesn't have a way to wait for Search Attributes to be registered before starting a server. However, you could set a configuration value in your development.yaml file for system.enableReadFromSecondaryVisibility, which is enabled by default. You could then wait for an external signal, such as an HTTP call to an endpoint, and update this value to true to enable the secondary Visibility feature. This will enable your application to query the secondary visibility database to get a list of Search Attributes for your application.

You can use the temporal operator search-attribute list command to display a list of Search Attributes available in your cluster.

You can learn more about setting up a secondary Visibility feature here.