@capxul/observability 4.20.0-beta.23 → 4.20.0-beta.26

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.
package/README.md CHANGED
@@ -11,6 +11,85 @@ Activity action events accept the implemented `unresolved` Payment status in
11
11
  committed filters and export filters. The event records the selected status;
12
12
  it does not infer settlement from an unresolved result.
13
13
 
14
+ ## Where things live
15
+
16
+ `src/index.ts` is the package door (`@capxul/observability`) and re-exports the
17
+ folders below. `src/engineering.ts` is the engineering subpath
18
+ (`@capxul/observability/engineering`): it builds the engineering telemetry Layer
19
+ from `engineering/` and `engineering-delivery.ts`.
20
+
21
+ | Folder | Owns |
22
+ | -------------- | --------------------------------------------------------------------------------------------------------------- |
23
+ | `catalog/` | Event names, journeys, the required envelope, bounded value schemas, every event's schema, CLI vocabularies. |
24
+ | `events/` | Event schemas by domain: identity, onboarding, organizations, money, chain, indexing, workflows, activity, CLI. |
25
+ | `operations/` | Operation names by concept group, composed with the protocol's rows in `operations.ts`. |
26
+ | `telemetry/` | The track handler, redaction before an event leaves the process, and in-process adapters. |
27
+ | `browser/` | Browser PostHog setup, event sanitizing and captured-network masking. |
28
+ | `engineering/` | Engineering logs, metrics and traces: configuration, serialization and the tracer. |
29
+ | `delivery/` | One CLI invocation's engineering delivery: admission, budget, records and export requests. |
30
+
31
+ `packages/tools/src/modules/lint/internal/telemetry-spine/` reads the catalog across `catalog/`,
32
+ `events/`, `telemetry/` and `browser/`, and treats every one of those files as
33
+ naming events rather than producing them.
34
+
35
+ ```text
36
+ src/
37
+ ├── engineering-delivery.ts
38
+ ├── engineering.ts
39
+ ├── index.ts
40
+ ├── operations.ts
41
+ ├── telemetry-port.ts
42
+ ├── __tests__/
43
+ │ ├── engineering-delivery.test.ts
44
+ │ ├── engineering.test.ts
45
+ │ ├── operations.test.ts
46
+ │ ├── posthog-browser-privacy.test.ts
47
+ │ └── telemetry.test.ts
48
+ ├── browser/
49
+ │ ├── analytics.ts
50
+ │ ├── network.ts
51
+ │ └── sanitize.ts
52
+ ├── catalog/
53
+ │ ├── cli.ts
54
+ │ ├── envelope.ts
55
+ │ ├── events.ts
56
+ │ ├── journeys.ts
57
+ │ ├── schemas.ts
58
+ │ └── values.ts
59
+ ├── delivery/
60
+ │ ├── admission.ts
61
+ │ ├── budget.ts
62
+ │ ├── records.ts
63
+ │ └── requests.ts
64
+ ├── engineering/
65
+ │ ├── config.ts
66
+ │ ├── logs.ts
67
+ │ ├── metric-points.ts
68
+ │ ├── minimal.ts
69
+ │ ├── serialization.ts
70
+ │ └── tracer.ts
71
+ ├── events/
72
+ │ ├── activity.ts
73
+ │ ├── chain.ts
74
+ │ ├── cli.ts
75
+ │ ├── identity.ts
76
+ │ ├── indexing.ts
77
+ │ ├── money.ts
78
+ │ ├── onboarding.ts
79
+ │ ├── organizations.ts
80
+ │ └── workflows.ts
81
+ ├── operations/
82
+ │ ├── money.ts
83
+ │ ├── organizations.ts
84
+ │ ├── people.ts
85
+ │ ├── platform.ts
86
+ │ └── tree.ts
87
+ └── telemetry/
88
+ ├── adapters.ts
89
+ ├── redaction.ts
90
+ └── track.ts
91
+ ```
92
+
14
93
  ## The required envelope (ADR-0020 A1 amendment)
15
94
 
16
95
  One PostHog project holds every environment, so `capxul_env` — not project
@@ -1,9 +1,9 @@
1
- import { Context, Duration, Effect, Layer, Logger, Metric, References, Tracer } from "effect";
2
- import { HttpClient, HttpClientError } from "effect/unstable/http";
3
- import { OtlpExporter, OtlpSerialization } from "effect/unstable/observability";
4
- //#region src/engineering-delivery.d.ts
1
+ import { Context, Duration, Effect, Layer, Logger, Metric, Tracer } from "effect";
2
+ import { HttpClient } from "effect/http";
3
+ import { OtlpExporter } from "effect/observability";
4
+ //#region src/delivery/budget.d.ts
5
5
  /** Fixed admission limits for one CLI invocation and its SDK client. */
