CommshopBase.Observability
1.1.2
dotnet add package CommshopBase.Observability --version 1.1.2
NuGet\Install-Package CommshopBase.Observability -Version 1.1.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommshopBase.Observability" Version="1.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommshopBase.Observability" Version="1.1.2" />
<PackageReference Include="CommshopBase.Observability" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommshopBase.Observability --version 1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CommshopBase.Observability, 1.1.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommshopBase.Observability@1.1.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommshopBase.Observability&version=1.1.2
#tool nuget:?package=CommshopBase.Observability&version=1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CommshopBase.Observability
Global structured request logging and error handling middleware for Commerce-based services. Splunk-ready JSON logs via Serilog.
Features
- CorrelationMiddleware: ensures
X-Correlation-IDon inbound and outbound HTTP - RequestLoggingMiddleware: structured request logs (method, path, status, elapsed, trace, correlation, user)
- ErrorHandlingMiddleware: returns RFC7807 ProblemDetails with
traceId,correlationId, andcode; structured error logs - Global error catalog with defaults and optional configuration overrides
- Serilog integration (opt-in) with compact JSON console and optional Splunk HEC sink
Quick Start
// Program.cs
builder.Services.AddCommshopObservability(builder.Configuration);
var app = builder.Build();
app.UseCommshopObservability();
Optionally enable Serilog pipeline (console JSON + Splunk HEC):
// Program.cs
builder.Host.UseCommshopSerilog();
Configuration
Serilog (console + Splunk HEC)
{
"Observability": {
"Serilog": {
"Enabled": true,
"MinimumLevel": "Information",
"Splunk": {
"Url": "https://splunk-hec:8088/services/collector",
"Token": "<hec-token>",
"Index": "main",
"BatchIntervalSeconds": 5,
"BatchSizeLimit": 50,
"QueueLimit": 10000
}
}
}
}
Error Catalog (message dictionary)
{
"ErrorCatalog": [
{ "Code": "ERR-VALIDATION", "Title": "Validation failed", "Type": "https://httpstatuses.com/400", "Detail": "One or more validation errors occurred." },
{ "Code": "ERR-NOT-FOUND", "Title": "Not Found", "Type": "https://httpstatuses.com/404", "Detail": "Resource was not found." }
]
}
CSP (dev/prod) in host apps
See repository README and docs/deploy.md for config keys.
Notes
- Ensure
builder.Services.AddCommshopObservability(...)is called before building the app. - Use
app.UseCommshopObservability()early in the pipeline. - Serilog is optional and enabled via
UseCommshopSerilog()+ config.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Serilog.AspNetCore (>= 8.0.1)
- Serilog.Sinks.Console (>= 5.0.1)
- Serilog.Sinks.Splunk (>= 3.7.0)
- System.Text.Json (>= 9.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Security patch (v1.1.2):
- Pin System.Text.Json to 9.0.10 to mitigate .NET DoS vulnerabilities (CVE-2024-30105, CVE-2024-43485)
- No public API changes; safe upgrade