<#3126 Jan/dx 1324 add execution metrics endpoint ...
# flyte-github
c
#3126 Jan/dx 1324 add execution metrics endpoint in flyteremote Pull request opened by fiedlerNr9 Why are the changes needed? • Today there is no endpoint to query worklfow execution metrics • Especially these metrics are interesting for users to reason about task runtimes image What changes were proposed in this pull request? • adding
get_execution_metrics()
endpoint for friendly client • adding model for
Spans
How was this patch tested? • running this on a couple of workflows with different shape: from flytekit.remote import FlyteRemote from flytekit.configuration import Config r = FlyteRemote(config=Config.for_endpoint(endpoint="demo.hosted.unionai.cloud")) # execution_id = "altzn6pfw8ll6n4h8tdq" # static # execution_id = "a964rbl6l9q4thkwzgnj" # static fail execution_id = "a2hpw4nh9vjhxsbst8nc" # static loop # execution_id = "atkjvqqhdkxpbzphqm7t" # dynamic loop # execution_id = "agmqkz8jp5cprw62c9kc" # dynamic starting # execution_id = "a5lk5bcqvjxnkpxvp5h2" # dynamic nested # execution_id = "amlm77lsv4mmm2gqmgm2" # Spark # execution_id = "abkhbrztrmqdx4jvzxh5" # static retries # execution_id = "afhtl6l89wsvx4r2glvt" # map over task fails currently, lets fix in a follow up PR project = "jan-playground" domain = "development" exec = r.fetch_execution(project=project, domain=domain, name=execution_id) a = r.client.get_execution_metrics(id=exec.id, depth=10) def handle_node(node): node_id = node.node_id.node_id if node_id != "": # Check for existing nodes in the execution for node_span in node.spans: task_id = node_span.task_id.task_id.name if node_span.node_id.node_id != "": handle_node(node=node_span) elif task_id != "": print(f"{node_id} - {task_id}") task_metrics = {} for operation_span in node_span.spans: task_metrics[operation_span.operation_id] = ( operation_span.end_time.seconds - operation_span.start_time.seconds ) print(task_metrics) for span in a.spans: handle_node(node=span) Example output: image Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. Summary by Bito The implementation initially added a get_execution_metrics endpoint and Span model for workflow execution metrics, but was later refactored to remove the deprecated metrics module and Span model. The changes simplified the metrics retrieval logic through the friendly client while maintaining core capabilities for analyzing task runtimes and execution performance. Unit tests added: False Estimated effort to review (1-5, lower is better): 1 flyteorg/flytekit