From 01ea6d15c23decfd0f3d74f3c6e0b0ada9530ce0 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 9 Nov 2026 12:54:16 +0330 Subject: [PATCH] feat: refactor logging with OpenTelemetry integration refactor: migrate XRequestLogger to xLoggingService - Move Logging from xCommons to xLoggingService - Add new XRequestLoggingMiddleware - Integrate OpenTelemetry (v1.6.0) - Apply logging across xAiApi, xAiMcpServer, xIds - Update .gitignore for Logs folders Breaking Changes: - UseXRequestLogger now in xLoggingService.DI - OpenTelemetry packages updated --- Documents/Docs/ChangeLogs/1405-08-17-v01.html | 96 +++++++++++++ .../CommitMessage-1405-08-17-v01.txt | 136 ++++++++++++++++++ Modules/xCommons | 2 +- Modules/xLoggingService | 2 +- xAiApi | 2 +- xAiMcpServer | 2 +- xApi | 2 +- xIds | 2 +- 8 files changed, 238 insertions(+), 6 deletions(-) create mode 100644 Documents/Docs/ChangeLogs/1405-08-17-v01.html create mode 100644 Documents/Docs/ChangeLogs/CommitMessage-1405-08-17-v01.txt diff --git a/Documents/Docs/ChangeLogs/1405-08-17-v01.html b/Documents/Docs/ChangeLogs/1405-08-17-v01.html new file mode 100644 index 0000000..c782b90 --- /dev/null +++ b/Documents/Docs/ChangeLogs/1405-08-17-v01.html @@ -0,0 +1,96 @@ + + + + +گزارش تغییرات ۱۴۰۵/۰۸/۱۷ - v01 | xSaherelmWorkspace + + + +
+

گزارش تغییرات

سه شنبه ۱۷ آبان ۱۴۰۵ | 2026-11-09

+
نسخه: v01 | پروژه: xSaherelmWorkspace | وضعیت: تغییرات کامیت نشده
+
+

خلاصه تغییرات

+

بازسازی سیستم Logging: انتقال logging از xCommons به xLoggingService، middleware جدید، OpenTelemetry integration، و اعمال در تمام API.

+
هدف: متحد‌کردن logging و افزایش قابلیت رصد سیستم.
+
+ +

1️⃣ Modules/xCommons

+
  • حذف Middlewares/XRequestLogger.cs
  • +
  • تغییر XMiddlewareExtensions.cs
  • +
  • تغییر XLoggerModel.cs - اضافه Exception property
+
+ +

2️⃣ Modules/xLoggingService

+
  • جدید MIddlewares/XRequestLoggingMiddleware.cs
  • +
  • تغییر DI - اضافه OpenTelemetry methods
  • +
  • تغییر xLoggingService.csproj - به‌روزرسانی packages
+
⚠️ توجه: پوشه "MIddlewares" typo است
+
+ +

3️⃣ xAiApi

+
  • تغییر .gitignore، Program.cs، Startup.cs، xAiApi.csproj
  • +
  • اضافه xLoggingService، OpenTelemetry logging
+
+ +

4️⃣ xAiMcpServer

+
  • تغییر .gitignore، Program.cs، Startup.cs
  • +
  • یکسان با xAiApi
+
+ +

5️⃣ xApi

+
بدون تغییر - بررسی کنید
+
+ +

6️⃣ xIds

+
  • تغییر Program.cs، Startup.cs، xIds.csproj
  • +
  • اضافه xLoggingService و OpenTelemetry
+
+ +

📊 آمار

+ + + + + +
ماژولفایل‌هاافزودهحذف
xCommons35159
xLoggingService2909
xAiApi4275
xAiMcpServer3131
xIds43916
+
+ +

🎯 خطوات بعدی

+
  • v02: تصحیح typo MIddlewares
  • +
  • v02: هم‌ترازی xApi
  • +
  • v02: آزمایش Logging
