When an AI agent (or any program) uses the Metaflow Client API, it triggers a chain of HTTP requests to the metadata service. For example, finding all failed tasks in a run requires iterating Run → Steps → Tasks — but it is currently not possible to know, without external tooling, how many requests this generates or how the count scales with run size.
The MetadataProvider base class is the single choke point through which all client queries flow via the get_object() method. Adding optional request tracing here would give a precise, per-operation count of API calls made by any client operation, enabling systematic measurement of client-side efficiency.
Goals
- Add an opt-in tracing mode to
MetadataProvider that records: request count, object type requested, and hierarchy depth for each call to get_object()
- Verify the tracer captures all requests for a complete
Run → Steps → Tasks traversal
- Document the interface clearly so it can be used by benchmark scripts in a follow-up issue
Instructions
This issue is a venue for questions and design discussion. The implementation should be non-breaking — tracing is disabled by default and has no effect on normal usage.
Spin up the dev stack (see Resources) and run a flow against your local service before starting, so you have real data to trace against.
When you have met the goals, show your work via a fork with an issue / PRs explaining your work. You can add comments with what you achieve on the issue thread. You can reference the Fork/PR/issue in this issue.
Resources
Dev stack:
- Setting Up the Dev Stack — run
metaflow-dev up to get a full local environment (metadata service, DB, UI); use metaflow-dev shell to get a pre-configured shell pointing at it
- Once running, execute flows against your local stack from within the
metaflow-dev shell — real data is needed to trace requests against
Key code:
Docs:
When an AI agent (or any program) uses the Metaflow Client API, it triggers a chain of HTTP requests to the metadata service. For example, finding all failed tasks in a run requires iterating
Run → Steps → Tasks— but it is currently not possible to know, without external tooling, how many requests this generates or how the count scales with run size.The
MetadataProviderbase class is the single choke point through which all client queries flow via theget_object()method. Adding optional request tracing here would give a precise, per-operation count of API calls made by any client operation, enabling systematic measurement of client-side efficiency.Goals
MetadataProviderthat records: request count, object type requested, and hierarchy depth for each call toget_object()Run → Steps → TaskstraversalInstructions
This issue is a venue for questions and design discussion. The implementation should be non-breaking — tracing is disabled by default and has no effect on normal usage.
Spin up the dev stack (see Resources) and run a flow against your local service before starting, so you have real data to trace against.
When you have met the goals, show your work via a fork with an issue / PRs explaining your work. You can add comments with what you achieve on the issue thread. You can reference the Fork/PR/issue in this issue.
Resources
Dev stack:
metaflow-dev upto get a full local environment (metadata service, DB, UI); usemetaflow-dev shellto get a pre-configured shell pointing at itmetaflow-dev shell— real data is needed to trace requests againstKey code:
metaflow/metadata_provider/metadata.py#L79—MetadataProviderbase classmetaflow/metadata_provider/metadata.py#L352—get_object(), the method all client queries go throughmetaflow/client/core.py#L376—MetaflowObject.__iter__(), where traversal is initiatedmetaflow/client/core.py#L2149—RunclassDocs: