@cratis/pi 7.172.3 → 7.174.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -424,7 +424,8 @@
424
424
  "cratis-engineering-csharp-conventions",
425
425
  "cratis-fundamentals-concept",
426
426
  "cratis-fundamentals-telemetry",
427
- "cratis-fundamentals-type-discovery"
427
+ "cratis-fundamentals-type-discovery",
428
+ "cratis-observability"
428
429
  ],
429
430
  "rules": [
430
431
  "concepts.md"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cratis-chronicle-hosting
3
- description: Use when deploying the Chronicle kernel, preparing production topology or diagnosing kernel startup, certificates and clustering. Not for application client wiring, Orleans grain implementation or live-store mutation.
3
+ description: Use when deploying the Chronicle kernel, running a production readiness or go-live checklist, preparing topology, backup and restore, upgrades, or diagnosing startup, certificates and clustering. Not for application client wiring, Orleans grain implementation or live-store mutation.
4
4
  license: MIT
5
5
  ---
6
6
 
@@ -157,6 +157,8 @@ Ordinary observer quarantine guidance does not imply webhooks stay silent.
157
157
 
158
158
  ## Verify
159
159
 
160
+ Read [production checklist](references/production-checklist.md) when preparing, reviewing or auditing a Chronicle go-live, backup and restore drill or upgrade.
161
+
160
162
  - The build/image and intended environment agree; no default development
161
163
  application remains in reused production storage.
162
164
  - Storage is reachable and MongoDB is a replica set; multiple nodes share valid
@@ -0,0 +1,99 @@
1
+ <!-- Copyright (c) Cratis. All rights reserved. -->
2
+ <!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
3
+
4
+ # Chronicle production go-live checklist
5
+
6
+ Source: `Cratis/Chronicle`: `Documentation/hosting/production.md`,
7
+ `Documentation/hosting/rolling-deploy.md`, `Documentation/hosting/encryption-certificate.md`,
8
+ `Documentation/hosting/configuration/{clustering,compliance-storage}.md`,
9
+ `Source/Clients/DotNET/{ChronicleOptions,Tls}.cs`.
10
+
11
+ Work through the items in order. Each links to the section that owns the detail; this file
12
+ adds only the sequence and the facts those sections do not carry. Mark an item done only
13
+ after observing it, and list what was not observed.
14
+
15
+ ## 1. Image and build
16
+
17
+ - [ ] Deploy the production `cratis/chronicle` image, pinned to a tested tag. It has
18
+ no bundled database, generates no certificates and creates no default administrator password.
19
+ - [ ] Do not rely on `ASPNETCORE_ENVIRONMENT`: the `DEVELOPMENT` symbol is compile-time. See
20
+ [Choose the build and storage](../SKILL.md#choose-the-build-and-storage).
21
+
22
+ ## 2. Storage
23
+
24
+ - [ ] `Cratis__Chronicle__Storage__ConnectionDetails` is set (it is empty by default), with
25
+ `Cratis__Chronicle__Storage__Type` for a backend other than MongoDB.
26
+ - [ ] MongoDB is a replica set, even for one node; a standalone `mongod` cannot serve
27
+ transactions or change streams. Erasure confirmation also needs linearizable reads and
28
+ majority writes, so on a standalone server erasures stay pending with a warning.
29
+
30
+ ## 3. Certificates and secrets
31
+
32
+ - [ ] TLS PFX and encryption certificate paths and passwords come from the secret store, and every
33
+ node has the same ring. A missing encryption certificate file fails startup with
34
+ `EncryptionCertificateFileNotFound`. See
35
+ [Supply certificates](../SKILL.md#supply-certificates-before-starting-production).
36
+ - [ ] Dumps are secrets: a crash dump holds connection strings, keys and event data, including
37
+ personal data. Keep dumps off by default; if enabled, use a restricted volume and delete every
38
+ copy after analysis.
39
+
40
+ ## 4. Authentication
41
+
42
+ - [ ] Complete administrator setup before exposing the service: the production image creates the
43
+ administrator without a password, and setup needs the token from the server logs or
44
+ `Authentication:InitialAdminSetupToken`. Protect that token and remove it from configuration
45
+ afterwards.
46
+ - [ ] No development application survives in reused storage (see **Supply certificates** above).
47
+
48
+ ## 5. Read model sinks
49
+
50
+ - [ ] The client option `DefaultSinkTypeId` defaults to MongoDB and applies to every materialized
51
+ read model; a named sink on the kernel decides where its read models land regardless. Set the
52
+ option or a named sink deliberately, then check where one read model actually lands. See
53
+ [named sinks](sinks.md).
54
+
55
+ ## 6. Clustering
56
+
57
+ - [ ] One node: the default `Localhost` is fine and a lease guards the storage.
58
+ - [ ] Several nodes: `clustering.type=MongoDB` with MongoDB storage, or `Sql` with PostgreSQL or
59
+ SQL Server, on every node, with shared cluster id, service id and certificate ring. See
60
+ [clustering and schema ownership](clustering-and-schema.md).
61
+
62
+ ## 7. Clients
63
+
64
+ - [ ] Set `skipTlsValidation=false` explicitly; the client default skips validation. Use
65
+ `caCertificatePath` for a private CA or `certificatePath` to pin; a pin does not override a host
66
+ name mismatch. See **cratis-chronicle-configuration** and **cratis-chronicle-client-dotnet**.
67
+
68
+ ## 8. Network and probes
69
+
70
+ - [ ] Keep the main port behind the intended proxy and the health port internal with
71
+ `health.exclusive=true`. Use orchestrator probes: `/health/live` for liveness and
72
+ `/health/ready` for readiness. See [Probe without opening another API entrance](../SKILL.md#probe-without-opening-another-api-entrance).
73
+
74
+ ## 9. Backup and restore drill
75
+
76
+ - [ ] The backup set is the certificate ring (all certificates and passwords, ring shape at backup
77
+ time), the storage, and the compliance key store, all from the same point in time.
78
+ - [ ] Restore in order: ring, storage, key store. Start **one** node and read
79
+ `GET /diagnostics/encryption-certificates`; keys with the role `Retired` mean a certificate is
80
+ missing. Keep traffic blocked, restore it under `previous`, restart that node and check again;
81
+ a running node does not reload its ring. Then start the others.
82
+ - [ ] Keep a retired certificate as long as the oldest backup you would restore. Overwriting a
83
+ certificate file is not a rotation.
84
+ - [ ] A key store older than the storage releases type-appropriate empty values for newer subjects,
85
+ which looks like erasure, and may resurrect erased subjects. A newer one keeps the intervening
86
+ erasures. Verify with **cratis-chronicle-compliance**.
87
+
88
+ ## 10. Upgrade
89
+
90
+ - [ ] Back up first; migrations have no rollback.
91
+ - [ ] Check the source release against the compatibility table in `rolling-deploy.md`. Rolling
92
+ replacement is supported only from listed source releases; otherwise, and for any new major,
93
+ stop every node first. Key-store naming changes for Vault or Azure Key Vault also need stop-all.
94
+ - [ ] Probe readiness per node. See [Upgrade and restore](operations.md#upgrade-and-restore) and
95
+ **cratis-chronicle-event-type-migration**.
96
+
97
+ ## 11. Report
98
+
99
+ - [ ] Name every item not run. A configuration review is not a deployment.
@@ -13,6 +13,10 @@
13
13
  { "kind": "skill-contains", "file": "references/sinks.md", "value": "\"reporting\": { \"type\": \"SQL\", \"connectionDetails\": \"Host=pg;Database=reporting;Username=chronicle\" }" },
14
14
  { "kind": "skill-contains", "file": "references/sinks.md", "value": "\"primary\": { \"type\": \"MongoDB\", \"connectionDetails\": \"<mongodb-connection-string>\" }" },
15
15
  { "kind": "skill-contains", "file": "references/sinks.md", "value": "Cratis__Chronicle__Sinks__Configurations__reporting__Type=SQL" },
16
- { "kind": "skill-contains", "value": "[named sinks](references/sinks.md) before adding or changing the section." }
16
+ { "kind": "skill-contains", "value": "[named sinks](references/sinks.md) before adding or changing the section." },
17
+ { "kind": "skill-contains", "file": "references/production-checklist.md", "value": "Authentication:InitialAdminSetupToken" },
18
+ { "kind": "skill-contains", "file": "references/production-checklist.md", "value": "DefaultSinkTypeId" },
19
+ { "kind": "skill-contains", "file": "references/production-checklist.md", "value": "skipTlsValidation=false" },
20
+ { "kind": "skill-contains", "value": "[production checklist](references/production-checklist.md) when preparing" }
17
21
  ]
18
22
  }
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: cratis-observability
3
+ description: Use when setting up, verifying or troubleshooting OpenTelemetry in an application built on Cratis (Arc, Chronicle client, kernel), such as missing spans, export, sampling or sensitive span data. Not for generated instruments (cratis-fundamentals-telemetry).
4
+ license: MIT
5
+ ---
6
+
7
+ <!-- Copyright (c) Cratis. All rights reserved. -->
8
+ <!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
9
+
10
+ # Observability across the Cratis stack
11
+
12
+ Wire telemetry once, prove spans and metrics reach a backend, and keep sensitive values out of them. The binding naming and "never record" contract is the Cratis OpenTelemetry convention; read `.cratis/ai/rules/observability.md` for it and do not restate it in code comments.
13
+
14
+ Sibling skills own adjacent ground:
15
+
16
+ - **cratis-fundamentals-telemetry** declares generated metrics and spans (`[Counter]`, `[Span]`) and subscribes application meters. Use it for custom instruments.
17
+ - **cratis-chronicle-configuration** owns kernel storage, TLS and other kernel environment settings.
18
+ - **cratis-chronicle-client-elixir** (`references/observability.md`) owns Elixir client tracing.
19
+
20
+ ## Setup (.NET)
21
+
22
+ The single entry point is `AddCratisOpenTelemetry` from the `Cratis.OpenTelemetry` package (Fundamentals; a separate package from `Cratis.Fundamentals`). Do not hand-roll `AddSource` lists for Cratis scopes.
23
+
24
+ ```csharp
25
+ using Cratis.OpenTelemetry;
26
+
27
+ builder.AddCratisOpenTelemetry(options => options.ServiceName = "orders-api");
28
+ ```
29
+
30
+ `builder` is the host's `IHostApplicationBuilder` (a `WebApplicationBuilder` or a worker host builder). Call it once, before building the host.
31
+
32
+ It registers the `Cratis.*` activity sources and meters (so Arc, the Chronicle client and kernel scopes are all covered), ASP.NET Core, HttpClient and runtime instrumentation, scoped and formatted logs, and its own OTLP exporter per signal. It brings its own exporter: **do not also call `UseOtlpExporter()` or `AddOtlpExporter()`**, or the host exports twice.
33
+
34
+ Alternatives, chosen only by condition:
35
+
36
+ | Condition | Use |
37
+ | --- | --- |
38
+ | The host already calls `AddOpenTelemetry()` | `services.AddOpenTelemetry().WithCratis(configuration)` (do not also call `AddCratisOpenTelemetry`) |
39
+ | The application owns the whole provider pipeline | `AddCratisInstrumentation()` on `TracerProviderBuilder` and `MeterProviderBuilder`: it only subscribes `Cratis.*` |
40
+ | Extra sources such as gRPC client, MongoDB or Orleans | `ConfigureTracing` / `ConfigureMetrics` on the options |
41
+
42
+ Read `references/dotnet-setup-and-options.md` when you need the option table, environment keys, resource identity, metric views or cardinality limits.
43
+
44
+ ### Configure through `OTEL_*` only
45
+
46
+ - Export is opt-in: with no OTLP endpoint configured there is no OTLP exporter. Set `OTEL_EXPORTER_OTLP_ENDPOINT` (or a per-signal endpoint) in the deployment environment.
47
+ - `OTEL_SERVICE_NAME` wins. `options.ServiceName` is only the fallback when it is unset; never hard-code the service name.
48
+ - Sampling: set `OTEL_TRACES_SAMPLER` (for example `parentbased_traceidratio`) with `OTEL_TRACES_SAMPLER_ARG`, and justify a changed rate with a measured span rate. A parent-based sampler inherits the upstream decision, so an unsampled caller hides downstream spans.
49
+ - `OTEL_SDK_DISABLED=true` turns the providers off.
50
+ - Exporter headers are secrets: take them from the deployment's secret store, never from code or committed configuration.
51
+
52
+ ## What you get
53
+
54
+ | Scope (source and meter) | Emits |
55
+ | --- | --- |
56
+ | `Cratis.Arc` | Command and query spans and metrics (`cratis.arc.command.execute`, `cratis.arc.query.perform`, `cratis.arc.command.duration`) |
57
+ | `Cratis.Arc.MongoDB` | MongoDB meter |
58
+ | `Cratis.Chronicle.Client` | Client spans for append, unit of work, reactor and reducer handling |
59
+ | `Cratis.Chronicle` | Kernel spans and meters (kernel also uses `Cratis.Chronicle.Federation`) |
60
+
61
+ Read `references/arc-and-chronicle-signals.md` when you need span, attribute and metric names or the legacy versus convention naming switches.
62
+
63
+ Chronicle emits **legacy** names by default (client spans `client.event_sequence.append`, kernel metric names unchanged). `Telemetry:SpanNames=Convention` (client) and `Telemetry:MetricNames=Convention` or `Both` (kernel) opt into the `cratis.chronicle.*` names. Dashboards and alerts must use whichever mode is active; never sum a legacy and a convention series.
64
+
65
+ ## Trace boundaries
66
+
67
+ - A command reaching the Chronicle client and its append calls are one trace; the client propagates trace context over gRPC.
68
+ - Observer, reactor and reducer processing is **not** guaranteed to sit under the command's trace. Do not expect observer spans inside the trace of the command that caused them.
69
+ - Correlation is partial. Arc spans and the unit-of-work commit and rollback client spans carry the correlation id (`cratis.correlation_id`; the commit span uses `correlation_id` in Legacy mode). Append, reactor and reducer spans carry none in either mode, and observer spans cannot be joined to the command by id: find them by observer id, store, namespace and sequence. The only baggage key is `cratis.correlation_id`. Exact attributes per mode are in `references/arc-and-chronicle-signals.md`.
70
+
71
+ ## Never record
72
+
73
+ The rule lists the contract. The practical traps:
74
+
75
+ - Event source ids: the .NET client's `EventSourceIdTracing` defaults to `Raw`, so ids reach the backend unchanged. Choose `Hashed` (needs `Telemetry:EventSourceIdHashKey` of at least 32 characters from a secret store) or `Omitted` unless the id is known to be non-personal. The kernel defaults to `Hashed` with a per-process random key when none is set, so kernel hashes correlate only within one process. Set client and kernel separately, with the same key to correlate. These options do not redact logs.
76
+ - Failed append and handle spans carry `error.type`, not exception messages. Do the same in your own spans; `IncludeExceptionDetails` is off by default, keep it off in production.
77
+ - No command, event, query or read model payloads, tokens or identity values in span attributes, metric tags, baggage or resource attributes. Tenant is never a resource attribute or baggage.
78
+ - Metric tags are bounded categories, never ids.
79
+
80
+ ## Verify
81
+
82
+ Run the app against a local viewer; do not claim telemetry works from a clean build.
83
+
84
+ 1. Start the Aspire dashboard container (image `mcr.microsoft.com/dotnet/aspire-dashboard`, UI on 18888, OTLP/gRPC published as 4317). Anonymous access is local-only. See `references/chronicle-kernel-export.md` (Local viewer).
85
+ 2. Start the app with `OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317` and open `http://localhost:18888`.
86
+ 3. Issue one command that appends an event. Pass when the **Traces** view shows your service name, a `cratis.arc.command.execute` span and a client append span (`client.event_sequence.append`, or `cratis.chronicle.client.event_sequence.append` in convention mode) in one trace.
87
+ 4. Pass when a reactor span (`client.reactor.handle`; a reducer emits `client.reducer.handle`) appears as its own trace, not nested under the command.
88
+ 5. Pass when the same run with `OTEL_EXPORTER_OTLP_ENDPOINT` unset exports nothing and nothing fails.
89
+ 6. Stop the dashboard container when done.
90
+
91
+ ## Other platforms
92
+
93
+ - Elixir: read `cratis-chronicle-client-elixir` `references/observability.md`.
94
+ - TypeScript, JVM, Python and Go: the convention defines a shared setup entry point for each, but none is verified in this corpus. Treat them as planned; do not invent an API. Use the standard `OTEL_*` variables and the naming rule meanwhile.
95
+
96
+ ## Pitfalls
97
+
98
+ - A source missing from the tracer provider drops its spans silently with no warning.
99
+ - Calling both `AddCratisOpenTelemetry` and `UseOtlpExporter()` duplicates every signal.
100
+ - A hard-coded service name hides a wrong deployment identity; supply it through `OTEL_SERVICE_NAME`, with `options.ServiceName` only as the fallback.
101
+ - Unbounded metric tags create series until the SDK folds the rest into one `otel.metric.overflow=true` series. Arc separately caps 1,000 distinct command or query names and records the rest as `_other`. These are different limits.
102
+ - Rejections (validation, authorization) do not fail a command span; read the outcome attribute.
103
+ - The Chronicle kernel's own setup (`AddChronicleTelemetry`) exports only when an endpoint is set and always reports `service.name` as `Chronicle` (`OTEL_SERVICE_NAME` does not change it); the kernel is configured separately from the application.
104
+
105
+ ## References
106
+
107
+ - Read `references/dotnet-setup-and-options.md` when configuring options, environment keys, resource identity, sampling or cardinality.
108
+ - Read `references/arc-and-chronicle-signals.md` when you need exact span, attribute and metric names for Arc or Chronicle.
109
+ - Read `references/chronicle-kernel-export.md` when exporting the kernel's telemetry, tuning its options or alerting on observer failures.
110
+ - Read `references/troubleshooting.md` when spans are missing, duplicated or orphaned, or sensitive values appear.
@@ -0,0 +1,68 @@
1
+ <!-- Copyright (c) Cratis. All rights reserved. -->
2
+ <!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
3
+
4
+ # Arc and Chronicle signals
5
+
6
+ Sources: Arc `Source/DotNET/Arc.Core/WellKnownDiagnostics.cs`, `WellKnownTelemetryNames.cs`, `Source/DotNET/MongoDB/WellKnownMongoDBDiagnostics.cs`, `Documentation/backend/csharp/observability.md`; Chronicle `Source/Clients/DotNET/Diagnostics/OpenTelemetry/Tracing/ClientActivity.cs`, `ChronicleTelemetryOptions.cs`, `Documentation/hosting/client-tracing.mdx`, `Documentation/hosting/configuration/telemetry-names.md`. Read the release you consume.
7
+
8
+ ## Arc
9
+
10
+ Activity source and meter: `Cratis.Arc`. MongoDB meter: `Cratis.Arc.MongoDB`.
11
+
12
+ | Span | Meaning |
13
+ | --- | --- |
14
+ | `cratis.arc.command.execute` | Whole command execution |
15
+ | `cratis.arc.command.validate`, `.filter`, `.authorize`, `.provide`, `.handle` | Pipeline stages |
16
+ | `cratis.arc.validator.invoke` | One validator |
17
+ | `cratis.arc.query.perform`, `cratis.arc.query.push` | Query execution and observable push |
18
+ | `cratis.arc.command.action`, `cratis.arc.query.action` | Controller-based actions (server spans) |
19
+
20
+ | Attribute | Meaning |
21
+ | --- | --- |
22
+ | `cratis.arc.command.type`, `cratis.arc.command.outcome`, `cratis.arc.command.key.type` | Command identity and result |
23
+ | `cratis.arc.query.name`, `cratis.arc.query.transport`, `cratis.arc.query.outcome` | Query identity, transport and result |
24
+ | `cratis.correlation_id` | Business correlation id |
25
+ | `cratis.tenant.id` | Tenant (also legacy `cratis.tenant`); span attribute only, never resource or baggage |
26
+ | `http.route` | Route template, never a concrete URL |
27
+
28
+ | Metric | Kind |
29
+ | --- | --- |
30
+ | `cratis.arc.command.duration` | Histogram, seconds |
31
+ | `cratis.arc.command.outcomes` | Counter |
32
+ | `cratis.arc.query.duration` | Histogram, seconds |
33
+ | `cratis.arc.query.subscriptions` | Up-down counter of open subscriptions |
34
+ | `cratis.arc.query.pushes` | Counter |
35
+
36
+ Arc records at most 1,000 distinct command types or query names per metric and folds the rest into `_other`. A command rejected by validation or authorization does not fail the span; the outcome attribute carries the rejection.
37
+
38
+ ## Chronicle .NET client
39
+
40
+ Activity source: `Cratis.Chronicle.Client` (`ClientActivity.SourceName`). Registration: `AddCratisOpenTelemetry` covers it through `Cratis.*`. Without it, `AddCratisChronicleInstrumentation()` (package `Cratis.Chronicle.AspNetCore`, namespace `Cratis.Chronicle.AspNetCore.OpenTelemetry`) or `AddSource("Cratis.Chronicle.Client")` is required, in the same tracing configuration as the exporter.
41
+
42
+ | Legacy span (default) | Convention span (`Telemetry:SpanNames=Convention`) |
43
+ | --- | --- |
44
+ | `client.event_sequence.append` | `cratis.chronicle.client.event_sequence.append` |
45
+ | `client.event_sequence.append_many` | `cratis.chronicle.client.event_sequence.append_many` |
46
+ | `client.unit_of_work.commit`, `client.unit_of_work.rollback` | `cratis.chronicle.client.unit_of_work.commit`, `...rollback` |
47
+ | `client.reactor.handle` | `cratis.chronicle.client.reactor.handle` |
48
+ | `client.reducer.handle` | `cratis.chronicle.client.reducer.handle` |
49
+
50
+ The option form is `ChronicleTelemetryOptions.SpanNames = ClientSpanNames.Convention`. Failed append and handle operations set Error status and `error.type` without messages. Append spans carry `cratis.chronicle.append.outcome`: `success`, `error`, `concurrency_violation` or `constraint_violation`.
51
+
52
+ Attributes per span and mode (legacy keys are always set; the shared keys are added only in Convention mode):
53
+
54
+ | Span | Legacy keys (both modes) | Added in Convention mode |
55
+ | --- | --- | --- |
56
+ | append | `event_store_name`, `namespace_name`, `event_sequence_id`, `event_source_type`, `event_source_id` (when traced) | `cratis.event_store.name`, `cratis.event_store.namespace`, `cratis.event_sequence.id`, `cratis.event_source.type`, `cratis.event_source.id` (when traced) |
57
+ | append_many | `event_store_name`, `namespace_name`, `event_sequence_id` | the three matching shared keys |
58
+ | reactor handle | `event_store_name`, `namespace_name`, `event_sequence_id`, `reactor_id` | shared store, namespace and sequence keys, `cratis.observer.id`, `cratis.observer.type=reactor` |
59
+ | reducer handle | same with `reducer_id` | same with `cratis.observer.type=reducer` |
60
+ | unit of work commit and rollback | `correlation_id` | `cratis.correlation_id` |
61
+
62
+ So in Legacy mode (the default) no client span carries a shared key, and in either mode only the unit-of-work commit and rollback spans carry a correlation id; append, reactor and reducer spans never do. Correlate as follows: Arc command spans carry `cratis.correlation_id` and the client append sits in the same trace, so join them by trace id; the commit or rollback span carries the id under `correlation_id` (Legacy) or `cratis.correlation_id` (Convention); observer spans carry no correlation id, so identify them by observer id and store, namespace and sequence, not by correlation.
63
+
64
+ Kernel spans call the event source id `cratis.eventsource.id`; client spans use `event_source_id`. Both follow their own exposure setting.
65
+
66
+ ## Naming modes
67
+
68
+ Legacy names stay the default. Legacy keys are deprecated for removal in the next major version, so build new dashboards on convention names where the mode is available, and use `Both` only as a temporary migration mode.
@@ -0,0 +1,35 @@
1
+ <!-- Copyright (c) Cratis. All rights reserved. -->
2
+ <!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
3
+
4
+ # Chronicle kernel export
5
+
6
+ Sources: Chronicle `Source/Kernel/Core/Diagnostics/OpenTelemetry/OpenTelemetryConfigurationExtensions.cs`, `Source/Kernel/Core/Configuration/Telemetry.cs`, `Documentation/hosting/configuration/open-telemetry.md`. The kernel is configured separately from the application: application telemetry setup does not export kernel signals. Read the release you run.
7
+
8
+ ## Export
9
+
10
+ The kernel's own setup (`AddChronicleTelemetry`) adds an OTLP exporter per signal only when `OTEL_EXPORTER_OTLP_ENDPOINT` or the per-signal endpoint is set. The kernel host calls it without a service name, so the resource `service.name` is always `Chronicle`: the setup applies it after the SDK defaults, so `OTEL_SERVICE_NAME` does not change it (the product docs list that variable; the source does not honour it). Tell kernel telemetry apart from the application's by that name, and confirm in your backend. The kernel subscribes the activity source `Cratis.Chronicle`, the meters `Cratis.Chronicle` and `Cratis.Chronicle.Federation`, and the `Microsoft.Orleans` and `Grpc.AspNetCore.Server` meters.
11
+
12
+ ## Options under `Telemetry`
13
+
14
+ Set through configuration or the environment form `Cratis__Chronicle__Telemetry__<Option>` (see **cratis-chronicle-configuration** `references/environment-variables.md` for the prefix rule).
15
+
16
+ | Option | Default | Effect |
17
+ | --- | --- | --- |
18
+ | `MetricNames` | `Legacy` | `Convention` publishes `cratis.chronicle.*` names; `Both` publishes both sets temporarily and raises volume |
19
+ | `OrleansTracing` | `false` | Orleans runtime and grain-call spans; very high volume |
20
+ | `GrpcClientTracing` | `false` | Outbound gRPC client spans; opt in only when needed |
21
+ | `MetricSeriesLimit` | `500` | Series per instrument before folding to `otel.metric.overflow=true` |
22
+ | `EventSourceIdTracing` | `Hashed` | `Raw`, `Hashed` or `Omitted` for `cratis.eventsource.id` |
23
+ | `EventSourceIdHashKey` | generated per process | At least 32 characters when `Hashed` is chosen explicitly; share with clients to correlate |
24
+
25
+ ## Observer failure metrics
26
+
27
+ Counters on the `Cratis.Chronicle` meter (legacy names): `chronicle-observer-partitions-failed`, `chronicle-observer-partition-retry-attempts`, `chronicle-observer-partitions-quarantined`, `chronicle-observer-quarantined`. Each carries only `EventStore`, `Namespace`, `ObserverId` and `EventSequenceId`, never a partition or event source id. A healthy observer has no series until its first failure, so alert on increase and never depend on seeing a `0` first. Prometheus names depend on backend translation: check the exposed name before writing a query. The product's alerting guide (`Documentation/hosting/alerting-on-observer-failures.md`) has rules.
28
+
29
+ ## Local viewer
30
+
31
+ The Aspire dashboard image `mcr.microsoft.com/dotnet/aspire-dashboard` serves its UI on 18888 and receives OTLP/gRPC on container port 18889, published as 4317. Run it as a service in a local compose file (Chronicle's `Source/Kernel/Server/docker-compose.yml` has one) or with the container runtime, mapping host 18888 to 18888 and host 4317 to container 18889, and pin the image tag you trust. Its anonymous-access setting is for local machines only; never publish its ports.
32
+
33
+ ```shell
34
+ OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 dotnet run
35
+ ```
@@ -0,0 +1,68 @@
1
+ <!-- Copyright (c) Cratis. All rights reserved. -->
2
+ <!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
3
+
4
+ # .NET setup and options
5
+
6
+ Source: Fundamentals `Source/DotNET/OpenTelemetry/` (`OpenTelemetryExtensions.cs`, `InstrumentationExtensions.cs`, `CratisOpenTelemetryOptions.cs`), package `Cratis.OpenTelemetry`, namespace `Cratis.OpenTelemetry`. Read the release you consume.
7
+
8
+ ## Entry points
9
+
10
+ | Call | Extends | Notes |
11
+ | --- | --- | --- |
12
+ | `AddCratisOpenTelemetry(configure?)` | `IHostApplicationBuilder` | Default choice. Reads configuration from the builder |
13
+ | `WithCratis(configure?)` and `WithCratis(configuration, configure?)` | `OpenTelemetryBuilder` | When the host already calls `AddOpenTelemetry()` |
14
+ | `AddCratisInstrumentation()` | `TracerProviderBuilder`, `MeterProviderBuilder` | Only `AddSource("Cratis.*")` / `AddMeter("Cratis.*")`; no exporter, no resource |
15
+
16
+ Use one of them, never two. The application callbacks run before the service provider is built.
17
+
18
+ ## Options (`CratisOpenTelemetryOptions`)
19
+
20
+ | Option | Default | Purpose |
21
+ | --- | --- | --- |
22
+ | `ServiceName` | lowercase entry assembly name | Fallback only; `OTEL_SERVICE_NAME` wins |
23
+ | `ServiceVersion` | entry assembly informational version | Resource version |
24
+ | `IncludeExceptionDetails` | `false` | When false, exception log messages are reduced to `exception.type` |
25
+ | `ConfigureTracing` | none | Extra sources, for example gRPC client, MongoDB, Orleans |
26
+ | `ConfigureMetrics` | none | Extra meters |
27
+ | `EnableMetricViews` | `false` | Opt in to Cratis-owned metric views; the next three options require it (do not register other views for the same instruments) |
28
+ | `MetricCardinalityLimit` | `2000` | Series cap per stream; requires `EnableMetricViews` |
29
+ | `SecondsHistogramBoundaries` | 0, 0.005 ... 10 seconds | Bucket boundaries for duration histograms |
30
+ | `MetricPolicies` | empty | Per-metric overrides |
31
+
32
+ Extra sources example (application-owned scopes outside `Cratis.*` need an explicit subscription; see **cratis-fundamentals-telemetry**):
33
+
34
+ ```csharp
35
+ builder.AddCratisOpenTelemetry(options =>
36
+ options.ConfigureTracing = tracing => tracing.AddSource("MyApplication.Reports.ReportWorker"));
37
+ ```
38
+
39
+ ## What is registered
40
+
41
+ - Logs with `IncludeScopes` and `IncludeFormattedMessage`.
42
+ - `Cratis.*` sources and meters.
43
+ - ASP.NET Core (health-check requests are filtered out), HttpClient and runtime instrumentation.
44
+ - Resource defaults and its own OTLP exporter per signal, only when an endpoint is configured.
45
+
46
+ ## Environment keys
47
+
48
+ Environment values win over configuration keys.
49
+
50
+ | Key | Effect |
51
+ | --- | --- |
52
+ | `OTEL_SERVICE_NAME`, `OTEL_RESOURCE_ATTRIBUTES` | Resource identity |
53
+ | `OTEL_EXPORTER_OTLP_ENDPOINT`, `..._PROTOCOL`, `..._HEADERS`, `..._TIMEOUT`, `..._COMPRESSION` | Shared exporter settings; per-signal forms (`OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` and so on) override |
54
+ | `OTEL_TRACES_EXPORTER`, `OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER` | When set, must include `otlp` for that signal to export |
55
+ | `OTEL_TRACES_SAMPLER`, `OTEL_TRACES_SAMPLER_ARG` | Sampler |
56
+ | `OTEL_PROPAGATORS` | Context propagators |
57
+ | `OTEL_SDK_DISABLED` | `true` disables the providers |
58
+ | `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_METRIC_EXPORT_TIMEOUT` | Metric reader timing, milliseconds |
59
+
60
+ An invalid enabled endpoint fails at startup. Do not add product-specific telemetry variables: configure with the standard `OTEL_*` set only.
61
+
62
+ ## Sampling
63
+
64
+ State the sampler explicitly in the deployment, for example `OTEL_TRACES_SAMPLER=parentbased_traceidratio` with `OTEL_TRACES_SAMPLER_ARG`. Changing sampling or adding instrumentation to raise volume needs a measured span rate as justification; this skill gives no default ratio. With a parent-based sampler an upstream "not sampled" decision removes the whole downstream trace.
65
+
66
+ ## Cardinality
67
+
68
+ Keep metric tags to bounded categories. Excess series fold into one series carrying only `otel.metric.overflow=true`. Raising a limit reserves memory per instrument; raise it only as far as measured.
@@ -0,0 +1,22 @@
1
+ <!-- Copyright (c) Cratis. All rights reserved. -->
2
+ <!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
3
+
4
+ # Troubleshooting
5
+
6
+ Check in this order for any missing signal: SDK not disabled, source subscribed, sampler, endpoint, then the backend.
7
+
8
+ | Symptom | Check |
9
+ | --- | --- |
10
+ | No Chronicle client spans | `Cratis.Chronicle.Client` is subscribed in the same tracing setup as the exporter (`AddCratisOpenTelemetry` does it via `Cratis.*`); an operation actually ran; the kernel's `Cratis.Chronicle` source does not enable client spans |
11
+ | No kernel spans or metrics | The kernel is configured separately; it exports only when an OTLP endpoint env var is set on the kernel process; `OrleansTracing` and `GrpcClientTracing` are off by default |
12
+ | No export at all | No endpoint set (export is opt-in); `OTEL_SDK_DISABLED=true`; `OTEL_*_EXPORTER` set without `otlp`; sampler records nothing or parent was unsampled |
13
+ | Application's own meter or source is silent | It is outside `Cratis.*`; subscribe it with `ConfigureTracing` / `ConfigureMetrics` (see **cratis-fundamentals-telemetry**) |
14
+ | Observer or reactor spans not under the command trace | Expected: observer spans carry no correlation id. Find them by observer id, event store, namespace and sequence; see `arc-and-chronicle-signals.md` |
15
+ | Search on correlation id finds only commit spans | Only unit-of-work commit and rollback spans carry it: key `correlation_id` in Legacy mode, `cratis.correlation_id` in Convention mode. Arc spans carry `cratis.correlation_id`. Append and observer spans never do |
16
+ | Duplicate spans or metrics | Both `AddCratisOpenTelemetry` and `UseOtlpExporter()` / `AddOtlpExporter()`, or both `AddCratisOpenTelemetry` and `WithCratis`; keep one |
17
+ | Dashboard shows old names after enabling convention | Legacy and convention series are distinct; update queries; do not sum them |
18
+ | Metric series stop growing or show `otel.metric.overflow=true` | SDK series limit reached; a tag is unbounded or the limit is too low. Arc `_other` is a separate 1,000-name cap |
19
+ | Wrong `service.name` | Something set it in code or the environment; `OTEL_SERVICE_NAME` wins for applications. The kernel always reports `Chronicle` |
20
+ | Personal ids or payloads in spans | Event source id mode is `Raw` (client default): choose `Hashed` or `Omitted`; remove the offending custom attribute; logs are not covered by these options, redact before formatting |
21
+ | Hashed ids do not match between client and kernel | Different keys, or the kernel generated a per-process key; configure the same 32-plus character key in both |
22
+ | Startup fails on telemetry configuration | Invalid OTLP endpoint, or `Hashed` chosen without a long enough key |
@@ -0,0 +1,14 @@
1
+ {
2
+ "skill": "cratis-observability",
3
+ "input": "Set up OpenTelemetry for a Cratis Arc and Chronicle application, verify spans reach a backend and keep sensitive values out of them.",
4
+ "fixtures": [],
5
+ "assertions": [
6
+ { "kind": "skill-contains", "value": "AddCratisOpenTelemetry" },
7
+ { "kind": "skill-contains", "value": "Cratis.Chronicle.Client" },
8
+ { "kind": "skill-contains", "value": "cratis.correlation_id" },
9
+ { "kind": "skill-contains", "value": "UseOtlpExporter()" },
10
+ { "kind": "skill-contains", "value": "OTEL_SERVICE_NAME" },
11
+ { "kind": "skill-contains", "value": "EventSourceIdTracing" },
12
+ { "kind": "skill-contains", "value": "otel.metric.overflow=true" }
13
+ ]
14
+ }
@@ -105,6 +105,9 @@
105
105
  "cratis/specifications/dotnet",
106
106
  "cratis/specifications/typescript"
107
107
  ],
108
+ "availableTargets": [
109
+ "cratis-observability"
110
+ ],
108
111
  "languages": [
109
112
  "csharp",
110
113
  "elixir",
@@ -123,6 +126,9 @@
123
126
  "cratis/screenplay",
124
127
  "cratis/specifications/dotnet"
125
128
  ],
129
+ "availableTargets": [
130
+ "cratis-observability"
131
+ ],
126
132
  "languages": [
127
133
  "csharp"
128
134
  ]
@@ -135,6 +141,9 @@
135
141
  "cratis/screenplay",
136
142
  "cratis/specifications/dotnet"
137
143
  ],
144
+ "availableTargets": [
145
+ "cratis-observability"
146
+ ],
138
147
  "languages": [
139
148
  "csharp"
140
149
  ]
@@ -148,6 +157,9 @@
148
157
  "cratis/screenplay",
149
158
  "cratis/specifications/dotnet"
150
159
  ],
160
+ "availableTargets": [
161
+ "cratis-observability"
162
+ ],
151
163
  "languages": [
152
164
  "csharp"
153
165
  ]
@@ -165,6 +177,9 @@
165
177
  "cratis/specifications/dotnet",
166
178
  "cratis/specifications/typescript"
167
179
  ],
