agent.rendezvous.duration.ms)"
A sensible way to use metric groups is to map them to a stage or
module in your job. You may also encode certain high level properties
the job such as the region or stage (dev vs prod).
Publish Metrics:
Using torchelastic's metrics API is similar to using python's logging
framework. You first have to configure a metrics handler before trying
to add metric data.
The example below measures the latency for the "calculate()" function.
import time
   import torch.distributed.elastic.metrics as metrics
# makes all metrics other than the one from "my_module" to go /dev/null
   metrics.configure(metrics.NullMetricsHandler())
   metrics.configure(metrics.ConsoleMetricsHandler(), "my_module")
def my_method():
     start = time.time()
     calculate()
     end = time.time()
     metrics.put_metric("calculate_latency", int(end-start), "my_module")
You may also use the torch.distributed.elastic.metrics.prof` decorator
to conveniently and succinctly profile functions