The other day I was running some Analysis Services traces for some reason or another and ran across Chris Webb's post on (Visualising Analysis Services Trace Information in Reporting Services). After looking over that post, I thought it'd be interesting to visualize various types of processing, queries, etc - basically take a trace and then graph out what happened and when. Here's a few samples of what the project yielded:
- Red: Cube Processing on a 2 Minute schedule
- Green: Cube Processing on a 1 hour schedule
- Blue: Cube Processing on a 1 hour schedule
- Black: Query Activity
Most of the activity here is from SSRS subscriptions firing around 8AM
This is the report filtered to only show events that had a duration greater than 10,000 MS (10 seconds) - Red cube is a trouble maker
And this is general SSAS activity over a few hours with the nearly instant events filtered out
The following query assumes that the trace data ended up in a table:
- @StartMillisecond: INT; Minimum relative start time (millisecond value, kinda have to guess and check)
- @EndMillisecond: INT; Maximum relative start time (millisecond value, kinda have to guess and check)
- @MinDuration: INT; Minimum duration in milliseconds
;WITH [ProcessEvent] AS ( SELECT 'Process' AS [Event] ,cast([TextData] AS XML).value ('declare namespace B="http://schemas.microsoft.com/analysisservices/2003/engine"; (//B:DatabaseID)[1]' ,'VARCHAR(1024)') AS [DatabaseID] ,cast([TextData] AS XML).value ('declare namespace B="http://schemas.microsoft.com/analysisservices/2003/engine"; (//B:DimensionID)[1]' ,'VARCHAR(1024)') AS [DimensionID] ,cast([TextData] AS XML).value ('declare namespace B="http://schemas.microsoft.com/analysisservices/2003/engine"; (//B:MeasureGroupID)[1]' ,'VARCHAR(1024)') AS [MeasureGroupId] ,[StartTime] ,[Duration] FROM dbo.zTrace_MSAS_20091023_2 T WHERE T.[EventClass] = 16 AND T.[EventSubclass] IN (3, 12) AND [TextData] LIKE '%Process%' ), [QueryEvent] AS ( SELECT 'Query' AS [Event] ,[DatabaseName] AS [DatabaseID] ,NULL AS [DimensionID] ,NULL AS [MeasureGroupId] ,[StartTime] ,[Duration] FROM dbo.zTrace_MSAS_20091023_2 T WHERE T.[EventClass] = 10 ), [Event] AS ( SELECT * FROM [ProcessEvent] UNION SELECT * FROM [QueryEvent] ) SELECT ROW_NUMBER() OVER (ORDER BY [StartTime] ASC) AS [EventId] ,DATEADD(HOUR, -5, [StartTime]) AS [StartTime] ,DATEDIFF(MILLISECOND, (SELECT MIN([StartTime]) FROM Event), [StartTime]) [RelativeStartTime] ,[Duration] ,[Event] ,[DatabaseID] ,CASE WHEN [DimensionID] IS NOT NULL THEN 'Dimension' WHEN [MeasureGroupID] IS NOT NULL THEN 'Measure Group' ELSE 'None' END AS [ObjectType] ,CASE WHEN [DimensionID] IS NOT NULL THEN [DimensionID] WHEN [MeasureGroupID] IS NOT NULL THEN [MeasureGroupID] ELSE 'None' END AS [ObjectId] FROM [Event] WHERE DATEDIFF(MILLISECOND, (SELECT MIN([StartTime]) FROM Event), [StartTime]) >= @StartMillisecond AND DATEDIFF(MILLISECOND, (SELECT MIN([StartTime]) FROM Event), [StartTime]) < @EndMillisecond AND Duration >= @MinDuration
A few notes on the report:
- [EventId] is the Series Group
- This is a Range chart type, the Bottom value was [RelativeStartTime] and the Top value was [RelativeStartTime] + [Duration]
- Coloring the series and markers uses the following expression
=Iif(Fields!Event.Value = "Process" ,Iif(Fields!DatabaseID.Value = "SSASDB" ,"Red" ,Iif(Fields!DatabaseID.Value = "OtherSSASDB" ,"Green" ,Iif(Fields!DatabaseID.Value = "YetAnotherSSASDB" ,"Blue" ,"Pink" ) ) ) ,"Black" )
And that's about it - if you have any more questions about it just let me know. Just seemed like an interesting way to look at trace data It also wouldn't be that difficult to generate events for other things, like your ETL processing and such so you could see that on top of everything else.