Skip to content

Commit

Permalink
Added execution summary to analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
spaghettidba committed Sep 14, 2022
1 parent 1c0c223 commit b5bad04
Show file tree
Hide file tree
Showing 3 changed files with 276 additions and 82 deletions.
8 changes: 6 additions & 2 deletions WorkloadTools/Consumer/Analysis/AnalysisConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public int UploadIntervalMinutes
public bool SqlNormalizerTruncateTo4000 { get; set; }
public bool SqlNormalizerTruncateTo1024 { get; set; }

public override void ConsumeBuffered(WorkloadEvent evt)
public bool WriteDetail { get; set; } = true;
public bool WriteSummary { get; set; } = true;

public override void ConsumeBuffered(WorkloadEvent evt)
{
if(analyzer == null)
{
Expand All @@ -51,7 +54,8 @@ public override void ConsumeBuffered(WorkloadEvent evt)
ConnectionInfo = this.ConnectionInfo,
MaximumWriteRetries = this.MaximumWriteRetries,
TruncateTo1024 = this.SqlNormalizerTruncateTo1024,
TruncateTo4000 = this.SqlNormalizerTruncateTo4000
TruncateTo4000 = this.SqlNormalizerTruncateTo4000,
WriteDetail = this.WriteDetail
};
}

Expand Down
37 changes: 37 additions & 0 deletions WorkloadTools/Consumer/Analysis/DatabaseSchema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,43 @@ CREATE TABLE [{SchemaName}].[WorkloadDetails](
)



IF OBJECT_ID('{SchemaName}.WorkloadSummary') IS NULL

CREATE TABLE [{SchemaName}].[WorkloadSummary](
[application_id] [int] NOT NULL,
[database_id] [int] NOT NULL,
[host_id] [int] NOT NULL,
[login_id] [int] NOT NULL,

[min_cpu_us] [bigint] NULL,
[max_cpu_us] [bigint] NULL,
[sum_cpu_us] [bigint] NULL,

[min_reads] [bigint] NULL,
[max_reads] [bigint] NULL,
[sum_reads] [bigint] NULL,

[min_writes] [bigint] NULL,
[max_writes] [bigint] NULL,
[sum_writes] [bigint] NULL,

[min_duration_us] [bigint] NULL,
[max_duration_us] [bigint] NULL,
[sum_duration_us] [bigint] NULL,

[execution_count] [bigint] NULL,

CONSTRAINT PK_WorkloadSummary PRIMARY KEY CLUSTERED (
[application_id],
[database_id],
[host_id],
[login_id]
)
)



IF OBJECT_ID('{SchemaName}.Applications') IS NULL

CREATE TABLE [{SchemaName}].[Applications](
Expand Down
Loading

0 comments on commit b5bad04

Please sign in to comment.