Files
git.stella-ops.org/docs/observability/telemetry-bootstrap.md
master 10212d67c0
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
Refactor code structure for improved readability and maintainability; removed redundant code blocks and optimized function calls.
2025-11-20 07:50:52 +02:00

49 lines
1.6 KiB
Markdown

# Telemetry Core Bootstrap (v1 · 2025-11-19)
## Goal
Show minimal host wiring for `StellaOps.Telemetry.Core` with deterministic defaults and sealed-mode friendliness.
## Sample (web/worker host)
```csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddStellaOpsTelemetry(
builder.Configuration,
serviceName: "StellaOps.SampleService",
serviceVersion: builder.Configuration["VERSION"],
configureOptions: options =>
{
// Disable collector in sealed mode / air-gap
options.Collector.Enabled = builder.Configuration.GetValue<bool>("Telemetry:Collector:Enabled", true);
options.Collector.Endpoint = builder.Configuration["Telemetry:Collector:Endpoint"];
options.Collector.Protocol = TelemetryCollectorProtocol.Grpc;
},
configureMetrics: m => m.AddAspNetCoreInstrumentation(),
configureTracing: t => t.AddHttpClientInstrumentation());
```
## Configuration (appsettings.json)
```json
{
"Telemetry": {
"Collector": {
"Enabled": true,
"Endpoint": "https://otel-collector.example:4317",
"Protocol": "Grpc",
"Component": "sample-service",
"Intent": "telemetry-export",
"DisableOnViolation": true
}
}
}
```
## Determinism & safety
- UTC timestamps only; no random IDs introduced by the helper.
- Exporter is skipped when endpoint missing or egress policy denies.
- `VSTEST_DISABLE_APPDOMAIN=1` recommended for tests with `tools/linksets-ci.sh` pattern.
## Next
- Propagation adapters (50-002) will build on this bootstrap.
- Scrub/analyzer policies live under upcoming 51-001/51-002 tasks.