6
- declare const CLI_ENGINEERING_LIMITS: Readonly<{
6
+ export declare const CLI_ENGINEERING_LIMITS: Readonly<{
7
7
  records: 80;
8
8
  ordinaryRecords: 64;
9
9
  recordBytes: 16384;
@@ -28,7 +28,7 @@ interface CliEngineeringStats {
28
28
  readonly metricSeries: number;
29
29
  }
30
30
  /** Shared, closure-owned admission state; no queue or mutable counters are exposed. */
31
- declare function makeCliEngineeringBudget(): Readonly<{
31
+ export declare function makeCliEngineeringBudget(): Readonly<{
32
32
  metricRegistry: Map<string, MetricEntry>;
33
33
  emptyMetricRegistry: () => Map<string, MetricEntry>;
34
34
  drop: () => void;
@@ -38,9 +38,9 @@ declare function makeCliEngineeringBudget(): Readonly<{
38
38
  }>;
39
39
  type CliEngineeringBudget = ReturnType<typeof makeCliEngineeringBudget>;
40
40
  //#endregion
41
- //#region src/engineering.d.ts
41
+ //#region src/engineering/config.d.ts
42
42
  type EngineeringProducer = "browser" | "server";
43
- declare const ENGINEERING_CAPXUL_ENVS: readonly ["development", "staging", "production", "local"];
43
+ export declare const ENGINEERING_CAPXUL_ENVS: readonly ["development", "staging", "production", "local"];
44
44
  type EngineeringCapxulEnv = (typeof ENGINEERING_CAPXUL_ENVS)[number];
45
45
  interface EngineeringTelemetryConfig {
46
46
  readonly host: string;
@@ -58,21 +58,27 @@ interface EngineeringTelemetryConfig {
58
58
  /** CLI-only shared admission and transport lifetime. Omission preserves host defaults. */
59
59
  readonly deliveryBudget?: CliEngineeringBudget;
60
60
  }
61
- declare const traceHeaderFilter: (_name: string) => boolean;
62
- declare const postHogOtlpEndpoints: (host: string) => {
61
+ export declare const traceHeaderFilter: (_name: string) => boolean;
62
+ export declare const postHogOtlpEndpoints: (host: string) => {
63
63
  readonly logs: `${string}/i/v1/logs`;
64
64
  readonly traces: `${string}/i/v1/traces`;
65
65
  readonly metrics: `${string}/i/v1/metrics`;
66
66
  };
67
- /** Preserve domain exits while preventing the OTLP serializer from seeing raw causes. */
68
- declare const makeLeakSafeEngineeringTracer: (delegate: Tracer.Tracer, enabled?: () => boolean) => Tracer.Tracer;
67
+ //#endregion
68
+ //#region src/engineering/logs.d.ts
69
69
  /** Attempt to drain all engineering signals; completion does not prove ingestion. */
70
- declare const flushEngineeringTelemetry: Effect.Effect<void, never, OtlpExporter.Flusher>;
70
+ export declare const flushEngineeringTelemetry: Effect.Effect<void, never, OtlpExporter.Flusher>;
71
71
  declare const EngineeringLog_base: Context.ServiceClass<EngineeringLog, "capxul/EngineeringLog", Logger.Logger<unknown, void>>;
72
72
  declare class EngineeringLog extends EngineeringLog_base {}
73
73
  /** Deliver an owned engineering record without changing the caller's console verbosity. */
74
- declare const logEngineeringInfo: (message: string, attributes: Readonly<Record<string, unknown>>) => Effect.Effect<void, never, never>;
74
+ export declare const logEngineeringInfo: (message: string, attributes: Readonly<Record<string, unknown>>) => Effect.Effect<void, never, never>;
75
+ //#endregion
76
+ //#region src/engineering/tracer.d.ts
77
+ /** Preserve domain exits while preventing the OTLP serializer from seeing raw causes. */
78
+ export declare const makeLeakSafeEngineeringTracer: (delegate: Tracer.Tracer, enabled?: () => boolean) => Tracer.Tracer;
79
+ //#endregion
80
+ //#region src/engineering.d.ts
75
81
  /** Shared browser/server OTLP layer. OtlpLogger merges with incumbent loggers once. */
76
- declare const makeEngineeringTelemetryLayer: (config: EngineeringTelemetryConfig) => Layer.Layer<EngineeringLog | OtlpExporter.Flusher, never, never>;
82
+ export declare const makeEngineeringTelemetryLayer: (config: EngineeringTelemetryConfig) => Layer.Layer<EngineeringLog | OtlpExporter.Flusher, never, never>;
77
83
  //#endregion
78
- export { CLI_ENGINEERING_LIMITS, type CliEngineeringBudget, type CliEngineeringStats, ENGINEERING_CAPXUL_ENVS, EngineeringCapxulEnv, EngineeringProducer, EngineeringTelemetryConfig, flushEngineeringTelemetry, logEngineeringInfo, makeCliEngineeringBudget, makeEngineeringTelemetryLayer, makeLeakSafeEngineeringTracer, postHogOtlpEndpoints, traceHeaderFilter };
84
+ export type { CliEngineeringBudget, CliEngineeringStats, EngineeringCapxulEnv, EngineeringProducer, EngineeringTelemetryConfig };