diff --git a/MP.Data/DbModels/Utils/StatsErrorModel.cs b/MP.Data/DbModels/Utils/StatsErrorModel.cs
new file mode 100644
index 00000000..57efc9ca
--- /dev/null
+++ b/MP.Data/DbModels/Utils/StatsErrorModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace MP.Data.DbModels.Utils
+{
+ [Table("stats_errors")]
+ public class StatsErrorModel
+ {
+ [Key] public int Id { get; set; }
+ public string Destination { get; set; } = "";
+ public string Type { get; set; } = "";
+ public DateTime Hour { get; set; }
+ public string ErrorMessage { get; set; } = "";
+ public long Count { get; set; }
+ }
+}
diff --git a/MP.Data/DbModels/Utils/StatsStatusCodeModel.cs b/MP.Data/DbModels/Utils/StatsStatusCodeModel.cs
new file mode 100644
index 00000000..18576c9b
--- /dev/null
+++ b/MP.Data/DbModels/Utils/StatsStatusCodeModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace MP.Data.DbModels.Utils
+{
+ [Table("stats_status_codes")]
+ public class StatsStatusCodeModel
+ {
+ [Key] public int Id { get; set; }
+ public string Destination { get; set; } = "";
+ public string Type { get; set; } = "";
+ public DateTime Hour { get; set; }
+ public int StatusCode { get; set; }
+ public long Count { get; set; }
+ }
+}
diff --git a/MP.Data/Migrations/MoonPro_Utils/20260511071223_AddErrorsAndStatusCodes.Designer.cs b/MP.Data/Migrations/MoonPro_Utils/20260511071223_AddErrorsAndStatusCodes.Designer.cs
new file mode 100644
index 00000000..9acf271e
--- /dev/null
+++ b/MP.Data/Migrations/MoonPro_Utils/20260511071223_AddErrorsAndStatusCodes.Designer.cs
@@ -0,0 +1,193 @@
+//
+using System;
+using MP.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MP.Data.Migrations.MoonPro_Utils
+{
+ [DbContext(typeof(MoonPro_UtilsContext))]
+ [Migration("20260511071223_AddErrorsAndStatusCodes")]
+ partial class AddErrorsAndStatusCodes
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .UseCollation("SQL_Latin1_General_CP1_CI_AS")
+ .HasAnnotation("ProductVersion", "6.0.36")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
+
+ modelBuilder.Entity("MP.Data.DbModels.Mtc.MtcSetupModel", b =>
+ {
+ b.Property("IdxMacchina")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("MtcDataItemsRaw")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("IdxMacchina");
+
+ b.ToTable("mtc_setup");
+ });
+
+ modelBuilder.Entity("MP.Data.DbModels.Utils.StatsAggregatedModel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
+
+ b.Property("AvgDuration")
+ .HasColumnType("float");
+
+ b.Property("Destination")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Hour")
+ .HasColumnType("datetime2");
+
+ b.Property("MachineId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("MaxDuration")
+ .HasColumnType("float");
+
+ b.Property("MinDuration")
+ .HasColumnType("float");
+
+ b.Property("NoReply")
+ .HasColumnType("bigint");
+
+ b.Property("RequestCount")
+ .HasColumnType("bigint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Destination", "MachineId", "Hour")
+ .IsUnique()
+ .HasDatabaseName("idx_statsaggr_env_mach_hour")
+ .HasFilter("[Destination] IS NOT NULL AND [MachineId] IS NOT NULL");
+
+ b.ToTable("stats_aggr");
+ });
+
+ modelBuilder.Entity("MP.Data.DbModels.Utils.StatsDetailModel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
+
+ b.Property("AvgDuration")
+ .HasColumnType("float");
+
+ b.Property("Destination")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Hour")
+ .HasColumnType("datetime2");
+
+ b.Property("MaxDuration")
+ .HasColumnType("float");
+
+ b.Property("MinDuration")
+ .HasColumnType("float");
+
+ b.Property("NoReply")
+ .HasColumnType("bigint");
+
+ b.Property("RequestCount")
+ .HasColumnType("bigint");
+
+ b.Property("Type")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Destination", "Type", "Hour")
+ .IsUnique()
+ .HasDatabaseName("idx_statsdet_hour_env_type")
+ .HasFilter("[Destination] IS NOT NULL AND [Type] IS NOT NULL");
+
+ b.ToTable("stats_detail");
+ });
+
+ modelBuilder.Entity("MP.Data.DbModels.Utils.StatsErrorModel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
+
+ b.Property("Count")
+ .HasColumnType("bigint");
+
+ b.Property("Destination")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ErrorMessage")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Hour")
+ .HasColumnType("datetime2");
+
+ b.Property("Type")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Destination", "Type", "Hour", "ErrorMessage")
+ .IsUnique()
+ .HasDatabaseName("idx_statserr_dest_type_hour_err")
+ .HasFilter("[Destination] IS NOT NULL AND [Type] IS NOT NULL AND [ErrorMessage] IS NOT NULL");
+
+ b.ToTable("stats_errors");
+ });
+
+ modelBuilder.Entity("MP.Data.DbModels.Utils.StatsStatusCodeModel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
+
+ b.Property("Count")
+ .HasColumnType("bigint");
+
+ b.Property("Destination")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Hour")
+ .HasColumnType("datetime2");
+
+ b.Property("StatusCode")
+ .HasColumnType("int");
+
+ b.Property("Type")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Destination", "Type", "Hour", "StatusCode")
+ .IsUnique()
+ .HasDatabaseName("idx_statscode_dest_type_hour_code")
+ .HasFilter("[Destination] IS NOT NULL AND [Type] IS NOT NULL");
+
+ b.ToTable("stats_status_codes");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/MP.Data/Migrations/MoonPro_Utils/20260511071223_AddErrorsAndStatusCodes.cs b/MP.Data/Migrations/MoonPro_Utils/20260511071223_AddErrorsAndStatusCodes.cs
new file mode 100644
index 00000000..abe01d3c
--- /dev/null
+++ b/MP.Data/Migrations/MoonPro_Utils/20260511071223_AddErrorsAndStatusCodes.cs
@@ -0,0 +1,70 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace MP.Data.Migrations.MoonPro_Utils
+{
+ public partial class AddErrorsAndStatusCodes : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "stats_errors",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Destination = table.Column(type: "nvarchar(450)", nullable: true),
+ Type = table.Column(type: "nvarchar(450)", nullable: true),
+ Hour = table.Column(type: "datetime2", nullable: false),
+ ErrorMessage = table.Column(type: "nvarchar(450)", nullable: true),
+ Count = table.Column(type: "bigint", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_stats_errors", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "stats_status_codes",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Destination = table.Column(type: "nvarchar(450)", nullable: true),
+ Type = table.Column(type: "nvarchar(450)", nullable: true),
+ Hour = table.Column(type: "datetime2", nullable: false),
+ StatusCode = table.Column(type: "int", nullable: false),
+ Count = table.Column(type: "bigint", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_stats_status_codes", x => x.Id);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "idx_statserr_dest_type_hour_err",
+ table: "stats_errors",
+ columns: new[] { "Destination", "Type", "Hour", "ErrorMessage" },
+ unique: true,
+ filter: "[Destination] IS NOT NULL AND [Type] IS NOT NULL AND [ErrorMessage] IS NOT NULL");
+
+ migrationBuilder.CreateIndex(
+ name: "idx_statscode_dest_type_hour_code",
+ table: "stats_status_codes",
+ columns: new[] { "Destination", "Type", "Hour", "StatusCode" },
+ unique: true,
+ filter: "[Destination] IS NOT NULL AND [Type] IS NOT NULL");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "stats_errors");
+
+ migrationBuilder.DropTable(
+ name: "stats_status_codes");
+ }
+ }
+}
diff --git a/MP.Data/Migrations/MoonPro_Utils/MoonPro_UtilsContextModelSnapshot.cs b/MP.Data/Migrations/MoonPro_Utils/MoonPro_UtilsContextModelSnapshot.cs
index 531fb160..aea0326e 100644
--- a/MP.Data/Migrations/MoonPro_Utils/MoonPro_UtilsContextModelSnapshot.cs
+++ b/MP.Data/Migrations/MoonPro_Utils/MoonPro_UtilsContextModelSnapshot.cs
@@ -119,6 +119,72 @@ namespace MP.Data.Migrations.MoonPro_Utils
b.ToTable("stats_detail");
});
+
+ modelBuilder.Entity("MP.Data.DbModels.Utils.StatsErrorModel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
+
+ b.Property("Count")
+ .HasColumnType("bigint");
+
+ b.Property("Destination")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ErrorMessage")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Hour")
+ .HasColumnType("datetime2");
+
+ b.Property("Type")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Destination", "Type", "Hour", "ErrorMessage")
+ .IsUnique()
+ .HasDatabaseName("idx_statserr_dest_type_hour_err")
+ .HasFilter("[Destination] IS NOT NULL AND [Type] IS NOT NULL AND [ErrorMessage] IS NOT NULL");
+
+ b.ToTable("stats_errors");
+ });
+
+ modelBuilder.Entity("MP.Data.DbModels.Utils.StatsStatusCodeModel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"), 1L, 1);
+
+ b.Property("Count")
+ .HasColumnType("bigint");
+
+ b.Property("Destination")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("Hour")
+ .HasColumnType("datetime2");
+
+ b.Property("StatusCode")
+ .HasColumnType("int");
+
+ b.Property("Type")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Destination", "Type", "Hour", "StatusCode")
+ .IsUnique()
+ .HasDatabaseName("idx_statscode_dest_type_hour_code")
+ .HasFilter("[Destination] IS NOT NULL AND [Type] IS NOT NULL");
+
+ b.ToTable("stats_status_codes");
+ });
#pragma warning restore 612, 618
}
}
diff --git a/MP.Data/MoonPro_UtilsContext.cs b/MP.Data/MoonPro_UtilsContext.cs
index 2875ed97..edb248e1 100644
--- a/MP.Data/MoonPro_UtilsContext.cs
+++ b/MP.Data/MoonPro_UtilsContext.cs
@@ -49,6 +49,8 @@ namespace MP.Data
public virtual DbSet DbSetStatsDet { get; set; }
public virtual DbSet DbSetStatsAggr { get; set; }
public virtual DbSet DbSetMtcSetup { get; set; }
+ public virtual DbSet DbSetStatsError { get; set; }
+ public virtual DbSet DbSetStatusCode { get; set; }
#endregion Public Properties
@@ -91,6 +93,16 @@ namespace MP.Data
.HasDatabaseName("idx_statsaggr_env_mach_hour")
.IsUnique();
+ modelBuilder.Entity()
+ .HasIndex(x => new { x.Destination, x.Type, x.Hour, x.ErrorMessage })
+ .HasDatabaseName("idx_statserr_dest_type_hour_err")
+ .IsUnique();
+
+ modelBuilder.Entity()
+ .HasIndex(x => new { x.Destination, x.Type, x.Hour, x.StatusCode })
+ .HasDatabaseName("idx_statscode_dest_type_hour_code")
+ .IsUnique();
+
OnModelCreatingPartial(modelBuilder);
}