Skip to content

Commit 5155140

Browse files
mermaid diagrams added
1 parent 5c30381 commit 5155140

File tree

6 files changed

+160
-40
lines changed

6 files changed

+160
-40
lines changed

CentralizedLoggingApi/Program.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using OpenTelemetry.Resources;
1111
using OpenTelemetry.Trace;
1212
using Serilog;
13+
using SharedLibrary;
1314
using SharedLibrary.Middlewares;
1415
using System.Reflection;
1516
using System.Text;
@@ -22,6 +23,7 @@
2223
.ReadFrom.Configuration(builder.Configuration)
2324
.Enrich.WithProperty("Application", "CentralizedLogging.Api")
2425
.Enrich.FromLogContext()
26+
.Enrich.With(new ActivityTraceEnricher()) // <-- custom enricher
2527
.CreateLogger();
2628

2729
builder.Host.UseSerilog();
@@ -126,15 +128,6 @@
126128

127129
app.MapGet("/health", () => Results.Ok("OK"));
128130

129-
app.Use(async (ctx, next) =>
130-
{
131-
using (Serilog.Context.LogContext.PushProperty("Environment", app.Environment.EnvironmentName))
132-
using (Serilog.Context.LogContext.PushProperty("Service", "CoreAPI"))
133-
using (Serilog.Context.LogContext.PushProperty("CorrelationId", ctx.TraceIdentifier))
134-
{
135-
await next();
136-
}
137-
});
138131

139132
// Middleware should be early in the pipeline
140133
app.UseMiddleware<RequestAudibilityMiddleware>();

README.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 🛰️ Centralized Observability Platform
22

