This jumpstart deploys an end-to-end Spark observability stack into your Microsoft Fabric workspace β an Eventstream that captures Spark events from any environment you opt in, an Eventhouse-backed KQL database for durable telemetry, a real-time dashboard for live visualization, a Python analyzer that writes SparkLens and Fabric recommendations, and a Fabric Data Agent grounded on the analyzer's output so you can ask "why was this job slow?" in plain English.
β±οΈ Deploy time: ~3 minutes. Plan another ~20 minutes to walk through the dashboard, run the simulator, and exercise the Spark Advisor.
What Gets Deployed
| Item | Type | Role |
|---|---|---|
Fabric Spark Monitoring Setup | Notebook | One-time bootstrap. Installs fabric-deployment-tool + semantic-link-labs, finds the deployed vasa-spark-simulator environment, appends it to any user-provided environment list, then calls fab_update_environments_spark_monitor() so Spark workloads using those environments stream events into the Eventstream's IngestionEndpoint. |
Vasa Spark Simulator Pipeline | DataPipeline | Runs the simulator notebook in a sequential ForEach over job numbers 1β30 (@range(1, 30)), then runs both Clinical Trial notebooks. |
Vasa Spark Simulator | Notebook | Pip-installs the vasa_spark_simulator-0.1.0 wheel and runs one synthetic Spark job for the pipeline-provided actual_job value. The notebook hard-codes its own NUM_ROWS = 1_000_000 and DURATION_MINUTES = 2, so the pipeline's num_rows / duration_minutes parameters are passed but ignored. |
Clinical Trial Results Orginial | Notebook | Sample Spark workload deliberately written with classic pitfalls β Python UDFs, repeated recomputation without caching, excessive repartitioning, groupByKey, and a driver collect(). The upstream display name includes a leading space and the typo "Orginial"; the docs preserve it because that is what users see after deployment. |
Clinical Trial Results Optimized | Notebook | Same workload after applying tuning recommendations β a paired before/after comparison. |
vasa-spark-simulator | Environment | Pinned Spark/Python environment used by the simulator notebooks. |
SparkMonitoringStream | Eventstream | Source: a CustomEndpoint named IngestionEndpoint. Destination: the Eventhouse, writing to the RawLogs table via DirectIngestion. |
Fabric Platform Monitoring | Eventhouse | Container for the KQL database below. |
Spark Monitoring | KQLDatabase | All telemetry lives here. RawLogs is the raw ingest table; update policies derive SparkDriverLogs, SparkExecutorLogs, SparkSQLExecutionEvents, SparkDerivedTaskMetrics, SparkMetrics, and SparkEventLogs; the analyzer writes to the pre-created sparklens_* and fabric_recommedations tables. |
EmbeddedRealTimeQueryset | (embedded in the KQL DB) | A KQL queryset JSON embedded in the database definition. In the upstream source it contains authoring data-source IDs and maintenance snippets for clearing SparkLens tables, so treat it as optional rather than the primary user surface. |
Spark Monitoring Dashboard | KQLDashboard | Real-time tiles for active jobs, executor health, stage durations, shuffle volume, failed-task counts. |
Fabric Spark Advisor | DataAgent | LLM agent grounded on selected KQL tables, including SparkSQLExecutionEvents, sparklens_metadata, sparklens_summary, sparklens_metrics, sparklens_predictions, sparklens_recommedations, and fabric_recommedations. |
Spark Monitoring Recommedations | Notebook | The analyzer driver. Pip-installs spark_monitoring_analyzer-0.2.0 from anumicrosoftlab/fabric-spark-monitoring, calls run(kusto_uri=kustoUri, database=database, chunk_size=30), reads RawLogs, and writes results back to the sparklens_* and fabric_recommedations tables. |
Spark Recommender Pipeline | DataPipeline | Runs the analyzer notebook with KustoURIfqdn and KQLDatabase parameters. parameter.yml rewrites KustoURIfqdn to the deployed Eventhouse query URI. |
How It Works
Wiring β getting Spark events into the Eventstream
The Setup notebook is the entry point. It does three things:
- Installs
fabric-deployment-toolandsemantic-link-labsin the current session. - Finds the deployed
vasa-spark-simulatorenvironment and appends it to any environments you list manually. The notebook will raise anIndexErrorifvasa-spark-simulatoris not present in the current workspace β it does not gracefully skip a missing simulator environment. - Calls
fab_update_environments_spark_monitor(environments, ..., "SparkMonitoringStream", "IngestionEndpoint")β this updates Spark configs on those Environments so workloads using them emit Spark events to the Eventstream'sCustomEndpointsource.
Ingest β Eventstream to Eventhouse
SparkMonitoringStream has a single destination: Fabric Platform Monitoring (Eventhouse), table RawLogs, mode DirectIngestion. Every Spark event from every opted-in environment lands in RawLogs within seconds, durably stored and KQL-queryable from the Spark Monitoring database.
Generate workload β the simulator
Vasa Spark Simulator Pipeline runs a sequential ForEach over @range(1, 30) (30 jobs), invoking Vasa Spark Simulator each time with the actual_job parameter. After the loop the pipeline also runs the clinical-trial workload pair: the upstream Clinical Trial Results Orginial notebook and Clinical Trial Results Optimized. Trigger the pipeline once and you get a representative mix of telemetry for the dashboard and recommender. Or run each notebook individually if you want to control the comparison timing yourself.
| Notebook | Purpose |
|---|---|
Vasa Spark Simulator | Synthetic, realistic-looking Spark event stream β keeps the dashboard alive without waiting for real workloads. |
Clinical Trial Results Orginial | Deliberately slow Spark workload β Python UDFs, no caching, excessive repartitioning, groupByKey, and driver collection. |
Clinical Trial Results Optimized | Same workload tuned β built-in expressions, early column pruning, one cache, one repartition, DataFrame aggregation, and no driver collection. |
Analyze β the Sparklens-style recommender
Spark Monitoring Recommedations is a one-cell notebook driven by Spark Recommender Pipeline. Each run:
- Pip-installs
spark_monitoring_analyzer-0.2.0(open-source wheel fromanumicrosoftlab/fabric-spark-monitoring). - Calls
run(kusto_uri=..., database=..., chunk_size=30). - Reads
RawLogsin chunks, parses Spark events per application. - Computes per-app metrics β CPU efficiency, parallelism saturation, GC overhead, task-skew ratio, driver vs. executor wall-clock split.
- Writes free-text SparkLens recommendations and Fabric/Delta best-practice checks.
- Writes executor-scaling estimates for multiple executor counts / multipliers.
- Writes back into Kusto:
| Table | What's in it |
|---|---|
sparklens_metadata | One row per application β application name, artifact metadata, capacity/workspace IDs, executor min/max, environment and Livy IDs, Spark native setting. |
sparklens_summary | Stage-level task and shuffle statistics per application β task counts, failed tasks, duration percentiles, input/output/shuffle volumes, executor counts. |
sparklens_metrics | (applicationId, metric, value) triples β efficiency, parallelism, GC, skew, durations. |
sparklens_predictions | One row per scaling scenario per app β Executor Count, Executor Multiplier, Estimated Executor WallClock, Estimated Total Duration. |
sparklens_recommedations | Free-text SparkLens recommendations keyed by app_id. |
fabric_recommedations | Free-text Fabric/Delta best-practice recommendations keyed by app_id. |
Consume β Dashboard, Queryset, and the Spark Advisor
Three consumption surfaces sit on top of the KQL database:
Spark Monitoring Dashboardβ a real-time KQL dashboard with curated tiles for job throughput, stage skew, executor utilization, shuffle volume, and failed-task counts. Open it the moment the install completes.EmbeddedRealTimeQuerysetβ an embedded queryset JSON inside the KQL database. The source version is mostly maintenance snippets and authoring data-source metadata, so the dashboard and Data Agent are the primary consumption surfaces.Fabric Spark Advisorβ the Data Agent. Grounded on selected KQL tables, especiallysparklens_*,fabric_recommedations, andSparkSQLExecutionEvents, it answers natural-language questions about job performance. The agent's instructions tell it to query the right table for each question class β recommendations vs. predictions vs. metrics β and to back every claim with a value from the data.
"Which job in the last hour had the worst stage skew, and what's the most likely cause?"
"For application17725780354600001, which executor count has the lowest estimated total duration?"
"Show me the top SparkLens recommendations across the last 24 hours, grouped by application."
The agent and the dashboard are independent consumers of the same Kusto database. The recommendations notebook is not called by the agent β Spark Recommender Pipeline runs it and refreshes the agent's grounding tables.
Try It β A 20-Minute Walkthrough
- Install β
jumpstart.install("spark-monitoring-and-optimization")and wait for the ~3-minute deploy. - Bootstrap β open
Fabric Spark Monitoring Setup, add any extra environment IDs you want to monitor, and run all cells. The notebook automatically includes the deployedvasa-spark-simulatorenvironment and wires the selected environments to emit events toSparkMonitoringStream. - Start the simulator β trigger
Vasa Spark Simulator Pipelineonce. It runs 30 simulator jobs and the clinical-trial before/after notebooks. OpenSpark Monitoring Dashboard; tiles populate as events arrive. - Run the analyzer β trigger
Spark Recommender Pipeline(or runSpark Monitoring Recommedationsmanually). This pip-installs the analyzer, processes the events that just landed inRawLogs, and populates thesparklens_*+fabric_recommedationstables. - Ask the advisor β open
Fabric Spark Advisorand try one of the sample prompts above. The agent queries the freshly-written analyzer tables and answers in natural language. - Inspect the data directly β open the
Spark MonitoringKQL database and runsparklens_summary | top 10 by max_duration_sec descto see the slowest stages the analyzer found.
Extending the Accelerator
| Extension | How |
|---|---|
| Monitor your own workloads | Add your production Spark Environment IDs to the environments list in Fabric Spark Monitoring Setup, then rerun the notebook. Jobs using those environments are captured automatically. |
| Add your own dashboards | Clone tiles from Spark Monitoring Dashboard and edit the KQL β the analyzer tables (sparklens_*, fabric_recommedations) are defined in the Spark Monitoring KQL database schema. |
| Persist recommendations elsewhere | Modify Spark Monitoring Recommedations after the run(...) call to read sparklens_recommedations and write to a Lakehouse Delta table, Teams channel, or work-item system. |
| Send alerts | Add an Activator (Reflex) on a KQL query that fires when failed-task rate exceeds a threshold, when sparklens_summary.max_duration_sec crosses a limit, or when new rows appear in sparklens_recommedations. |
| Add custom Spark Advisor skills | The Data Agent is grounded on the KQL database; extend its system instructions with new natural-language β KQL examples directly in the agent's configuration. |
| Tune analyzer throughput | Edit the chunk_size argument in Spark Monitoring Recommedations β the executable cell defaults to 30, while the notebook comments suggest 20 for unknown database sizes up to ~100 GB. |
Cost Notes
The analyzer notebook is a periodic batch β its cost scales with how often Spark Recommender Pipeline runs and the size of the RawLogs table. The Data Agent uses Fabric AI capacity per prompt, not per minute, so it's cheap to leave deployed.
Requirements
- A Microsoft Fabric workspace with at least F2 capacity (Eventhouse + Real-Time Dashboard need it).
- Permissions to create Eventstream, Eventhouse, KQL Database, KQL Dashboard, Data Agent, Notebook, Data Pipeline, and Environment items.
- A Spark Custom Pool for the monitored environment. The setup notebook notes that the Diagnostic Emitter extension is not supported on the Starter Pool.
- Fabric AI capacity enabled in the tenant for the Data Agent.
- Outbound internet from the Spark cluster running
Spark Monitoring Recommedationsβ it pip-installs the analyzer wheel from GitHub on every run.
Resources
- Source repository β ecotte/fabric-platform-monitoring @ v0.2.5
spark_monitoring_analyzerwheel source β anumicrosoftlab/fabric-spark-monitoring- Microsoft Fabric β Real-Time Intelligence overview
- Eventhouse documentation
- Kusto Query Language (KQL) reference
- Fabric Data Agents overview
- Spark performance tuning in Fabric