In modular monoliths and microservices, diagnosing latency spikes or intermittent failures without observability is frustrating:
- Relying on brittle grep commands across unstructured text files;
- Unable to pinpoint whether slow requests stem from SQL execution, Redis locks, or third-party gateways.
BitzOrcas.Modern includes native OpenTelemetry standards + automated audit pipelines: Inbound requests automatically generate a global TraceId propagated across service boundaries.
End-to-End Observability Topology
Step 1: Structured Logging in Business Handlers
Never concatenate strings in log calls. Use structured placeholders so TenantId, UserId, and TraceId attach automatically:
using Microsoft.Extensions.Logging;
public sealed class ProcessPaymentCommandHandler( ILogger<ProcessPaymentCommandHandler> logger){ public async ValueTask<Result> Handle(ProcessPaymentCommand command, CancellationToken ct) { // Structured logging with named parameters logger.LogInformation( "Processing payment transaction: Order {OrderId}, Amount {Amount} {Currency}", command.OrderId, command.Amount, command.Currency);
// Simulate payment processing await Task.Delay(10, ct);
logger.LogInformation("Payment transaction completed successfully for Order {OrderId}", command.OrderId); return Result.Success(); }}Step 2: Automated Audit Capture (ActivityAuditPipelineBehavior)
Mutating commands pass through ActivityAuditPipelineBehavior, recording audit metadata:
// Structured audit entity: captured automatically by ActivityAuditPipelineBehaviorpublic sealed class SysAuditRecord{ // Primary audit key and OpenTelemetry distributed TraceId public string Id { get; set; } = Guid.NewGuid().ToString("N"); public string TraceId { get; set; } = "4bf92f3577b34da6a3ce929d0e0e4736"; public string ActionName { get; set; } = "Ordering.CreateOrder"; public string OperatorId { get; set; } = "user-1001"; public string TenantId { get; set; } = "tenant-test"; public long DurationMs { get; set; } = 42; public string Status { get; set; } = "Success";}Summary
OpenTelemetry and structured auditing secure enterprise workloads:
- Instant Root Cause Analysis: Full span timing breakdowns per request;
- Tamper-Proof Audit Trails: Operator, timestamp, and result auditing;
- Cloud-Native Standards: Zero-code export to Prometheus, Grafana, and Jaeger.