简体   繁体   English

监控来自 SQL 查询的 Power BI 刷新

[英]Monitor Power BI Refreshes from SQL Query

We have numerous Power BI dashboards that have Scheduled Refreshes.我们有许多具有计划刷新的 Power BI 仪表板。 These refreshes are SQL Agent jobs with names that are GUIDs.这些刷新是 SQL 代理作业,其名称为 GUID。 I'd like to be able to check on failed SQL Agent jobs and know what Power BI report/dashboard had it's refresh fail.我希望能够检查失败的 SQL 代理作业,并知道哪些 Power BI 报告/仪表板刷新失败。

Is there a way to use T-SQL to resolve the name GUIDs to the Power BI report?有没有办法使用 T-SQL 将名称 GUID 解析为 Power BI 报告? Something like:就像是:

SELECT * 
FROM msdb.dbo.sysjobs J 
JOIN ReportServer.dbo.Catalog C 
  ON CAST(C.ItemID AS UNIQUEIDENTIFIER) = CAST(J.name AS UNIQUEIDENTIFIER) 

I thought I would share what I figured out, in case others need to query the same info:我想我会分享我的发现,以防其他人需要查询相同的信息:

In the ReportServer database, the ExecutionLogStorage table had data I was looking for to tie the scheduled refreshes to the Catalog table.在 ReportServer 数据库中,ExecutionLogStorage 表包含我正在寻找的数据,以便将计划刷新与 Catalog 表联系起来。 There is a field in there called Request Type.那里有一个称为请求类型的字段。 RequestType 2 is the Cache Refreshes. RequestType 2 是缓存刷新。

  • 0 = Interactive, 0 = 交互式,
  • 1 = Subscription, 1 = 订阅,
  • 2 = Cache Refresh 2 = 缓存刷新

So, I used the following query to start reviewing the statuses of our Power BI Cache Refreshes:因此,我使用以下查询开始查看 Power BI 缓存刷新的状态:

SELECT L.TimeStart, L.TimeEnd, C.Path, L.AdditionalInfo, L.Status, 
    ROW_NUMBER() OVER (PARTITION BY C.Path ORDER BY L.TimeEnd DESC) AS rn, L.ExecutionId 
FROM ReportServer.dbo.ExecutionLogStorage L WITH(NOLOCK)
LEFT OUTER JOIN ReportServer.dbo.Catalog C WITH(NOLOCK) ON (L.ReportID = C.ItemID)
WHERE L.RequestType = 2 --cache refreshes
AND L.TimeEnd >= DATEADD(DAY,-1,GETDATE()) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM