Repository navigation
flowx profile ADF TCO profiler phase + flowx-profile skill - #143
lorenzorubi-db wants to merge 6 commits into
Conversation
ghanse
left a comment
There was a problem hiding this comment.
@lorenzorubi-db thanks for adding this. I've added some changes in #152 to streamline the dependency installation if the user runs /setup or uses our notebook to install the MCP app. Can you take a look?
…ure scan, cost estimate vs Cost Management actuals)
…t substring match
eb3a6f9 to
e1114d4
Compare
…original script, plus the test-factory template to create data
…and actuals cover the same window
…ling isn't missing from the comparison
…ference, falling back to duration only when it's missing
|
@ghanse thanks for your previous review, I've reviewed and commented #152 Quite a few changes in this PR done after your review:
I've built two small test factories (Azure IR + managed VNet, ARM template in tests/integration/azure/profiler/factory/), ran them for a weekend, and compared the estimate with Cost Management meter by meter. That surfaced a few fixes, each its own commit with tests:
It replays one live capture offline and checks the port against the original script's per-pipeline costs. Every place we deliberately differ is listed with its reason, and the test fails if a difference disappears. It runs in make integration (similarly to #154 but for profiler).
The biggest pending gap is adding the Managed-VNet start-up/keep-warm (TTL) time (about 2× costs under on our managed-VNet factory).
Thanks! |
Changes
Ports a standalone ADF cost profiler into flowx as a new
flowx profile --source adfphase and aflowx-profileskill. It answers "what does this ADF estate cost today?": a live Azure scan of recent pipeline/activity runs, priced at Azure list rates, compared with what Azure actually billed (Cost Management).What's in it
flowx profile --source adf, standalone. It talks to Azure directly, doesn't readmetadata/inventory.json, and doesn't needdiscoverto have run.--source airflowis rejected cleanly ("profiling is not supported for the airflow source"). It's wired via a new optionalprofile_moduleslot onflowx.sources.Source.<output_dir>/metadata/tco/cost_comparison.{csv,md}, overwritten each run (no timestamped folders), with factory-level estimate vs actual and pipeline-level estimates. It doesn't collide with discover'smetadata/profile_report.csv.profileextra (azure-identity,requests). It's imported lazily, so other phases and Airflow users never need azure. A missing extra gives an install hint (exit 2), not a traceback. Plugin venv:pip install 'azure-identity>=1.17'.DefaultAzureCredentialcode path. Locally:az login. Genie Code / serverless / CI: a service principal from a Databricks secret scope via env vars. Missing roles degrade with a warning naming the role to add (Reader, Data Factory Contributor, Cost Management Reader). A failed sign-in prints setup guidance and exits 2.Tests
manually tested
added unit tests
added integration tests
ruff+mypyclean. Full unit suite: 1379 passing (~100 new profiler tests, all from hand-written fixtures, no live Azure needed). They cover the cost math, the pricing parser, discovery and pagination through an injectable replay transport, report output, runner errors, and phase routing.Preliminary live validation (read-only,
field-engsubscription, one factory with 45 runs over 45 days): the phase runs end to end (sign-in, discovery, run queries, live regional pricing, Cost Management actuals, report) and exits 0. The live run surfaced two bugs inherited from the original script, both fixed here with tests built from the live response shapes:Azure Data Factory v2. The match is exact, so infrastructure meters such asAzure Data Factory v2 - Managed Airflowand Private Link stay excluded.name (Region), so the lookup missed. Separately, every Azure IR has typeManaged; a managed VNet is now detected from the IR'smanagedVirtualNetworkproperty.Limitations
Managed-VNet keep-warm time (TTL) isn't modelled, and on managed-VNet factories it's most of the bill. A managed-VNet IR keeps its external compute warm for a time-to-live (60 min on the test factory) after each activity, and Azure bills that time. On the live factory, Azure billed 44.6 h (≈ $26.80 after discount) for 45 short notebook runs, while the estimate counts 7.25 h of activity time ($7.34 at list price).
modifications to README and documentation on the profiler: TBD