@equipe-tech/observability 0.2.1 → 0.3.5
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 +11 -9
- package/dist/BrowserEvents.d.ts +89 -12
- package/dist/BrowserEvents.js +67 -13
- package/dist/Correlation.d.ts +51 -0
- package/dist/Correlation.js +95 -0
- package/dist/Metrics.d.ts +19 -3
- package/dist/Metrics.js +16 -0
- package/dist/MetricsRuntime.d.ts +45 -3
- package/dist/MetricsRuntime.js +478 -120
- package/dist/PolicyOtlpLogger.d.ts +18 -0
- package/dist/PolicyOtlpLogger.js +142 -0
- package/dist/RedactionPolicy.d.ts +2 -9
- package/dist/RedactionPolicy.js +2 -246
- package/dist/ResourceIdentity.d.ts +47 -0
- package/dist/ResourceIdentity.js +82 -0
- package/dist/Telemetry.d.ts +18 -3
- package/dist/Telemetry.js +43 -25
- package/dist/TelemetryConfig.d.ts +11 -4
- package/dist/TelemetryConfig.js +38 -10
- package/dist/audit/AuditCommitDocument.d.ts +41 -0
- package/dist/audit/AuditCommitDocument.js +58 -0
- package/dist/audit/AuditDigest.d.ts +11 -0
- package/dist/audit/AuditDigest.js +25 -0
- package/dist/audit/AuditOutbox.d.ts +75 -0
- package/dist/audit/AuditOutbox.js +104 -0
- package/dist/audit/AuditPublisher.d.ts +49 -0
- package/dist/audit/AuditPublisher.js +60 -0
- package/dist/audit/AuditRecord.d.ts +128 -0
- package/dist/audit/AuditRecord.js +172 -0
- package/dist/audit/CommittedAuditRecordInternal.d.ts +11 -0
- package/dist/audit/CommittedAuditRecordInternal.js +13 -0
- package/dist/audit/InvalidAuditRecord.d.ts +12 -0
- package/dist/audit/InvalidAuditRecord.js +16 -0
- package/dist/audit/index.d.ts +7 -0
- package/dist/audit/index.js +7 -0
- package/dist/browser/BrowserClient.d.ts +82 -3
- package/dist/browser/BrowserClient.js +322 -28
- package/dist/browser/BrowserEventLimits.d.ts +8 -0
- package/dist/browser/BrowserEventLimits.js +8 -0
- package/dist/browser/BrowserMetricRecorder.d.ts +17 -0
- package/dist/browser/BrowserMetricRecorder.js +35 -0
- package/dist/browser/BrowserTelemetry.d.ts +40 -0
- package/dist/browser/BrowserTelemetry.js +105 -0
- package/dist/browser/ClientPolicy.d.ts +3 -0
- package/dist/browser/ClientPolicy.js +52 -0
- package/dist/browser/client.d.ts +3 -2
- package/dist/browser/client.js +2 -1
- package/dist/browser/index.d.ts +4 -37
- package/dist/browser/index.js +3 -95
- package/dist/contract/ContractCompatibility.d.ts +31 -0
- package/dist/contract/ContractCompatibility.js +274 -0
- package/dist/contract/ContractIndex.d.ts +54 -0
- package/dist/contract/ContractIndex.js +178 -0
- package/dist/contract/ContractSurface.d.ts +111 -0
- package/dist/contract/ContractSurface.js +116 -0
- package/dist/contract/EventName.d.ts +6 -0
- package/dist/contract/EventName.js +55 -0
- package/dist/contract/EventProducer.d.ts +123 -0
- package/dist/contract/EventProducer.js +209 -0
- package/dist/contract/MetricContractError.d.ts +19 -0
- package/dist/contract/MetricContractError.js +19 -0
- package/dist/contract/MetricDefinition.d.ts +61 -0
- package/dist/contract/MetricDefinition.js +91 -0
- package/dist/contract/MetricProducer.d.ts +42 -0
- package/dist/contract/MetricProducer.js +123 -0
- package/dist/contract/OrganizationEvents.d.ts +165 -0
- package/dist/contract/OrganizationEvents.js +97 -0
- package/dist/contract/TelemetryContract.d.ts +95 -0
- package/dist/contract/TelemetryContract.js +451 -0
- package/dist/contract/TelemetryContractError.d.ts +44 -0
- package/dist/contract/TelemetryContractError.js +64 -0
- package/dist/contract/TelemetryEvent.d.ts +59 -0
- package/dist/contract/TelemetryEvent.js +54 -0
- package/dist/contract/index.d.ts +11 -0
- package/dist/contract/index.js +11 -0
- package/dist/effect/WideEvent.d.ts +3 -0
- package/dist/effect/WideEvent.js +20 -0
- package/dist/effect/WideEventSink.d.ts +3 -0
- package/dist/effect/WideEventSink.js +79 -0
- package/dist/effect/index.d.ts +2 -0
- package/dist/effect/index.js +2 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +11 -2
- package/dist/metrics/InstrumentGrammar.d.ts +5 -0
- package/dist/metrics/InstrumentGrammar.js +12 -0
- package/dist/metrics/MetricScalar.d.ts +3 -0
- package/dist/metrics/MetricScalar.js +5 -0
- package/dist/node/AuditDigest.d.ts +3 -0
- package/dist/node/AuditDigest.js +6 -0
- package/dist/node/BrowserEventIngest.d.ts +7 -2
- package/dist/node/BrowserEventIngest.js +111 -19
- package/dist/node/LocalCollector.d.ts +20 -0
- package/dist/node/LocalCollector.js +188 -0
- package/dist/node/Observability.d.ts +49 -0
- package/dist/node/Observability.js +190 -0
- package/dist/node/Runtime.d.ts +4 -1
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.js +3 -0
- package/dist/policy/BrowserFieldPolicy.d.ts +7 -0
- package/dist/policy/BrowserFieldPolicy.js +298 -0
- package/dist/policy/DataPolicy.d.ts +19 -0
- package/dist/policy/DataPolicy.js +254 -0
- package/dist/policy/DataPolicyError.d.ts +22 -0
- package/dist/policy/DataPolicyError.js +25 -0
- package/dist/policy/Deduplication.d.ts +13 -0
- package/dist/policy/Deduplication.js +44 -0
- package/dist/policy/DefectEnvelope.d.ts +25 -0
- package/dist/policy/DefectEnvelope.js +52 -0
- package/dist/policy/MetricLabelPolicy.d.ts +5 -0
- package/dist/policy/MetricLabelPolicy.js +65 -0
- package/dist/policy/PolicyTransform.d.ts +16 -0
- package/dist/policy/PolicyTransform.js +136 -0
- package/dist/policy/PolicyVocabulary.d.ts +10 -0
- package/dist/policy/PolicyVocabulary.js +84 -0
- package/dist/policy/ResourceAttributePolicy.d.ts +9 -0
- package/dist/policy/ResourceAttributePolicy.js +33 -0
- package/dist/policy/entrypoint.d.ts +2 -0
- package/dist/policy/entrypoint.js +2 -0
- package/dist/policy/index.d.ts +17 -0
- package/dist/policy/index.js +9 -0
- package/dist/profile/DataPolicy.d.ts +2 -0
- package/dist/profile/DataPolicy.js +1 -0
- package/dist/profile/EnvironmentPolicy.d.ts +22 -0
- package/dist/profile/EnvironmentPolicy.js +41 -0
- package/dist/profile/LifecycleRegistry.d.ts +24 -0
- package/dist/profile/LifecycleRegistry.js +240 -0
- package/dist/profile/ObservabilityAdapter.d.ts +115 -0
- package/dist/profile/ObservabilityAdapter.js +50 -0
- package/dist/profile/ObservabilityConfig.d.ts +68 -0
- package/dist/profile/ObservabilityConfig.js +125 -0
- package/dist/profile/ObservabilityConfigError.d.ts +23 -0
- package/dist/profile/ObservabilityConfigError.js +39 -0
- package/dist/profile/ObservabilityProfile.d.ts +49 -0
- package/dist/profile/ObservabilityProfile.js +121 -0
- package/dist/profile/ReactWebProfile.d.ts +8 -0
- package/dist/profile/ReactWebProfile.js +7 -0
- package/dist/profile/index.d.ts +5 -0
- package/dist/profile/index.js +5 -0
- package/dist/testing/conformance/ConformanceAssertions.d.ts +5 -0
- package/dist/testing/conformance/ConformanceAssertions.js +31 -0
- package/dist/testing/conformance/ConformanceFailure.d.ts +35 -0
- package/dist/testing/conformance/ConformanceFailure.js +56 -0
- package/dist/testing/conformance/ConformanceModel.d.ts +97 -0
- package/dist/testing/conformance/ConformanceModel.js +8 -0
- package/dist/testing/conformance/ConformanceRegistry.d.ts +13 -0
- package/dist/testing/conformance/ConformanceRegistry.js +190 -0
- package/dist/testing/conformance/ConformanceRunner.d.ts +5 -0
- package/dist/testing/conformance/ConformanceRunner.js +198 -0
- package/dist/testing/conformance/TelemetryEvidence.d.ts +91 -0
- package/dist/testing/conformance/TelemetryEvidence.js +370 -0
- package/dist/testing/conformance/index.d.ts +10 -0
- package/dist/testing/conformance/index.js +6 -0
- package/dist/testing/contract.d.ts +81 -0
- package/dist/testing/contract.js +93 -0
- package/dist/testing/deployedCanary.d.ts +1 -0
- package/dist/testing/deployedCanary.js +1 -0
- package/dist/testing/index.d.ts +40 -3
- package/dist/testing/index.js +122 -5
- package/dist/trace/HttpServerOtlpTracer.d.ts +42 -0
- package/dist/trace/HttpServerOtlpTracer.js +301 -0
- package/package.json +16 -29
- package/dist/WideEvent.d.ts +0 -5
- package/dist/WideEvent.js +0 -6
- package/dist/nestjs/BrowserEventsController.d.ts +0 -21
- package/dist/nestjs/BrowserEventsController.js +0 -52
- package/dist/nestjs/HttpRoutePolicy.d.ts +0 -23
- package/dist/nestjs/HttpRoutePolicy.js +0 -179
- package/dist/nestjs/HttpServerOtlpTracer.d.ts +0 -15
- package/dist/nestjs/HttpServerOtlpTracer.js +0 -154
- package/dist/nestjs/RequestWideEventTraceCorrelation.d.ts +0 -15
- package/dist/nestjs/RequestWideEventTraceCorrelation.js +0 -13
- package/dist/nestjs/TelemetryInterceptor.d.ts +0 -31
- package/dist/nestjs/TelemetryInterceptor.js +0 -268
- package/dist/nestjs/TelemetryModule.d.ts +0 -53
- package/dist/nestjs/TelemetryModule.js +0 -428
- package/dist/nestjs/index.d.ts +0 -5
- package/dist/nestjs/index.js +0 -4
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type ProfileName = "nestjs-api" | "worker" | "react-web" | "cli" | "library";
|
|
2
|
+
export type AdapterCapability = "events" | "traces" | "metrics" | "defects" | "browser-ingest";
|
|
3
|
+
export type ExternalAdapterCapability = "events" | "defects" | "browser-ingest";
|
|
4
|
+
export type CapabilityRequirement = "required" | "required-in-production" | "optional" | "forbidden";
|
|
5
|
+
export type LifecycleStage = "server" | "metrics" | "browser";
|
|
6
|
+
type StageDeadline = readonly [stage: LifecycleStage, deadlineMillis: number];
|
|
7
|
+
type StageCapabilityOrder = readonly [
|
|
8
|
+
stage: LifecycleStage,
|
|
9
|
+
capabilities: ReadonlyArray<AdapterCapability>
|
|
10
|
+
];
|
|
11
|
+
type ProfileCapabilities = {
|
|
12
|
+
readonly name: ProfileName;
|
|
13
|
+
readonly events: CapabilityRequirement;
|
|
14
|
+
readonly traces: CapabilityRequirement;
|
|
15
|
+
readonly metrics: CapabilityRequirement;
|
|
16
|
+
readonly defects: CapabilityRequirement;
|
|
17
|
+
readonly browserIngest: CapabilityRequirement;
|
|
18
|
+
readonly stages: ReadonlyArray<LifecycleStage>;
|
|
19
|
+
readonly stageDeadlineMillis: ReadonlyArray<StageDeadline>;
|
|
20
|
+
readonly capabilityOrder: ReadonlyArray<StageCapabilityOrder>;
|
|
21
|
+
readonly shutdownDeadlineMillis: number;
|
|
22
|
+
};
|
|
23
|
+
export type NodeObservabilityProfile = ProfileCapabilities & {
|
|
24
|
+
readonly runtime: "node-global";
|
|
25
|
+
};
|
|
26
|
+
export type BrowserObservabilityProfile = ProfileCapabilities & {
|
|
27
|
+
readonly runtime: "browser-global";
|
|
28
|
+
};
|
|
29
|
+
export type LibraryObservabilityProfile = ProfileCapabilities & {
|
|
30
|
+
readonly runtime: "none";
|
|
31
|
+
};
|
|
32
|
+
export type ObservabilityProfile = NodeObservabilityProfile | BrowserObservabilityProfile | LibraryObservabilityProfile;
|
|
33
|
+
export declare const nestjsApiProfile: NodeObservabilityProfile;
|
|
34
|
+
export declare const workerProfile: NodeObservabilityProfile;
|
|
35
|
+
export declare const reactWebProfile: BrowserObservabilityProfile;
|
|
36
|
+
export declare const cliProfile: NodeObservabilityProfile;
|
|
37
|
+
export declare const libraryProfile: LibraryObservabilityProfile;
|
|
38
|
+
type ObservabilityProfiles = {
|
|
39
|
+
readonly "nestjs-api": NodeObservabilityProfile;
|
|
40
|
+
readonly worker: NodeObservabilityProfile;
|
|
41
|
+
readonly "react-web": BrowserObservabilityProfile;
|
|
42
|
+
readonly cli: NodeObservabilityProfile;
|
|
43
|
+
readonly library: LibraryObservabilityProfile;
|
|
44
|
+
};
|
|
45
|
+
export declare const observabilityProfiles: ObservabilityProfiles;
|
|
46
|
+
export declare const profileCapabilityRequirement: (value: ObservabilityProfile, capability: AdapterCapability) => CapabilityRequirement;
|
|
47
|
+
export declare const profileStageDeadlineMillis: (profile: ObservabilityProfile, stage: LifecycleStage) => number | undefined;
|
|
48
|
+
export declare const profileCapabilityRank: (profile: ObservabilityProfile, stage: LifecycleStage, capability: AdapterCapability) => number;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { reactWebLifecycle } from "./ReactWebProfile.js";
|
|
2
|
+
const stageDeadline = (stage, deadlineMillis) => Object.freeze([stage, deadlineMillis]);
|
|
3
|
+
const stageCapabilities = (stage, capabilities) => Object.freeze([stage, Object.freeze([...capabilities])]);
|
|
4
|
+
const nodeProfile = (value) => Object.freeze({
|
|
5
|
+
...value,
|
|
6
|
+
stages: Object.freeze([...value.stages]),
|
|
7
|
+
stageDeadlineMillis: Object.freeze([...value.stageDeadlineMillis]),
|
|
8
|
+
capabilityOrder: Object.freeze([...value.capabilityOrder]),
|
|
9
|
+
});
|
|
10
|
+
const browserProfile = (value) => Object.freeze({
|
|
11
|
+
...value,
|
|
12
|
+
stages: Object.freeze([...value.stages]),
|
|
13
|
+
stageDeadlineMillis: Object.freeze([...value.stageDeadlineMillis]),
|
|
14
|
+
capabilityOrder: Object.freeze([...value.capabilityOrder]),
|
|
15
|
+
});
|
|
16
|
+
const libraryProfileDescriptor = (value) => Object.freeze({
|
|
17
|
+
...value,
|
|
18
|
+
stages: Object.freeze([...value.stages]),
|
|
19
|
+
stageDeadlineMillis: Object.freeze([...value.stageDeadlineMillis]),
|
|
20
|
+
capabilityOrder: Object.freeze([...value.capabilityOrder]),
|
|
21
|
+
});
|
|
22
|
+
export const nestjsApiProfile = nodeProfile({
|
|
23
|
+
name: "nestjs-api",
|
|
24
|
+
runtime: "node-global",
|
|
25
|
+
events: "required",
|
|
26
|
+
traces: "required",
|
|
27
|
+
metrics: "required",
|
|
28
|
+
defects: "required-in-production",
|
|
29
|
+
browserIngest: "optional",
|
|
30
|
+
stages: ["server", "metrics"],
|
|
31
|
+
stageDeadlineMillis: [stageDeadline("server", 5_000), stageDeadline("metrics", 3_000)],
|
|
32
|
+
capabilityOrder: [
|
|
33
|
+
stageCapabilities("server", ["browser-ingest", "events", "traces", "defects"]),
|
|
34
|
+
stageCapabilities("metrics", ["metrics"]),
|
|
35
|
+
],
|
|
36
|
+
shutdownDeadlineMillis: 5_000,
|
|
37
|
+
});
|
|
38
|
+
export const workerProfile = nodeProfile({
|
|
39
|
+
name: "worker",
|
|
40
|
+
runtime: "node-global",
|
|
41
|
+
events: "required",
|
|
42
|
+
traces: "required",
|
|
43
|
+
metrics: "required",
|
|
44
|
+
defects: "required-in-production",
|
|
45
|
+
browserIngest: "forbidden",
|
|
46
|
+
stages: ["server", "metrics"],
|
|
47
|
+
stageDeadlineMillis: [stageDeadline("server", 5_000), stageDeadline("metrics", 3_000)],
|
|
48
|
+
capabilityOrder: [
|
|
49
|
+
stageCapabilities("server", ["events", "traces", "defects"]),
|
|
50
|
+
stageCapabilities("metrics", ["metrics"]),
|
|
51
|
+
],
|
|
52
|
+
shutdownDeadlineMillis: 5_000,
|
|
53
|
+
});
|
|
54
|
+
export const reactWebProfile = browserProfile({
|
|
55
|
+
name: "react-web",
|
|
56
|
+
runtime: "browser-global",
|
|
57
|
+
events: "required",
|
|
58
|
+
traces: "required",
|
|
59
|
+
metrics: "optional",
|
|
60
|
+
defects: "required-in-production",
|
|
61
|
+
browserIngest: "required",
|
|
62
|
+
stages: ["browser"],
|
|
63
|
+
stageDeadlineMillis: [stageDeadline("browser", reactWebLifecycle.shutdownDeadlineMillis)],
|
|
64
|
+
capabilityOrder: [
|
|
65
|
+
stageCapabilities("browser", ["browser-ingest", "events", "traces", "defects", "metrics"]),
|
|
66
|
+
],
|
|
67
|
+
shutdownDeadlineMillis: reactWebLifecycle.shutdownDeadlineMillis,
|
|
68
|
+
});
|
|
69
|
+
export const cliProfile = nodeProfile({
|
|
70
|
+
name: "cli",
|
|
71
|
+
runtime: "node-global",
|
|
72
|
+
events: "required",
|
|
73
|
+
traces: "optional",
|
|
74
|
+
metrics: "optional",
|
|
75
|
+
defects: "optional",
|
|
76
|
+
browserIngest: "forbidden",
|
|
77
|
+
stages: ["server", "metrics"],
|
|
78
|
+
stageDeadlineMillis: [stageDeadline("server", 5_000), stageDeadline("metrics", 3_000)],
|
|
79
|
+
capabilityOrder: [
|
|
80
|
+
stageCapabilities("server", ["events", "traces", "defects"]),
|
|
81
|
+
stageCapabilities("metrics", ["metrics"]),
|
|
82
|
+
],
|
|
83
|
+
shutdownDeadlineMillis: 5_000,
|
|
84
|
+
});
|
|
85
|
+
export const libraryProfile = libraryProfileDescriptor({
|
|
86
|
+
name: "library",
|
|
87
|
+
runtime: "none",
|
|
88
|
+
events: "forbidden",
|
|
89
|
+
traces: "forbidden",
|
|
90
|
+
metrics: "forbidden",
|
|
91
|
+
defects: "forbidden",
|
|
92
|
+
browserIngest: "forbidden",
|
|
93
|
+
stages: [],
|
|
94
|
+
stageDeadlineMillis: [],
|
|
95
|
+
capabilityOrder: [],
|
|
96
|
+
shutdownDeadlineMillis: 0,
|
|
97
|
+
});
|
|
98
|
+
export const observabilityProfiles = Object.freeze({
|
|
99
|
+
"nestjs-api": nestjsApiProfile,
|
|
100
|
+
worker: workerProfile,
|
|
101
|
+
"react-web": reactWebProfile,
|
|
102
|
+
cli: cliProfile,
|
|
103
|
+
library: libraryProfile,
|
|
104
|
+
});
|
|
105
|
+
export const profileCapabilityRequirement = (value, capability) => {
|
|
106
|
+
switch (capability) {
|
|
107
|
+
case "events":
|
|
108
|
+
return value.events;
|
|
109
|
+
case "traces":
|
|
110
|
+
return value.traces;
|
|
111
|
+
case "metrics":
|
|
112
|
+
return value.metrics;
|
|
113
|
+
case "defects":
|
|
114
|
+
return value.defects;
|
|
115
|
+
case "browser-ingest":
|
|
116
|
+
return value.browserIngest;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
export const profileStageDeadlineMillis = (profile, stage) => profile.stageDeadlineMillis.find(([candidate]) => candidate === stage)?.[1];
|
|
120
|
+
export const profileCapabilityRank = (profile, stage, capability) => profile.capabilityOrder.find(([candidate]) => candidate === stage)?.[1].indexOf(capability) ??
|
|
121
|
+
Number.MAX_SAFE_INTEGER;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ReactWebLifecycle = {
|
|
2
|
+
readonly environmentRequiringDefects: "production";
|
|
3
|
+
readonly shutdownDeadlineMillis: 2_000;
|
|
4
|
+
readonly eventShutdownDeadlineMillis: 1_150;
|
|
5
|
+
readonly sentryDeadlineMillis: 800;
|
|
6
|
+
readonly flushDeadlineMillis: 5_000;
|
|
7
|
+
};
|
|
8
|
+
export declare const reactWebLifecycle: ReactWebLifecycle;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AdapterFailure, AdapterName, registerOfficialAdapter, type AdapterOutcome, type AdapterRegistration, type ContractRegistry, type LifecycleCleanupResult, type LifecycleOutcome, type LifecycleOutcomeResult, type LifecycleReport, type ObservabilityAdapter, type ObservabilityAdapterContext, type ObservabilityAdapterHandle, type OfficialAdapterRegistration, type RuntimeDisposalOutcome, } from "./ObservabilityAdapter.js";
|
|
2
|
+
export { ObservabilityLifecycleError } from "./LifecycleRegistry.js";
|
|
3
|
+
export { nodeObservabilityConfigFromEnv, parseNodeObservabilityConfig, type DeploymentScope, type EnvBootstrapInput, type NodeObservabilityConfig, type NodeObservabilityConfigDisabled, type NodeObservabilityConfigEnabled, type NodeObservabilityConfigInput, type SentryConfig, } from "./ObservabilityConfig.js";
|
|
4
|
+
export { DuplicateReleaseVariable, InvalidObservabilityConfig, ObservabilityConfigField, SecondReleaseVariable, } from "./ObservabilityConfigError.js";
|
|
5
|
+
export { cliProfile, libraryProfile, nestjsApiProfile, observabilityProfiles, reactWebProfile, workerProfile, type AdapterCapability, type BrowserObservabilityProfile, type CapabilityRequirement, type LibraryObservabilityProfile, type LifecycleStage, type NodeObservabilityProfile, type ObservabilityProfile, type ProfileName, } from "./ObservabilityProfile.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AdapterFailure, AdapterName, registerOfficialAdapter, } from "./ObservabilityAdapter.js";
|
|
2
|
+
export { ObservabilityLifecycleError } from "./LifecycleRegistry.js";
|
|
3
|
+
export { nodeObservabilityConfigFromEnv, parseNodeObservabilityConfig, } from "./ObservabilityConfig.js";
|
|
4
|
+
export { DuplicateReleaseVariable, InvalidObservabilityConfig, ObservabilityConfigField, SecondReleaseVariable, } from "./ObservabilityConfigError.js";
|
|
5
|
+
export { cliProfile, libraryProfile, nestjsApiProfile, observabilityProfiles, reactWebProfile, workerProfile, } from "./ObservabilityProfile.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { ConformanceAssertionError } from "./ConformanceFailure.js";
|
|
3
|
+
import type { ConformanceCheckId, ConformanceProfileReport, ConformanceReport } from "./ConformanceModel.js";
|
|
4
|
+
export declare const assertConforms: (report: ConformanceProfileReport | ConformanceReport) => Effect.Effect<void, ConformanceAssertionError>;
|
|
5
|
+
export declare const assertConformanceFailure: (report: ConformanceProfileReport, expected: ConformanceCheckId) => Effect.Effect<void, ConformanceAssertionError>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { ConformanceAssertionError } from "./ConformanceFailure.js";
|
|
3
|
+
const assertionError = (code, message, offendingValue) => new ConformanceAssertionError({
|
|
4
|
+
code,
|
|
5
|
+
message,
|
|
6
|
+
offendingValue,
|
|
7
|
+
cause: offendingValue,
|
|
8
|
+
});
|
|
9
|
+
const failureNames = (report) => report.checks
|
|
10
|
+
.filter((check) => check.status === "fail")
|
|
11
|
+
.map((check) => `${check.id} (${check.failure.code}: ${check.failure.offendingValue})`);
|
|
12
|
+
export const assertConforms = (report) => {
|
|
13
|
+
if (report.conforms)
|
|
14
|
+
return Effect.void;
|
|
15
|
+
const reports = "profiles" in report ? report.profiles : [report];
|
|
16
|
+
const failures = reports.flatMap(failureNames);
|
|
17
|
+
return Effect.fail(assertionError("OBS_CONFORMANCE_NOT_CONFORMANT", `The conformance report does not conform. Failing checks: ${failures.join("; ")}.`, failures.join(", ")));
|
|
18
|
+
};
|
|
19
|
+
export const assertConformanceFailure = (report, expected) => {
|
|
20
|
+
if (report.conforms) {
|
|
21
|
+
return Effect.fail(assertionError("OBS_CONFORMANCE_NEGATIVE_FIXTURE_PASSED", `The negative fixture conformed unexpectedly. The check ${expected} must fail.`, expected));
|
|
22
|
+
}
|
|
23
|
+
const result = report.checks.find((check) => check.id === expected);
|
|
24
|
+
if (result === undefined) {
|
|
25
|
+
return Effect.fail(assertionError("OBS_CONFORMANCE_EXPECTED_FAILURE_ABSENT", `The conformance report does not contain the check ${expected}.`, expected));
|
|
26
|
+
}
|
|
27
|
+
if (result.status === "pass" || result.status === "not-applicable") {
|
|
28
|
+
return Effect.fail(assertionError("OBS_CONFORMANCE_NEGATIVE_FIXTURE_PASSED", `The check ${expected} reported ${result.status} where the negative fixture requires a failure.`, expected));
|
|
29
|
+
}
|
|
30
|
+
return Effect.void;
|
|
31
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const conformanceFailureCodes: readonly ["OBS_CONFORMANCE_PROFILE_INVALID", "OBS_CONFORMANCE_IDENTITY_INVALID", "OBS_CONFORMANCE_CONTRACT_INVALID", "OBS_CONFORMANCE_MANIFEST_INVALID", "OBS_CONFORMANCE_PRODUCER_INVALID", "OBS_CONFORMANCE_QUERY_INVALID", "OBS_CONFORMANCE_CORRELATION_INVALID", "OBS_CONFORMANCE_POLICY_INVALID", "OBS_CONFORMANCE_EVENT_PATH_INVALID", "OBS_CONFORMANCE_SENTRY_BOUNDARY_INVALID", "OBS_CONFORMANCE_LIFECYCLE_INVALID", "OBS_CONFORMANCE_AUDIT_DURABILITY_MISSING", "OBS_CONFORMANCE_LOCAL_OTLP_PIPELINE", "OBS_CONFORMANCE_TELEMETRY_CANARY_FAILED", "OBS_CONFORMANCE_SENTRY_CANARY_FAILED", "OBS_CONFORMANCE_BROWSER_CANARY_FAILED", "OBS_CONFORMANCE_AUDIT_CANARY_FAILED"];
|
|
3
|
+
export type ConformanceFailureCode = (typeof conformanceFailureCodes)[number];
|
|
4
|
+
export declare const ConformanceFailureCodeSchema: Schema.Literals<readonly ["OBS_CONFORMANCE_PROFILE_INVALID", "OBS_CONFORMANCE_IDENTITY_INVALID", "OBS_CONFORMANCE_CONTRACT_INVALID", "OBS_CONFORMANCE_MANIFEST_INVALID", "OBS_CONFORMANCE_PRODUCER_INVALID", "OBS_CONFORMANCE_QUERY_INVALID", "OBS_CONFORMANCE_CORRELATION_INVALID", "OBS_CONFORMANCE_POLICY_INVALID", "OBS_CONFORMANCE_EVENT_PATH_INVALID", "OBS_CONFORMANCE_SENTRY_BOUNDARY_INVALID", "OBS_CONFORMANCE_LIFECYCLE_INVALID", "OBS_CONFORMANCE_AUDIT_DURABILITY_MISSING", "OBS_CONFORMANCE_LOCAL_OTLP_PIPELINE", "OBS_CONFORMANCE_TELEMETRY_CANARY_FAILED", "OBS_CONFORMANCE_SENTRY_CANARY_FAILED", "OBS_CONFORMANCE_BROWSER_CANARY_FAILED", "OBS_CONFORMANCE_AUDIT_CANARY_FAILED"]>;
|
|
5
|
+
declare const ConformanceFailure_base: Schema.Class<ConformanceFailure, Schema.TaggedStruct<"ConformanceFailure", {
|
|
6
|
+
readonly code: Schema.Literals<readonly ["OBS_CONFORMANCE_PROFILE_INVALID", "OBS_CONFORMANCE_IDENTITY_INVALID", "OBS_CONFORMANCE_CONTRACT_INVALID", "OBS_CONFORMANCE_MANIFEST_INVALID", "OBS_CONFORMANCE_PRODUCER_INVALID", "OBS_CONFORMANCE_QUERY_INVALID", "OBS_CONFORMANCE_CORRELATION_INVALID", "OBS_CONFORMANCE_POLICY_INVALID", "OBS_CONFORMANCE_EVENT_PATH_INVALID", "OBS_CONFORMANCE_SENTRY_BOUNDARY_INVALID", "OBS_CONFORMANCE_LIFECYCLE_INVALID", "OBS_CONFORMANCE_AUDIT_DURABILITY_MISSING", "OBS_CONFORMANCE_LOCAL_OTLP_PIPELINE", "OBS_CONFORMANCE_TELEMETRY_CANARY_FAILED", "OBS_CONFORMANCE_SENTRY_CANARY_FAILED", "OBS_CONFORMANCE_BROWSER_CANARY_FAILED", "OBS_CONFORMANCE_AUDIT_CANARY_FAILED"]>;
|
|
7
|
+
readonly checkId: Schema.String;
|
|
8
|
+
readonly profile: Schema.String;
|
|
9
|
+
readonly rule: Schema.Struct<{
|
|
10
|
+
readonly document: Schema.String;
|
|
11
|
+
readonly heading: Schema.String;
|
|
12
|
+
}>;
|
|
13
|
+
readonly message: Schema.String;
|
|
14
|
+
readonly offendingValue: Schema.String;
|
|
15
|
+
readonly cause: Schema.Defect;
|
|
16
|
+
}>, import("effect/Cause").YieldableError>;
|
|
17
|
+
export declare class ConformanceFailure extends ConformanceFailure_base {
|
|
18
|
+
}
|
|
19
|
+
declare const InvalidConformanceSuite_base: Schema.Class<InvalidConformanceSuite, Schema.TaggedStruct<"InvalidConformanceSuite", {
|
|
20
|
+
readonly code: Schema.Literals<readonly ["OBS_CONFORMANCE_TARGET_INVALID", "OBS_CONFORMANCE_PROVIDER_DUPLICATE", "OBS_CONFORMANCE_PROVIDER_MISSING"]>;
|
|
21
|
+
readonly message: Schema.String;
|
|
22
|
+
readonly offendingValue: Schema.String;
|
|
23
|
+
readonly cause: Schema.Defect;
|
|
24
|
+
}>, import("effect/Cause").YieldableError>;
|
|
25
|
+
export declare class InvalidConformanceSuite extends InvalidConformanceSuite_base {
|
|
26
|
+
}
|
|
27
|
+
declare const ConformanceAssertionError_base: Schema.Class<ConformanceAssertionError, Schema.TaggedStruct<"ConformanceAssertionError", {
|
|
28
|
+
readonly code: Schema.Literals<readonly ["OBS_CONFORMANCE_NOT_CONFORMANT", "OBS_CONFORMANCE_NEGATIVE_FIXTURE_PASSED", "OBS_CONFORMANCE_EXPECTED_FAILURE_ABSENT"]>;
|
|
29
|
+
readonly message: Schema.String;
|
|
30
|
+
readonly offendingValue: Schema.String;
|
|
31
|
+
readonly cause: Schema.Defect;
|
|
32
|
+
}>, import("effect/Cause").YieldableError>;
|
|
33
|
+
export declare class ConformanceAssertionError extends ConformanceAssertionError_base {
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export const conformanceFailureCodes = [
|
|
3
|
+
"OBS_CONFORMANCE_PROFILE_INVALID",
|
|
4
|
+
"OBS_CONFORMANCE_IDENTITY_INVALID",
|
|
5
|
+
"OBS_CONFORMANCE_CONTRACT_INVALID",
|
|
6
|
+
"OBS_CONFORMANCE_MANIFEST_INVALID",
|
|
7
|
+
"OBS_CONFORMANCE_PRODUCER_INVALID",
|
|
8
|
+
"OBS_CONFORMANCE_QUERY_INVALID",
|
|
9
|
+
"OBS_CONFORMANCE_CORRELATION_INVALID",
|
|
10
|
+
"OBS_CONFORMANCE_POLICY_INVALID",
|
|
11
|
+
"OBS_CONFORMANCE_EVENT_PATH_INVALID",
|
|
12
|
+
"OBS_CONFORMANCE_SENTRY_BOUNDARY_INVALID",
|
|
13
|
+
"OBS_CONFORMANCE_LIFECYCLE_INVALID",
|
|
14
|
+
"OBS_CONFORMANCE_AUDIT_DURABILITY_MISSING",
|
|
15
|
+
"OBS_CONFORMANCE_LOCAL_OTLP_PIPELINE",
|
|
16
|
+
"OBS_CONFORMANCE_TELEMETRY_CANARY_FAILED",
|
|
17
|
+
"OBS_CONFORMANCE_SENTRY_CANARY_FAILED",
|
|
18
|
+
"OBS_CONFORMANCE_BROWSER_CANARY_FAILED",
|
|
19
|
+
"OBS_CONFORMANCE_AUDIT_CANARY_FAILED",
|
|
20
|
+
];
|
|
21
|
+
export const ConformanceFailureCodeSchema = Schema.Literals(conformanceFailureCodes);
|
|
22
|
+
export class ConformanceFailure extends Schema.TaggedError()("ConformanceFailure", {
|
|
23
|
+
code: ConformanceFailureCodeSchema,
|
|
24
|
+
checkId: Schema.String,
|
|
25
|
+
profile: Schema.String,
|
|
26
|
+
rule: Schema.Struct({
|
|
27
|
+
document: Schema.String,
|
|
28
|
+
heading: Schema.String,
|
|
29
|
+
}),
|
|
30
|
+
message: Schema.String,
|
|
31
|
+
offendingValue: Schema.String,
|
|
32
|
+
cause: Schema.Defect(),
|
|
33
|
+
}) {
|
|
34
|
+
}
|
|
35
|
+
export class InvalidConformanceSuite extends Schema.TaggedError()("InvalidConformanceSuite", {
|
|
36
|
+
code: Schema.Literals([
|
|
37
|
+
"OBS_CONFORMANCE_TARGET_INVALID",
|
|
38
|
+
"OBS_CONFORMANCE_PROVIDER_DUPLICATE",
|
|
39
|
+
"OBS_CONFORMANCE_PROVIDER_MISSING",
|
|
40
|
+
]),
|
|
41
|
+
message: Schema.String,
|
|
42
|
+
offendingValue: Schema.String,
|
|
43
|
+
cause: Schema.Defect(),
|
|
44
|
+
}) {
|
|
45
|
+
}
|
|
46
|
+
export class ConformanceAssertionError extends Schema.TaggedError()("ConformanceAssertionError", {
|
|
47
|
+
code: Schema.Literals([
|
|
48
|
+
"OBS_CONFORMANCE_NOT_CONFORMANT",
|
|
49
|
+
"OBS_CONFORMANCE_NEGATIVE_FIXTURE_PASSED",
|
|
50
|
+
"OBS_CONFORMANCE_EXPECTED_FAILURE_ABSENT",
|
|
51
|
+
]),
|
|
52
|
+
message: Schema.String,
|
|
53
|
+
offendingValue: Schema.String,
|
|
54
|
+
cause: Schema.Defect(),
|
|
55
|
+
}) {
|
|
56
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Schema, type Effect } from "effect";
|
|
2
|
+
import type { ContractIndex } from "../../contract/ContractIndex.js";
|
|
3
|
+
import type { ObservabilityProfile, ProfileName } from "../../profile/ObservabilityProfile.js";
|
|
4
|
+
import type { ConformanceFailure } from "./ConformanceFailure.js";
|
|
5
|
+
export type ConformanceCheckId = "profile.official" | "identity.canonical" | "contract.compiles" | "manifest.valid" | "producers.contract-derived" | "queries.contract-derived" | "correlation.canonical" | "policy.compiles" | "server-events.evlog-collector" | "sentry.unexpected-defects-only" | "lifecycle.profile-compliant" | "audit.durable-before-operational" | "pipeline.no-application-otlp" | "canary.telemetry-destination" | "canary.sentry" | "canary.browser-route" | "canary.audit";
|
|
6
|
+
export type SourceRuleReference = {
|
|
7
|
+
readonly document: string;
|
|
8
|
+
readonly heading: string;
|
|
9
|
+
};
|
|
10
|
+
export type ConformanceOwner = "telemetry" | "cli" | "evlog" | "sentry" | "nestjs" | "react" | "application";
|
|
11
|
+
export type ConformanceTopology = "local" | "deployed";
|
|
12
|
+
export type ConformanceCapabilitySelection = {
|
|
13
|
+
readonly traces: boolean;
|
|
14
|
+
readonly metrics: boolean;
|
|
15
|
+
readonly defects: boolean;
|
|
16
|
+
readonly browserIngest: boolean;
|
|
17
|
+
readonly audit: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type ConformanceTargetBinding = {
|
|
20
|
+
readonly identity: {
|
|
21
|
+
readonly serviceName: string;
|
|
22
|
+
readonly serviceVersion: string;
|
|
23
|
+
readonly environment: string;
|
|
24
|
+
};
|
|
25
|
+
readonly contract: ContractIndex;
|
|
26
|
+
readonly producerContractProvenance: string;
|
|
27
|
+
};
|
|
28
|
+
export type ConformanceTargetContext = {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly profile: ObservabilityProfile;
|
|
31
|
+
readonly environment: string;
|
|
32
|
+
readonly topology: ConformanceTopology;
|
|
33
|
+
readonly capabilities: ConformanceCapabilitySelection;
|
|
34
|
+
readonly binding: ConformanceTargetBinding;
|
|
35
|
+
};
|
|
36
|
+
export type ConformanceEvidence = {
|
|
37
|
+
readonly owner: ConformanceOwner;
|
|
38
|
+
readonly receiptType: string;
|
|
39
|
+
readonly receiptId: string;
|
|
40
|
+
readonly summary: string;
|
|
41
|
+
};
|
|
42
|
+
declare const ConformanceViolation_base: Schema.Class<ConformanceViolation, Schema.TaggedStruct<"ConformanceViolation", {
|
|
43
|
+
readonly message: Schema.String;
|
|
44
|
+
readonly offendingValue: Schema.String;
|
|
45
|
+
readonly cause: Schema.Defect;
|
|
46
|
+
}>, import("effect/Cause").YieldableError>;
|
|
47
|
+
export declare class ConformanceViolation extends ConformanceViolation_base {
|
|
48
|
+
}
|
|
49
|
+
export type ConformanceEvidenceProvider<Id extends ConformanceCheckId = ConformanceCheckId> = {
|
|
50
|
+
readonly id: Id;
|
|
51
|
+
readonly owner: ConformanceOwner;
|
|
52
|
+
readonly verify: (target: ConformanceTargetContext) => Effect.Effect<ConformanceEvidence, ConformanceViolation>;
|
|
53
|
+
};
|
|
54
|
+
export type ConformanceTarget = {
|
|
55
|
+
readonly name: string;
|
|
56
|
+
readonly profile: ProfileName;
|
|
57
|
+
readonly environment: string;
|
|
58
|
+
readonly topology: ConformanceTopology;
|
|
59
|
+
readonly capabilities: ConformanceCapabilitySelection;
|
|
60
|
+
readonly binding: ConformanceTargetBinding;
|
|
61
|
+
readonly providers: ReadonlyArray<ConformanceEvidenceProvider>;
|
|
62
|
+
};
|
|
63
|
+
export type ConformancePass = {
|
|
64
|
+
readonly status: "pass";
|
|
65
|
+
readonly id: ConformanceCheckId;
|
|
66
|
+
readonly profile: ProfileName;
|
|
67
|
+
readonly rule: SourceRuleReference;
|
|
68
|
+
readonly evidence: ConformanceEvidence;
|
|
69
|
+
};
|
|
70
|
+
export type ConformanceNotApplicable = {
|
|
71
|
+
readonly status: "not-applicable";
|
|
72
|
+
readonly id: ConformanceCheckId;
|
|
73
|
+
readonly profile: ProfileName;
|
|
74
|
+
readonly rule: SourceRuleReference;
|
|
75
|
+
readonly reason: string;
|
|
76
|
+
};
|
|
77
|
+
export type ConformanceFail = {
|
|
78
|
+
readonly status: "fail";
|
|
79
|
+
readonly id: ConformanceCheckId;
|
|
80
|
+
readonly profile: ProfileName;
|
|
81
|
+
readonly rule: SourceRuleReference;
|
|
82
|
+
readonly failure: ConformanceFailure;
|
|
83
|
+
};
|
|
84
|
+
export type ConformanceResult = ConformancePass | ConformanceFail | ConformanceNotApplicable;
|
|
85
|
+
export type ConformanceProfileReport = {
|
|
86
|
+
readonly target: string;
|
|
87
|
+
readonly profile: ProfileName;
|
|
88
|
+
readonly conforms: boolean;
|
|
89
|
+
readonly checks: ReadonlyArray<ConformanceResult>;
|
|
90
|
+
};
|
|
91
|
+
export type ConformanceReport = {
|
|
92
|
+
readonly version: 1;
|
|
93
|
+
readonly conforms: boolean;
|
|
94
|
+
readonly profiles: ReadonlyArray<ConformanceProfileReport>;
|
|
95
|
+
};
|
|
96
|
+
export declare const defineConformanceEvidenceProvider: <Id extends ConformanceCheckId>(provider: ConformanceEvidenceProvider<Id>) => ConformanceEvidenceProvider<Id>;
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export class ConformanceViolation extends Schema.TaggedError()("ConformanceViolation", {
|
|
3
|
+
message: Schema.String,
|
|
4
|
+
offendingValue: Schema.String,
|
|
5
|
+
cause: Schema.Defect(),
|
|
6
|
+
}) {
|
|
7
|
+
}
|
|
8
|
+
export const defineConformanceEvidenceProvider = (provider) => provider;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Effect } from "effect";
|
|
2
|
+
import type { ConformanceFailureCode } from "./ConformanceFailure.js";
|
|
3
|
+
import type { ConformanceCheckId, ConformanceEvidence, ConformanceEvidenceProvider, ConformanceOwner, ConformanceTargetContext, ConformanceViolation, SourceRuleReference } from "./ConformanceModel.js";
|
|
4
|
+
export type ConformanceCheck = {
|
|
5
|
+
readonly id: ConformanceCheckId;
|
|
6
|
+
readonly owner: ConformanceOwner;
|
|
7
|
+
readonly code: ConformanceFailureCode;
|
|
8
|
+
readonly rule: SourceRuleReference;
|
|
9
|
+
readonly applies: (target: ConformanceTargetContext) => boolean;
|
|
10
|
+
readonly notApplicableReason: (target: ConformanceTargetContext) => string;
|
|
11
|
+
readonly run: (target: ConformanceTargetContext, provider: ConformanceEvidenceProvider<ConformanceCheckId>) => Effect.Effect<ConformanceEvidence, ConformanceViolation>;
|
|
12
|
+
};
|
|
13
|
+
export declare const conformanceChecks: ReadonlyArray<ConformanceCheck>;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
const rule = (document, heading) => ({
|
|
2
|
+
document,
|
|
3
|
+
heading,
|
|
4
|
+
});
|
|
5
|
+
const profilesRule = rule("docs/profiles.md", "Perfis oficiais de observabilidade");
|
|
6
|
+
const nodeConfigRule = rule("docs/profiles.md", "Configuração de Node");
|
|
7
|
+
const contractRule = rule("docs/telemetry-contract.md", "Contrato de telemetria");
|
|
8
|
+
const manifestRule = rule("docs/operations-manifest.md", "Manifesto de operações");
|
|
9
|
+
const emitReceiptRule = rule("docs/telemetry-contract.md", "Recibo de emissão");
|
|
10
|
+
const managedQueriesRule = rule("docs/operations-manifest.md", "Queries gerenciadas");
|
|
11
|
+
const correlationRule = rule("docs/telemetry-contract.md", "Correlação tipada");
|
|
12
|
+
const policyRule = rule("docs/data-policy.md", "Declaração da política");
|
|
13
|
+
const sentryRule = rule("docs/sentry-adapters.md", "Adaptadores Sentry");
|
|
14
|
+
const lifecycleRule = rule("docs/profiles.md", "Ciclo de vida");
|
|
15
|
+
const auditRule = rule("docs/audit.md", "Ordem durável");
|
|
16
|
+
const boundariesRule = rule("docs/coding-standards.md", "Fronteiras do monorepo");
|
|
17
|
+
const canaryRule = rule("docs/testing.md", "Canário do pipeline");
|
|
18
|
+
const browserRule = rule("docs/profiles.md", "Runtime React web");
|
|
19
|
+
const manifestProfiles = new Set(["nestjs-api", "worker", "react-web", "cli"]);
|
|
20
|
+
const serverEventProfiles = new Set(["nestjs-api", "worker", "cli"]);
|
|
21
|
+
const nodeCanaryProfiles = new Set(["nestjs-api", "worker", "cli"]);
|
|
22
|
+
const capabilitiesSummary = (target) => [
|
|
23
|
+
target.capabilities.traces ? "traces" : undefined,
|
|
24
|
+
target.capabilities.metrics ? "metrics" : undefined,
|
|
25
|
+
target.capabilities.defects ? "defects" : undefined,
|
|
26
|
+
target.capabilities.browserIngest ? "browser-ingest" : undefined,
|
|
27
|
+
target.capabilities.audit ? "audit" : undefined,
|
|
28
|
+
]
|
|
29
|
+
.filter((value) => value !== undefined)
|
|
30
|
+
.join(",");
|
|
31
|
+
const notApplicableWithoutCapability = (capability) => (target) => `the target does not select the ${capability} capability (selected: ${capabilitiesSummary(target)})`;
|
|
32
|
+
export const conformanceChecks = Object.freeze([
|
|
33
|
+
{
|
|
34
|
+
id: "profile.official",
|
|
35
|
+
owner: "telemetry",
|
|
36
|
+
code: "OBS_CONFORMANCE_PROFILE_INVALID",
|
|
37
|
+
rule: profilesRule,
|
|
38
|
+
applies: () => true,
|
|
39
|
+
notApplicableReason: () => "every target must prove one official profile",
|
|
40
|
+
run: (target, provider) => provider.verify(target),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "identity.canonical",
|
|
44
|
+
owner: "telemetry",
|
|
45
|
+
code: "OBS_CONFORMANCE_IDENTITY_INVALID",
|
|
46
|
+
rule: nodeConfigRule,
|
|
47
|
+
applies: (target) => target.profile.name !== "library",
|
|
48
|
+
notApplicableReason: () => "the library profile owns no runtime resource identity",
|
|
49
|
+
run: (target, provider) => provider.verify(target),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "contract.compiles",
|
|
53
|
+
owner: "telemetry",
|
|
54
|
+
code: "OBS_CONFORMANCE_CONTRACT_INVALID",
|
|
55
|
+
rule: contractRule,
|
|
56
|
+
applies: () => true,
|
|
57
|
+
notApplicableReason: () => "every application must compile its telemetry contract",
|
|
58
|
+
run: (target, provider) => provider.verify(target),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "manifest.valid",
|
|
62
|
+
owner: "cli",
|
|
63
|
+
code: "OBS_CONFORMANCE_MANIFEST_INVALID",
|
|
64
|
+
rule: manifestRule,
|
|
65
|
+
applies: (target) => manifestProfiles.has(target.profile.name),
|
|
66
|
+
notApplicableReason: () => "the library profile declares no operations manifest",
|
|
67
|
+
run: (target, provider) => provider.verify(target),
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "producers.contract-derived",
|
|
71
|
+
owner: "telemetry",
|
|
72
|
+
code: "OBS_CONFORMANCE_PRODUCER_INVALID",
|
|
73
|
+
rule: emitReceiptRule,
|
|
74
|
+
applies: (target) => target.profile.events !== "forbidden",
|
|
75
|
+
notApplicableReason: () => "the library profile forbids events and producers",
|
|
76
|
+
run: (target, provider) => provider.verify(target),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "queries.contract-derived",
|
|
80
|
+
owner: "cli",
|
|
81
|
+
code: "OBS_CONFORMANCE_QUERY_INVALID",
|
|
82
|
+
rule: managedQueriesRule,
|
|
83
|
+
applies: (target) => manifestProfiles.has(target.profile.name),
|
|
84
|
+
notApplicableReason: () => "the library profile declares no managed queries",
|
|
85
|
+
run: (target, provider) => provider.verify(target),
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "correlation.canonical",
|
|
89
|
+
owner: "telemetry",
|
|
90
|
+
code: "OBS_CONFORMANCE_CORRELATION_INVALID",
|
|
91
|
+
rule: correlationRule,
|
|
92
|
+
applies: (target) => target.profile.events !== "forbidden" || target.profile.traces !== "forbidden",
|
|
93
|
+
notApplicableReason: () => "the library profile emits no events and no traces to correlate",
|
|
94
|
+
run: (target, provider) => provider.verify(target),
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "policy.compiles",
|
|
98
|
+
owner: "telemetry",
|
|
99
|
+
code: "OBS_CONFORMANCE_POLICY_INVALID",
|
|
100
|
+
rule: policyRule,
|
|
101
|
+
applies: (target) => target.profile.events !== "forbidden" ||
|
|
102
|
+
target.profile.traces !== "forbidden" ||
|
|
103
|
+
target.profile.metrics !== "forbidden",
|
|
104
|
+
notApplicableReason: () => "the library profile exports no runtime signals",
|
|
105
|
+
run: (target, provider) => provider.verify(target),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "server-events.evlog-collector",
|
|
109
|
+
owner: "evlog",
|
|
110
|
+
code: "OBS_CONFORMANCE_EVENT_PATH_INVALID",
|
|
111
|
+
rule: nodeConfigRule,
|
|
112
|
+
applies: (target) => serverEventProfiles.has(target.profile.name),
|
|
113
|
+
notApplicableReason: () => "the profile owns no Node server event path through evlog and the Collector",
|
|
114
|
+
run: (target, provider) => provider.verify(target),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "sentry.unexpected-defects-only",
|
|
118
|
+
owner: "sentry",
|
|
119
|
+
code: "OBS_CONFORMANCE_SENTRY_BOUNDARY_INVALID",
|
|
120
|
+
rule: sentryRule,
|
|
121
|
+
applies: (target) => target.capabilities.defects,
|
|
122
|
+
notApplicableReason: notApplicableWithoutCapability("defects"),
|
|
123
|
+
run: (target, provider) => provider.verify(target),
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "lifecycle.profile-compliant",
|
|
127
|
+
owner: "telemetry",
|
|
128
|
+
code: "OBS_CONFORMANCE_LIFECYCLE_INVALID",
|
|
129
|
+
rule: lifecycleRule,
|
|
130
|
+
applies: () => true,
|
|
131
|
+
notApplicableReason: () => "every target proves lifecycle compliance or runtime absence",
|
|
132
|
+
run: (target, provider) => provider.verify(target),
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "audit.durable-before-operational",
|
|
136
|
+
owner: "telemetry",
|
|
137
|
+
code: "OBS_CONFORMANCE_AUDIT_DURABILITY_MISSING",
|
|
138
|
+
rule: auditRule,
|
|
139
|
+
applies: (target) => target.capabilities.audit,
|
|
140
|
+
notApplicableReason: notApplicableWithoutCapability("audit"),
|
|
141
|
+
run: (target, provider) => provider.verify(target),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "pipeline.no-application-otlp",
|
|
145
|
+
owner: "cli",
|
|
146
|
+
code: "OBS_CONFORMANCE_LOCAL_OTLP_PIPELINE",
|
|
147
|
+
rule: boundariesRule,
|
|
148
|
+
applies: () => true,
|
|
149
|
+
notApplicableReason: () => "every application source tree must reject local OTLP pipelines",
|
|
150
|
+
run: (target, provider) => provider.verify(target),
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: "canary.telemetry-destination",
|
|
154
|
+
owner: "telemetry",
|
|
155
|
+
code: "OBS_CONFORMANCE_TELEMETRY_CANARY_FAILED",
|
|
156
|
+
rule: canaryRule,
|
|
157
|
+
applies: (target) => nodeCanaryProfiles.has(target.profile.name) ||
|
|
158
|
+
target.capabilities.traces ||
|
|
159
|
+
target.capabilities.metrics,
|
|
160
|
+
notApplicableReason: () => "the target selects no telemetry signal requiring destination proof",
|
|
161
|
+
run: (target, provider) => provider.verify(target),
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: "canary.sentry",
|
|
165
|
+
owner: "sentry",
|
|
166
|
+
code: "OBS_CONFORMANCE_SENTRY_CANARY_FAILED",
|
|
167
|
+
rule: sentryRule,
|
|
168
|
+
applies: (target) => target.capabilities.defects,
|
|
169
|
+
notApplicableReason: notApplicableWithoutCapability("defects"),
|
|
170
|
+
run: (target, provider) => provider.verify(target),
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: "canary.browser-route",
|
|
174
|
+
owner: "react",
|
|
175
|
+
code: "OBS_CONFORMANCE_BROWSER_CANARY_FAILED",
|
|
176
|
+
rule: browserRule,
|
|
177
|
+
applies: (target) => target.capabilities.browserIngest,
|
|
178
|
+
notApplicableReason: notApplicableWithoutCapability("browser-ingest"),
|
|
179
|
+
run: (target, provider) => provider.verify(target),
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: "canary.audit",
|
|
183
|
+
owner: "telemetry",
|
|
184
|
+
code: "OBS_CONFORMANCE_AUDIT_CANARY_FAILED",
|
|
185
|
+
rule: auditRule,
|
|
186
|
+
applies: (target) => target.capabilities.audit,
|
|
187
|
+
notApplicableReason: notApplicableWithoutCapability("audit"),
|
|
188
|
+
run: (target, provider) => provider.verify(target),
|
|
189
|
+
},
|
|
190
|
+
]);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { InvalidConformanceSuite } from "./ConformanceFailure.js";
|
|
3
|
+
import type { ConformanceProfileReport, ConformanceReport, ConformanceTarget } from "./ConformanceModel.js";
|
|
4
|
+
export declare const runConformance: (target: ConformanceTarget) => Effect.Effect<ConformanceProfileReport, InvalidConformanceSuite>;
|
|
5
|
+
export declare const runConformanceSuite: (targets: ReadonlyArray<ConformanceTarget>) => Effect.Effect<ConformanceReport, InvalidConformanceSuite>;
|