# Fabric Monitoring

> Use for monitoring Fabric Warehouse queries — OPTION (LABEL = '...') for tracking, the queryinsights schema (exec_requests_history, exec_sessions_history, long_running_queries, frequently_run_queries), 30-day retention, 15-minute appearance lag, the `Invalid object name` gotcha on newly-created warehouses, and diagnosing slow/stale Lakehouse SQLEP reads under the new metadata-sync preview (`sys.d…

- **Type:** Skill
- **Install:** `agentstack add skill-wardawgmalvicious-claude-config-fabric-monitoring`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [wardawgmalvicious](https://agentstack.voostack.com/s/wardawgmalvicious)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [wardawgmalvicious](https://github.com/wardawgmalvicious)
- **Source:** https://github.com/wardawgmalvicious/claude-config/tree/main/skills/fabric-monitoring

## Install

```sh
agentstack add skill-wardawgmalvicious-claude-config-fabric-monitoring
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Monitoring & diagnostics

## Query Labels

```sql
SELECT ... FROM ...
OPTION (LABEL = 'PROJECT_Module_Description');
```

Labels appear in `queryinsights.exec_requests_history.label`. Use for tracking, filtering, and performance analysis.

## Query Insights (30-day retention)

| View | Purpose |
|---|---|
| `queryinsights.exec_requests_history` | Every completed query: status, duration, CPU, data scanned |
| `queryinsights.exec_sessions_history` | Session history: login info, times |
| `queryinsights.long_running_queries` | Aggregated: median vs last-run time |
| `queryinsights.frequently_run_queries` | Run counts, execution times for recurring patterns |

**Gotcha**: Data appears with up to 15 minutes delay. After creating a new warehouse, views may return "Invalid object name" — wait ~2 minutes.

## Top Expensive Queries

```sql
SELECT TOP 10
    distributed_statement_id, query_hash, label,
    total_elapsed_time_ms, allocated_cpu_time_ms,
    data_scanned_remote_storage_mb, result_cache_hit
FROM queryinsights.exec_requests_history
ORDER BY allocated_cpu_time_ms DESC;
```

Aggregate by `query_hash` over the last 7 days to find recurring expensive patterns.

## DMVs (Live State)

| DMV | Shows | Min Role |
|---|---|---|
| `sys.dm_exec_connections` | Active connections (session_id, client_address) | Admin only |
| `sys.dm_exec_sessions` | Authenticated sessions (login_name, login_time, status) | All roles (own sessions) |
| `sys.dm_exec_requests` | Active requests (command, start_time, total_elapsed_time) | All roles (own requests) |

```sql
-- Find long-running queries
SELECT request_id, session_id, command, start_time, total_elapsed_time, status
FROM sys.dm_exec_requests
WHERE status = 'running'
ORDER BY total_elapsed_time DESC;

-- Identify the user
SELECT login_name FROM sys.dm_exec_sessions WHERE session_id = ;

-- Kill a runaway query (Admin only)
KILL '';
```

## SQL Endpoint Metadata Sync (new sync — Preview, May 2026)

Diagnose slow/stale Lakehouse SQLEP reads when queries return data older than what has landed. On endpoints created under the **new metadata-sync preview** (opt-in, new endpoints only):

```sql
-- Inspect per-table sync freshness and blocked state
SELECT last_update_time_utc, latest_log_version, latest_checkpoint_version, is_blocked
FROM sys.dm_db_external_tables_log_status;   -- is_blocked: 1 = last update blocked, 0 = succeeded

-- Force a targeted refresh of one table's data (data-only changes)
EXEC sys.sp_dw_refresh_ext_table 'dbo.';
```

Schema changes (add/drop tables or columns, type changes) need the full-item Refresh SQL endpoint metadata REST API instead. Full preview note — enablement, architecture, limitations — lives in the **fabric-spark skill**; the slow-SQLEP gotcha cross-references it in the **fabric-gotchas skill**.

## Result Set Caching (Preview)

`result_cache_hit` field in `exec_requests_history`: `1` = cache hit, `0` = miss, **negative values** = reason caching was skipped. Non-deterministic functions (`GETDATE()`, `NEWID()`) prevent caching. Cache auto-invalidates when underlying data changes.

## Statistics

Auto-maintained for single-column histograms, average column length, and table cardinality. Manual `CREATE STATISTICS` / `UPDATE STATISTICS` available.

**Gotcha**: After a rolled-back transaction containing a large INSERT, auto-generated statistics can be inaccurate. Run `UPDATE STATISTICS` manually on affected columns to recover.

## Reference

- Microsoft Learn: [Monitor Fabric Data Warehouse (overview)](https://learn.microsoft.com/fabric/data-warehouse/monitoring-overview)
- Microsoft Learn: [Query insights in Fabric Data Warehouse](https://learn.microsoft.com/fabric/data-warehouse/query-insights)
- Microsoft Learn: [Use query labels in Fabric Data Warehouse](https://learn.microsoft.com/fabric/data-warehouse/query-label)
- Comprehensive MS Learn link bundle (per-view T-SQL refs / DMVs / capacity throttling / workspace monitoring): [references/REFERENCE.md](references/REFERENCE.md)

## See also

- fabric-warehouse skill — T-SQL authoring rules for the queries you're monitoring
- fabric-gotchas skill — cross-cutting error index

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [wardawgmalvicious](https://github.com/wardawgmalvicious)
- **Source:** [wardawgmalvicious/claude-config](https://github.com/wardawgmalvicious/claude-config)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-wardawgmalvicious-claude-config-fabric-monitoring
- Seller: https://agentstack.voostack.com/s/wardawgmalvicious
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