3-
[![Build](https://github.com/hasanjaved-developer/CentralizedObservability/actions/workflows/dotnet-tests.yml/badge.svg?branch=master)](https://github.com/hasanjaved-developer/CentralizedObservability/actions/workflows/dotnet-tests.yml)
3+
[![Build](https://github.com/hasanjaved-developer/CentralizedObservability/actions/workflows/dotnet-tests.yml/badge.svg?branch=v1.0.2)](https://github.com/hasanjaved-developer/CentralizedLoggingMonitoring/actions/workflows/dotnet-tests.yml)
44
[![codecov](https://codecov.io/gh/hasanjaved-developer/CentralizedObservability/branch/master/graph/badge.svg)](https://codecov.io/gh/hasanjaved-developer/CentralizedObservability)
55
[![Docker Compose CI](https://github.com/hasanjaved-developer/CentralizedObservability/actions/workflows/docker-compose-ci.yml/badge.svg)](https://github.com/hasanjaved-developer/CentralizedObservability/actions/workflows/docker-compose-ci.yml)
66
[![License](https://img.shields.io/github/license/hasanjaved-developer/CentralizedObservability)](LICENSE.txt)
@@ -13,27 +13,30 @@
1313

1414
| Service | Pulls | Size | Version |
1515
|----------|-------|------|----------|
16-
| **API** | [![Pulls](https://img.shields.io/docker/pulls/hasanjaveddeveloper/centralized-observability-api)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-api) | [![Size](https://img.shields.io/docker/image-size/hasanjaveddeveloper/centralized-observability-api/latest)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-api/tags) | [![Version](https://img.shields.io/docker/v/hasanjaveddeveloper/centralized-observability-api?sort=semver)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-api/tags) |
17-
| **User API** | [![Pulls](https://img.shields.io/docker/pulls/hasanjaveddeveloper/centralized-observability-userapi)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-userapi) | [![Size](https://img.shields.io/docker/image-size/hasanjaveddeveloper/centralized-observability-userapi/latest)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-userapi/tags) | [![Version](https://img.shields.io/docker/v/hasanjaveddeveloper/centralized-observability-userapi?sort=semver)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-userapi/tags) |
18-
| **Web (Portal)** | [![Pulls](https://img.shields.io/docker/pulls/hasanjaveddeveloper/centralized-observability-web)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-web) | [![Size](https://img.shields.io/docker/image-size/hasanjaveddeveloper/centralized-observability-web/latest)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-web/tags) | [![Version](https://img.shields.io/docker/v/hasanjaveddeveloper/centralized-observability-web?sort=semver)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-web/tags) |
16+
| **API** | [![Pulls](https://img.shields.io/docker/pulls/hasanjaveddeveloper/centralized-observability-api)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-api) | [![Size](https://img.shields.io/docker/image-size/hasanjaveddeveloper/centralized-observability-api/v1.0.2)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-api/tags) | [![Version](https://img.shields.io/docker/v/hasanjaveddeveloper/centralized-observability-api?sort=semver)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-api/tags) |
17+
| **User API** | [![Pulls](https://img.shields.io/docker/pulls/hasanjaveddeveloper/centralized-observability-userapi)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-userapi) | [![Size](https://img.shields.io/docker/image-size/hasanjaveddeveloper/centralized-observability-userapi/v1.0.2)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-userapi/tags) | [![Version](https://img.shields.io/docker/v/hasanjaveddeveloper/centralized-observability-userapi?sort=semver)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-userapi/tags) |
18+
| **Web (Portal)** | [![Pulls](https://img.shields.io/docker/pulls/hasanjaveddeveloper/centralized-observability-web)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-web) | [![Size](https://img.shields.io/docker/image-size/hasanjaveddeveloper/centralized-observability-web/v1.0.2)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-web/tags) | [![Version](https://img.shields.io/docker/v/hasanjaveddeveloper/centralized-observability-web?sort=semver)](https://hub.docker.com/r/hasanjaveddeveloper/centralized-observability-web/tags) |
1919

20-
The Centralized Observability Platform is a proof-of-concept built with .NET 9, designed to demonstrate unified observability practices — combining structured logging (Serilog), distributed tracing (Jaeger via OpenTelemetry), and future support for metrics.
20+
The **Centralized Observability Platform** is a .NET 9 proof-of-concept that demonstrates **unified observability practices across services—**with **structured logging** (Serilog file sinks) and **distributed tracing** (OpenTelemetry → **Jaeger**). Metrics are planned for a subsequent phase.
2121

22-
The project extends the earlier Centralized Logging & Monitoring API to include full-fledged trace visualization and request correlation across microservices, enabling end-to-end visibility into system behavior and performance.
22+
Evolving from the earlier Centralized Logging & Monitoring work, this repo adds **full trace visualization** and **request correlation** across services, enabling end-to-end debugging through Jaeger while keeping logs locally for now.
2323

24-
CI/CD pipelines with GitHub Actions, multi-arch Docker images, and environment-ready compose stacks make this project a production-grade observability showcase for modern .NET solutions.
24+
**CI/CD:** GitHub Actions builds and publishes **amd64** Docker images using Buildx (QEMU pre-setup for future multi-arch). **Tag-based builds** are pushed to **GHCR** and optionally mirrored to **Docker Hub**. The repo provides **separate Docker Compose stacks** for each registry, enabling quick environment setup and validation.
2525

2626
---
2727

2828
## 🧭 Overview
2929

30-
The **Centralized Observability Platform** is a modern observability showcase built with **.NET 9**, combining structured logging, distributed tracing, and visualization into one cohesive stack.
30+
The **Centralized Observability Platform** is a modern observability showcase built with **.NET 9**, featuring structured logging, distributed tracing, and trace visualization integrated through Jaeger.
3131

3232
It extends the earlier **Centralized Logging & Monitoring API** project with:
33+
34+
- 🧠 **Centralized ActivityTraceEnricher** automatically enriches logs with TraceId and SpanId for distributed correlation
35+
- ⚙️ **Centralized Exception & Audibility Middleware** ensures consistent error handling and request/response logging across all APIs
3336
-**Serilog** for structured logging
3437
- 🟣 **Jaeger (via OpenTelemetry)** for distributed tracing
3538
- 🧩 **Docker Compose stack** for local observability setup
36-
- 🚀 **GitHub Actions CI/CD** for multi-arch image builds and releases
39+
- 🚀 **GitHub Actions CI/CD** for image builds and tests
3740
- 📊 **Codecov** integration for coverage insights
3841

3942
---
@@ -53,7 +56,17 @@ It extends the earlier **Centralized Logging & Monitoring API** project with:
5356
---
5457

5558
## 🧩 Architecture Snapshot
56-
*(To be added later — include a Mermaid diagram showing Serilog → OpenTelemetry → Jaeger → UI)*
59+
60+
![Integration Portal Architecture](docs/integration_portal_architecture.png)
61+
<sub>[View Mermaid source](docs/integration_portal_architecture.mmd)</sub>
62+
63+
---
64+
65+
### 📸 Screenshots
66+
67+
### 🔑 Login Page
68+
69+
![Login Page](docs/screenshots/jaeger.png)
5770

5871
---
5972

UserManagementApi/Program.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using OpenTelemetry.Resources;
66
using OpenTelemetry.Trace;
77
using Serilog;
8+
using SharedLibrary;
89
using SharedLibrary.Middlewares;
910
using System.Reflection;
1011
using System.Text;
@@ -19,6 +20,7 @@
1920
.ReadFrom.Configuration(builder.Configuration)
2021
.Enrich.WithProperty("Application", "UserManagement.Api")
2122
.Enrich.FromLogContext()
23+
.Enrich.With(new ActivityTraceEnricher()) // <-- custom enricher
2224
.CreateLogger();
2325

2426
builder.Host.UseSerilog();
@@ -123,16 +125,6 @@
123125

124126
app.MapGet("/health", () => Results.Ok("OK"));
125127

126-
app.Use(async (ctx, next) =>
127-
{
128-
using (Serilog.Context.LogContext.PushProperty("Environment", app.Environment.EnvironmentName))
129-
using (Serilog.Context.LogContext.PushProperty("Service", "CoreAPI"))
130-
using (Serilog.Context.LogContext.PushProperty("CorrelationId", ctx.TraceIdentifier))
131-
{
132-
await next();
133-
}
134-
});
135-
136128
// Middleware should be early in the pipeline
137129
app.UseMiddleware<RequestAudibilityMiddleware>();
138130
app.UseMiddleware<ExceptionHandlingMiddleware>();

docs/integration_portal_architecture.mmd

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
flowchart TB
2-
%% --- Clients ---
1+
flowchart TB
2+
%% --- Clients ---
33
Portal[💻 Integration Portal<br/>]:::client
4-
4+
5+
%% --- OpenTelemetry & Jaeger (Tracing) ---
6+
subgraph OBS[Observability Stack]
7+
direction TB
8+
OTEL[📡 OpenTelemetry SDK<br/>Export → OTLP]:::otel
9+
J_COLLECTOR[(📥 Jaeger Collector<br/>OTLP gRPC :4317)]:::infra
10+
J_UI[🧭 Jaeger UI<br/>:16686]:::ui
11+
OTEL --> J_COLLECTOR --> J_UI
12+
end
513

614
%% --- SDKs ---
715
UM_SDK[📦 UserManagement.SDK]:::sdk
@@ -19,6 +27,12 @@ flowchart TB
1927
UDB[(🗄️ User DB)]:::db
2028
LDB[(🗄️ Logging DB)]:::db
2129

30+
%% --- Shared Observability Library ---
31+
SHARED[🧰 Shared.Observability<br/>Middlewares<br/>ActivityTraceEnricher]:::lib
32+
33+
34+
35+
2236
%% --- Flows ---
2337
%% Clients use SDKs
2438
Portal --> UM_SDK --> UM_API
@@ -36,18 +50,24 @@ flowchart TB
3650
UM_API --> UDB
3751
LOG_API --> LDB
3852

39-
%% --- Legend ---
40-
subgraph Legend
41-
L1[💻 Client]:::client
42-
L2[📦 SDK]:::sdk
43-
L3[🔑 API]:::api
44-
L4[📄 Contract]:::contract
45-
L5[(🗄️ DB)]:::db
46-
end
53+
%% APIs use Shared Library (middlewares + enricher)
54+
UM_API -. uses .-> SHARED
55+
LOG_API -. uses .-> SHARED
56+
Portal -. uses .-> SHARED
57+
58+
%% APIs emit traces via OTel to Jaeger
59+
UM_API -. uses .-> OTEL
60+
LOG_API -. uses .-> OTEL
61+
Portal -. uses .-> OTEL
4762

4863
%% --- Styles ---
4964
classDef client fill:#f0f8ff,stroke:#007acc,stroke-width:2px,color:#000,font-weight:bold;
5065
classDef sdk fill:#fff5e6,stroke:#ff9900,stroke-width:2px,color:#000;
5166
classDef api fill:#e6ffe6,stroke:#339933,stroke-width:2px,color:#000;
5267
classDef contract fill:#f9f9f9,stroke:#555555,stroke-dasharray: 3 3,color:#000;
5368
classDef db fill:#fff0f5,stroke:#cc0066,stroke-width:2px,color:#000;
69+
70+
classDef lib fill:#eef7ff,stroke:#2b6cb0,stroke-width:2px,color:#000;
71+
classDef otel fill:#fffbea,stroke:#b7791f,stroke-width:2px,color:#000;
72+
classDef infra fill:#f5f5ff,stroke:#6b46c1,stroke-width:2px,color:#000;
73+
classDef ui fill:#f0fff4,stroke:#2f855a,stroke-width:2px,color:#000;
-26.8 KB
Loading

docs/integration_portal_architecture.svg

Lines changed: 102 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)