Update custom tag value of built-in metrics

hi,
I have followed the example for metrics given here and have used a custom tag with default value.
We need to update this tag inside the workflow during runtime.
The tag itself is of type string and value is also string which depicts the input format/type.

Appreciate if anyone can guide me on how to update the custom tag value.

This is not possible right now, tags and their values have to be static. The set scopes/tags that are configured via WorkflowServiceStubsOptions are not reconfigured for each workflow execution.

Can you explain your use case for this?
You have the ability to set custom metrics

In activity code:
Activity.getExecutionContext().getMetricsScope()...

In workflow code:
Workflow.getMetricsScope()...

Another thing to maybe look at is using custom Search Attributes which you can upsert during workflow execution.

We want to add a custom tag and a placeholder value during the metric registration/startup. And then during runtime, update the tag’s value based on certain criteria (here input type)

  1. We want to use the default metrics provided by temporal SDK.
  2. We want additional custom tags to existing metrics.
  3. Update the custom tag values during runtime.

If this is not possible, is there way where I can tweak this through class extensions or custom impl.

  1. is not currently possible. Would suggest opening issue in Java SDK repo.

Would like to understand use case for this and why it cannot be solved via custom metrics or search attributes.

Search attributes have to be executed on temporal server, which is access controlled and might affect other applications connecting to same server.

And for custom metrics, we don’t need to introduce one more metric and re-invent the wheel. Or are you suggesting adding custom metric with same name as the one provided in SDK like (temporal_workflow_endtoend_latency_seconds)

@tihomir Submitted request Support dynamic values for custom tags in metrics. · Issue #1195 · temporalio/sdk-java · GitHub

@tihomir / @maxim Is this feature still not available? I see couple of linked issues

Hi, you are correct. Not yet available, please follow issue here.