+
+ +
+ +
+ + \ No newline at end of file diff --git a/Documents/Docs/ChangeLogs/CommitMessage-1405-08-17-v01.txt b/Documents/Docs/ChangeLogs/CommitMessage-1405-08-17-v01.txt new file mode 100644 index 0000000..b3f62fa --- /dev/null +++ b/Documents/Docs/ChangeLogs/CommitMessage-1405-08-17-v01.txt @@ -0,0 +1,136 @@ +================================================================================ + Commit Message - xSaherelmWorkspace + تاریخ: ۱۴۰۵/۰۸/۱۷ (2026-11-09) + نسخه مستند: v01 + گزارش کامل: Documents/Docs/ChangeLogs/1405-08-17-v01.html +================================================================================ + +هدف: بازسازی سیستم Logging، اضافه OpenTelemetry، انتقال middleware logging +از xCommons به xLoggingService، یکپارچگی در تمام API و خدمات. + +وضعیت: تغییرات کامیت نشده + +================================================================================ +[1] MODULES / xCommons - حذف Logging Responsibilities +================================================================================ + +1.1) حذف XRequestLogger Middleware +- حذف: Modules/xCommons/Middlewares/XRequestLogger.cs (144 خط) +- دلیل: منتقل شده به xLoggingService با بهبوری + +1.2) تغییر Extensions +- فایل: XMiddlewareExtensions.cs +- تغییر: حذف متد UseXRequestLogger() +- نتیجه: کلاس اکنون خالی است + +1.3) بهبود XLoggerModel +- اضافه: Exception property = null +- تنظیم: ترتیب Properties + +================================================================================ +[2] MODULES / xLoggingService - Enhancement +================================================================================ + +2.1) Middleware جدید +- فایل: MIddlewares/XRequestLoggingMiddleware.cs (NEW) +- ویژگی: Simple/Full logging modes +- قابلیت: HTTP request/response logging، exception handling + +⚠️ توجه: نام پوشه "MIddlewares" typo است - باید تصحیح شود + +2.2) توسعه DI +- متد: AddXTelemetryLogger() - logging configuration +- متد: AddXTelemetry() - host builder extension +- متد: UseXRequestLogger() - middleware registration + +2.3) به‌روزرسانی Dependencies +- OpenTelemetry.Extensions.Hosting v1.6.0 +- OpenTelemetry.Instrumentation.Http v1.6.0 +- OpenTelemetry.Instrumentation.AspNetCore v1.6.0 +- OpenTelemetry.Exporter.OpenTelemetryProtocol v1.6.0 +- Microsoft.Extensions.Logging.Console v5.0.0 + +================================================================================ +[3] xAiApi - Logging Integration +================================================================================ + +فایل‌های تغییر: +- .gitignore: +Logs +- Program.cs: +xLoggingService، +AddXTelemetryLogger، +AddXTelemetry +- Startup.cs: +UseXRequestLogger (non-development) +- xAiApi.csproj: +xLoggingService reference + +================================================================================ +[4] xAiMcpServer - Logging Integration +================================================================================ + +یکسان با xAiApi: +- .gitignore: +Logs +- Program.cs: Telemetry configuration +- Startup.cs: Request logging middleware + +================================================================================ +[5] xApi - No Changes +================================================================================ + +وضعیت: بدون تغییر - بررسی کنید + +================================================================================ +[6] xIds - Logging Integration & Refactoring +================================================================================ + +تغییرات: +- Program.cs: Arrow → معمولی، +Telemetry +- Startup.cs: isDevelopmentEnvironment var، +logging middleware +- xIds.csproj: +xLoggingService reference + +================================================================================ +VALIDATION +================================================================================ + +✓ git diff تمام modules بررسی شد +✓ فایل‌های جدید و حذف شده شناسایی شدند + +⚠️ باید انجام شود: +- build تمام projects +- unit/integration tests +- manual logging testing +- OpenTelemetry configuration + +================================================================================ +COMMIT TITLE (Conventional Commits) +================================================================================ + +feat: refactor logging with OpenTelemetry integration + +refactor: migrate XRequestLogger to xLoggingService +- Move Logging from xCommons to xLoggingService +- Add new XRequestLoggingMiddleware +- Integrate OpenTelemetry (v1.6.0) +- Apply logging across xAiApi, xAiMcpServer, xIds +- Update .gitignore for Logs folders + +Breaking Changes: +- UseXRequestLogger now in xLoggingService.DI +- OpenTelemetry packages updated + +================================================================================ +NEXT VERSIONS (v02, v03) +================================================================================ + +v02: +- تصحیح typo: MIddlewares → Middlewares +- هم‌ترازی xApi +- آزمایش جامع + +v03: +- Structured Logging (JSON) +- OpenTelemetry Exporters + +================================================================================ + +برای نسخه بعدی: +1405-08-17-v02.html +CommitMessage-1405-08-17-v02.txt + +=============================================================================== \ No newline at end of file diff --git a/Modules/xCommons b/Modules/xCommons index b9ba57d..0a8f969 160000 --- a/Modules/xCommons +++ b/Modules/xCommons @@ -1 +1 @@ -Subproject commit b9ba57dbfa86587aa83e7f213f2d92582b300eeb +Subproject commit 0a8f9692dd5580d8165d1ff360fb40c2a612e2ed diff --git a/Modules/xLoggingService b/Modules/xLoggingService index 0fe3748..def0807 160000 --- a/Modules/xLoggingService +++ b/Modules/xLoggingService @@ -1 +1 @@ -Subproject commit 0fe37483bc7da2aa1a6518b08c1630a0029dd2c1 +Subproject commit def0807fdd5704c534b92b279eb6b1a801834af5 diff --git a/xAiApi b/xAiApi index c24c14e..5656ec0 160000 --- a/xAiApi +++ b/xAiApi @@ -1 +1 @@ -Subproject commit c24c14eb74edd9eb9fa5992348e77a3c05041536 +Subproject commit 5656ec07d50eab8996a727a193b4a299388fcfb3 diff --git a/xAiMcpServer b/xAiMcpServer index 0bc45bd..98f6af7 160000 --- a/xAiMcpServer +++ b/xAiMcpServer @@ -1 +1 @@ -Subproject commit 0bc45bd8b9c83776be83a005a64ff227312c2c7b +Subproject commit 98f6af7ce5e813a81c0581eeb725f00582e91d46 diff --git a/xApi b/xApi index 18eb5d9..374c325 160000 --- a/xApi +++ b/xApi @@ -1 +1 @@ -Subproject commit 18eb5d92e1f50c7610aa475fce7039c6c0acad44 +Subproject commit 374c3258efb7e6550fe8b79967e6cdc29094ee51 diff --git a/xIds b/xIds index b311b1e..8d392b3 160000 --- a/xIds +++ b/xIds @@ -1 +1 @@ -Subproject commit b311b1e391c632da195109e52d208dea714da80e +Subproject commit 8d392b3d8439b202f774a013d0a13b673296f80a