@cratis/pi 7.161.0 → 7.162.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.
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*Traces.cs,**/*Metrics.cs,**/*Telemetry*,**/Telemetry/**,**/observability.ts,**/*Observation*.kt,**/*Observation*.java"
|
|
3
|
+
paths:
|
|
4
|
+
- "**/*Traces.cs"
|
|
5
|
+
- "**/*Metrics.cs"
|
|
6
|
+
- "**/*Telemetry*"
|
|
7
|
+
- "**/Telemetry/**"
|
|
8
|
+
- "**/observability.ts"
|
|
9
|
+
- "**/*Observation*.kt"
|
|
10
|
+
- "**/*Observation*.java"
|
|
11
|
+
---
|
|
12
|
+
<!-- cratis-ai: generated Copilot instructions. Do not edit; rules/ is the source. -->
|
|
13
|
+
|
|
14
|
+
# Observability (OpenTelemetry)
|
|
15
|
+
|
|
16
|
+
Every line is **[contract]** (binding) or **[convention]** (the house default). The source of truth is
|
|
17
|
+
[Architecture decision 0001](https://github.com/Cratis/Architecture/blob/c70fab646ed576bea054744d34bcbb0bc0cd44f3/decisions/0001-opentelemetry-convention.md);
|
|
18
|
+
generated .NET instruments are in the **cratis-fundamentals-telemetry** skill. Names are the same in every language.
|
|
19
|
+
|
|
20
|
+
## Naming
|
|
21
|
+
|
|
22
|
+
- **[contract]** Instrumentation scope (ActivitySource, Meter, tracer): `Cratis.<Product>[.<Part>]`, version = package version.
|
|
23
|
+
- **[contract]** Span names: `cratis.<product>.<entity>.<operation>`, lowercase, low cardinality. Event, command and query type names go in attributes, never in the span name.
|
|
24
|
+
- **[contract]** Attribute keys use OTel semantic conventions first (`error.type`, `rpc.*`, `http.*`, `db.*`), else `cratis.<concept>.<attr>` (cross-product) or `cratis.<product>.<concept>.<attr>`. Enum values are lowercase.
|
|
25
|
+
- **[contract]** Metrics: `cratis.<product>.<entity>.<measure>`, no unit or `_total` suffix, with a UCUM unit and a description. Durations are histograms in seconds.
|
|
26
|
+
- **[contract]** Metric attributes never carry per-partition, per-event-source or correlation values.
|
|
27
|
+
- **[contract]** Names are public API: expose them as constants, and on a rename ship both names for one minor release.
|
|
28
|
+
|
|
29
|
+
## Never record
|
|
30
|
+
|
|
31
|
+
- **[contract]** Payload values of events, commands, queries or read models; `[PII]` or `[NotAudited]` values; identity subject, name or email; tokens.
|
|
32
|
+
- **[contract]** Exception messages from non-Cratis code: record `exception.type` only.
|
|
33
|
+
- **[contract]** Event source id is off by default (`cratis.event_source.id`). Record it only when explicitly enabled, hashed (HMAC) or raw.
|
|
34
|
+
- **[contract]** Tenant never goes in the resource or in baggage. The only baggage key is `cratis.correlation_id`.
|
|
35
|
+
- **[contract]** Redact structured values before formatting a log message; an interpolated value cannot be reliably removed later.
|
|
36
|
+
|
|
37
|
+
## Setup
|
|
38
|
+
|
|
39
|
+
- **[contract]** Call the platform's single Cratis setup entry point; never hand-roll providers. In .NET that is `AddCratisOpenTelemetry` (`Cratis.OpenTelemetry`, Fundamentals). Node, JVM, Elixir and Python entry points are defined by the decision but not verified here; state them as planned.
|
|
40
|
+
- **[contract]** Never hard-code `service.name`: `OTEL_SERVICE_NAME` wins, code supplies only a default when it is unset.
|
|
41
|
+
- **[contract]** Configure with standard `OTEL_*` variables only; no product-specific telemetry variables or switches.
|
|
42
|
+
- **[contract]** Export only when an OTLP endpoint is configured. Raising telemetry volume (sampling, new instrumentation) cites a measured rate.
|
|
@@ -142,6 +142,7 @@ A claim is only as good as the signal behind it — a build result, a test run,
|
|
|
142
142
|
| Spec patterns — the four `*Scenario` helpers (application only) | `specs.scenarios.csharp.md` |
|
|
143
143
|
| Strongly-typed values (`ConceptAs<T>`, `EventSourceId<T>`); shared term definitions (event, projection, reducer, reactor, observer, DCB, …) | `concepts.md`; `glossary.md` |
|
|
144
144
|
| Files an AI change touches (Code Health with CodeScene); behavior at a trust boundary or wire/protocol surface (cite and conform to the published contract and vectors) | `code-health.md`; `published-contracts.md` |
|
|
145
|
+
| OpenTelemetry traces, metrics and telemetry code | `observability.md` |
|
|
145
146
|
| Diagnosing a misbehaving slice | read model stale or startup crash: **cratis-chronicle-projection** (*Startup-crash traps*); reactor paused or quarantined: **cratis-chronicle-reactor** (*Failure behavior*); proxy missing: **cratis-arc-command** (*Generate the TypeScript proxy*) |
|
|
146
147
|
| Inspecting or operating a **running** Chronicle store (failed partitions, replays, browsing events) with the `cratis` CLI | the **cratis-chronicle-cli-operations** and **cratis-cli-terminal-workbench** skills |
|
|
147
148
|
| EF Core read models / migrations | `efcore.md`, `efcore.specs.md` |
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*Traces.cs,**/*Metrics.cs,**/*Telemetry*,**/Telemetry/**,**/observability.ts,**/*Observation*.kt,**/*Observation*.java"
|
|
3
|
+
paths:
|
|
4
|
+
- "**/*Traces.cs"
|
|
5
|
+
- "**/*Metrics.cs"
|
|
6
|
+
- "**/*Telemetry*"
|
|
7
|
+
- "**/Telemetry/**"
|
|
8
|
+
- "**/observability.ts"
|
|
9
|
+
- "**/*Observation*.kt"
|
|
10
|
+
- "**/*Observation*.java"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Observability (OpenTelemetry)
|
|
14
|
+
|
|
15
|
+
Every line is **[contract]** (binding) or **[convention]** (the house default). The source of truth is
|
|
16
|
+
[Architecture decision 0001](https://github.com/Cratis/Architecture/blob/c70fab646ed576bea054744d34bcbb0bc0cd44f3/decisions/0001-opentelemetry-convention.md);
|
|
17
|
+
generated .NET instruments are in the **cratis-fundamentals-telemetry** skill. Names are the same in every language.
|
|
18
|
+
|
|
19
|
+
## Naming
|
|
20
|
+
|
|
21
|
+
- **[contract]** Instrumentation scope (ActivitySource, Meter, tracer): `Cratis.<Product>[.<Part>]`, version = package version.
|
|
22
|
+
- **[contract]** Span names: `cratis.<product>.<entity>.<operation>`, lowercase, low cardinality. Event, command and query type names go in attributes, never in the span name.
|
|
23
|
+
- **[contract]** Attribute keys use OTel semantic conventions first (`error.type`, `rpc.*`, `http.*`, `db.*`), else `cratis.<concept>.<attr>` (cross-product) or `cratis.<product>.<concept>.<attr>`. Enum values are lowercase.
|
|
24
|
+
- **[contract]** Metrics: `cratis.<product>.<entity>.<measure>`, no unit or `_total` suffix, with a UCUM unit and a description. Durations are histograms in seconds.
|
|
25
|
+
- **[contract]** Metric attributes never carry per-partition, per-event-source or correlation values.
|
|
26
|
+
- **[contract]** Names are public API: expose them as constants, and on a rename ship both names for one minor release.
|
|
27
|
+
|
|
28
|
+
## Never record
|
|
29
|
+
|
|
30
|
+
- **[contract]** Payload values of events, commands, queries or read models; `[PII]` or `[NotAudited]` values; identity subject, name or email; tokens.
|
|
31
|
+
- **[contract]** Exception messages from non-Cratis code: record `exception.type` only.
|
|
32
|
+
- **[contract]** Event source id is off by default (`cratis.event_source.id`). Record it only when explicitly enabled, hashed (HMAC) or raw.
|
|
33
|
+
- **[contract]** Tenant never goes in the resource or in baggage. The only baggage key is `cratis.correlation_id`.
|
|
34
|
+
- **[contract]** Redact structured values before formatting a log message; an interpolated value cannot be reliably removed later.
|
|
35
|
+
|
|
36
|
+
## Setup
|
|
37
|
+
|
|
38
|
+
- **[contract]** Call the platform's single Cratis setup entry point; never hand-roll providers. In .NET that is `AddCratisOpenTelemetry` (`Cratis.OpenTelemetry`, Fundamentals). Node, JVM, Elixir and Python entry points are defined by the decision but not verified here; state them as planned.
|
|
39
|
+
- **[contract]** Never hard-code `service.name`: `OTEL_SERVICE_NAME` wins, code supplies only a default when it is unset.
|
|
40
|
+
- **[contract]** Configure with standard `OTEL_*` variables only; no product-specific telemetry variables or switches.
|
|
41
|
+
- **[contract]** Export only when an OTLP endpoint is configured. Raising telemetry volume (sampling, new instrumentation) cites a measured rate.
|