180
+ "availableTargets": [
181
+ "cratis-observability"
182
+ ],
168
183
  "languages": [
169
184
  "csharp",
170
185
  "react",
@@ -179,6 +194,9 @@
179
194
  "cratis/language/elixir",
180
195
  "cratis/screenplay"
181
196
  ],
197
+ "availableTargets": [
198
+ "cratis-observability"
199
+ ],
182
200
  "languages": [
183
201
  "elixir"
184
202
  ]
@@ -191,6 +209,9 @@
191
209
  "cratis/language/java",
192
210
  "cratis/screenplay"
193
211
  ],
212
+ "availableTargets": [
213
+ "cratis-observability"
214
+ ],
194
215
  "languages": [
195
216
  "java"
196
217
  ]
@@ -203,6 +224,9 @@
203
224
  "cratis/language/kotlin",
204
225
  "cratis/screenplay"
205
226
  ],
227
+ "availableTargets": [
228
+ "cratis-observability"
229
+ ],
206
230
  "languages": [
207
231
  "kotlin"
208
232
  ]
@@ -217,6 +241,9 @@
217
241
  "cratis/specifications/dotnet",
218
242
  "cratis/specifications/typescript"
219
243
  ],
244
+ "availableTargets": [
245
+ "cratis-observability"
246
+ ],
220
247
  "languages": [
221
248
  "csharp",
222
249
  "react",
@@ -231,6 +258,9 @@
231
258
  "cratis/screenplay",
232
259
  "cratis/specifications/typescript"
233
260
  ],
261
+ "availableTargets": [
262
+ "cratis-observability"
263
+ ],
234
264
  "languages": [
235
265
  "typescript",
236
266
  "react"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.172.3",
3
+ "version": "7.174.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [