How to get the workflow execution time from external system using java sdk to use it for Metrics

Hello Experts,

I am new to Temporal and looking for some information for my POC where i need to know how to get the execution time for the workflow(irrespective of sync or async) which is triggered from external system and then how can i view them on my metric using the helmcharts.

At the same time how can we pass the additional parameters in order to fetch the metrics. I have followed the steps as mentioned in How to enable Metrics Support using JAVA SDK for my set up.

Thanks in advance


Hey @techFool,

A few general notes on Temporal metrics (not specific to accessing metrics via Java SDK).

  • We publish a few Grafana dashboards that render some metrics. The dashboards could be found here:
  • Temporal Helm charts, by default (the full “Batteries Included” configuration), install Prometheus + Grafana + these Temporal dashboards. I added a section to the README describing how to access those dashboards:
  • I do not know if we expose the metrics you have in mind, @samar might have better insights into specific metrics rendered by the dashboards.

  • I realize this is not a metric / you probably know this already / this is likely not what you are looking for, but for the sake of completeness, tctl cli (and Web UI) can give you the information on the state of the workflow, including its duration:


bash-5.0# tctl --ns benchtest wf list
      WORKFLOW TYPE      |                          WORKFLOW ID        |                RUN ID                |   TASK QUEUE   | START TIME | EXECUTION TIME | END TIME
  bench-driver           | activityheartbeat-2020-08-14T19:09:00Z      | 4999da9c-3ede-4ae8-88e2-deb74b9d2327 | temporal-bench | 19:09:00   | 19:09:00       | 19:09:12

$ tctl --ns benchtest wf describe --wid activityheartbeat-2020-08-14T19:09:00Z
    "startTime": "2020-08-14T19:09:00.265Z",
    "closeTime": "2020-08-14T19:09:12.565445317Z",
    "status": "Completed",

Thank you,