49 lines
1.6 KiB
Markdown
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.
|