@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,165 @@
|
|
|
1
|
+
export declare const organizationContractVersion = 1;
|
|
2
|
+
export declare const organizationEvents: {
|
|
3
|
+
readonly RequestCompleted: {
|
|
4
|
+
readonly name: "request.completed";
|
|
5
|
+
readonly kind: "request";
|
|
6
|
+
readonly defaultSeverity: "info";
|
|
7
|
+
readonly mandatory: true;
|
|
8
|
+
readonly sampling: {
|
|
9
|
+
readonly kind: "always";
|
|
10
|
+
};
|
|
11
|
+
readonly attributes: {};
|
|
12
|
+
};
|
|
13
|
+
readonly DependencyCall: {
|
|
14
|
+
readonly name: "dependency.call";
|
|
15
|
+
readonly kind: "operation";
|
|
16
|
+
readonly defaultSeverity: "info";
|
|
17
|
+
readonly mandatory: false;
|
|
18
|
+
readonly sampling: {
|
|
19
|
+
readonly kind: "always";
|
|
20
|
+
};
|
|
21
|
+
readonly attributes: {
|
|
22
|
+
"dependency.name": {
|
|
23
|
+
classification: "public";
|
|
24
|
+
required: true;
|
|
25
|
+
metricLabel: true;
|
|
26
|
+
};
|
|
27
|
+
"dependency.operation": {
|
|
28
|
+
classification: "public";
|
|
29
|
+
required: true;
|
|
30
|
+
metricLabel: true;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly LlmCall: {
|
|
35
|
+
readonly name: "llm.call";
|
|
36
|
+
readonly kind: "operation";
|
|
37
|
+
readonly defaultSeverity: "info";
|
|
38
|
+
readonly mandatory: false;
|
|
39
|
+
readonly sampling: {
|
|
40
|
+
readonly kind: "always";
|
|
41
|
+
};
|
|
42
|
+
readonly attributes: {
|
|
43
|
+
"llm.provider": {
|
|
44
|
+
classification: "public";
|
|
45
|
+
required: true;
|
|
46
|
+
metricLabel: true;
|
|
47
|
+
};
|
|
48
|
+
"llm.model": {
|
|
49
|
+
classification: "public";
|
|
50
|
+
required: true;
|
|
51
|
+
metricLabel: true;
|
|
52
|
+
};
|
|
53
|
+
"llm.operation": {
|
|
54
|
+
classification: "public";
|
|
55
|
+
required: true;
|
|
56
|
+
metricLabel: true;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly SchedulerRun: {
|
|
61
|
+
readonly name: "scheduler.run";
|
|
62
|
+
readonly kind: "operation";
|
|
63
|
+
readonly defaultSeverity: "info";
|
|
64
|
+
readonly mandatory: true;
|
|
65
|
+
readonly sampling: {
|
|
66
|
+
readonly kind: "always";
|
|
67
|
+
};
|
|
68
|
+
readonly attributes: {
|
|
69
|
+
"scheduler.job": {
|
|
70
|
+
classification: "public";
|
|
71
|
+
required: true;
|
|
72
|
+
metricLabel: true;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
readonly QueueJob: {
|
|
77
|
+
readonly name: "queue.job";
|
|
78
|
+
readonly kind: "operation";
|
|
79
|
+
readonly defaultSeverity: "info";
|
|
80
|
+
readonly mandatory: false;
|
|
81
|
+
readonly sampling: {
|
|
82
|
+
readonly kind: "always";
|
|
83
|
+
};
|
|
84
|
+
readonly attributes: {
|
|
85
|
+
"queue.name": {
|
|
86
|
+
classification: "public";
|
|
87
|
+
required: true;
|
|
88
|
+
metricLabel: true;
|
|
89
|
+
};
|
|
90
|
+
"queue.job": {
|
|
91
|
+
classification: "public";
|
|
92
|
+
required: true;
|
|
93
|
+
metricLabel: true;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
readonly PaymentAttempt: {
|
|
98
|
+
readonly name: "payment.attempt";
|
|
99
|
+
readonly kind: "operation";
|
|
100
|
+
readonly defaultSeverity: "info";
|
|
101
|
+
readonly mandatory: true;
|
|
102
|
+
readonly sampling: {
|
|
103
|
+
readonly kind: "always";
|
|
104
|
+
};
|
|
105
|
+
readonly attributes: {
|
|
106
|
+
"payment.provider": {
|
|
107
|
+
classification: "public";
|
|
108
|
+
required: true;
|
|
109
|
+
metricLabel: true;
|
|
110
|
+
};
|
|
111
|
+
"payment.operation": {
|
|
112
|
+
classification: "public";
|
|
113
|
+
required: true;
|
|
114
|
+
metricLabel: true;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly UsageRecorded: {
|
|
119
|
+
readonly name: "usage.recorded";
|
|
120
|
+
readonly kind: "domain";
|
|
121
|
+
readonly defaultSeverity: "info";
|
|
122
|
+
readonly mandatory: false;
|
|
123
|
+
readonly sampling: {
|
|
124
|
+
readonly kind: "always";
|
|
125
|
+
};
|
|
126
|
+
readonly attributes: {
|
|
127
|
+
"usage.type": {
|
|
128
|
+
classification: "public";
|
|
129
|
+
required: true;
|
|
130
|
+
metricLabel: true;
|
|
131
|
+
};
|
|
132
|
+
"usage.unit": {
|
|
133
|
+
classification: "public";
|
|
134
|
+
required: true;
|
|
135
|
+
metricLabel: true;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
readonly AuditRecorded: {
|
|
140
|
+
readonly name: "audit.recorded";
|
|
141
|
+
readonly kind: "audit";
|
|
142
|
+
readonly defaultSeverity: "info";
|
|
143
|
+
readonly mandatory: true;
|
|
144
|
+
readonly sampling: {
|
|
145
|
+
readonly kind: "always";
|
|
146
|
+
};
|
|
147
|
+
readonly attributes: {};
|
|
148
|
+
};
|
|
149
|
+
readonly BrowserError: {
|
|
150
|
+
readonly name: "browser.error";
|
|
151
|
+
readonly kind: "defect";
|
|
152
|
+
readonly defaultSeverity: "error";
|
|
153
|
+
readonly mandatory: true;
|
|
154
|
+
readonly sampling: {
|
|
155
|
+
readonly kind: "always";
|
|
156
|
+
};
|
|
157
|
+
readonly attributes: {
|
|
158
|
+
"error.origin": {
|
|
159
|
+
classification: "public";
|
|
160
|
+
required: true;
|
|
161
|
+
metricLabel: true;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { defineEventDefinitions } from "./TelemetryContract.js";
|
|
2
|
+
const publicRequired = {
|
|
3
|
+
classification: "public",
|
|
4
|
+
required: true,
|
|
5
|
+
metricLabel: true,
|
|
6
|
+
};
|
|
7
|
+
export const organizationContractVersion = 1;
|
|
8
|
+
export const organizationEvents = defineEventDefinitions({
|
|
9
|
+
RequestCompleted: {
|
|
10
|
+
name: "request.completed",
|
|
11
|
+
kind: "request",
|
|
12
|
+
defaultSeverity: "info",
|
|
13
|
+
mandatory: true,
|
|
14
|
+
sampling: { kind: "always" },
|
|
15
|
+
attributes: {},
|
|
16
|
+
},
|
|
17
|
+
DependencyCall: {
|
|
18
|
+
name: "dependency.call",
|
|
19
|
+
kind: "operation",
|
|
20
|
+
defaultSeverity: "info",
|
|
21
|
+
mandatory: false,
|
|
22
|
+
sampling: { kind: "always" },
|
|
23
|
+
attributes: {
|
|
24
|
+
"dependency.name": publicRequired,
|
|
25
|
+
"dependency.operation": publicRequired,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
LlmCall: {
|
|
29
|
+
name: "llm.call",
|
|
30
|
+
kind: "operation",
|
|
31
|
+
defaultSeverity: "info",
|
|
32
|
+
mandatory: false,
|
|
33
|
+
sampling: { kind: "always" },
|
|
34
|
+
attributes: {
|
|
35
|
+
"llm.provider": publicRequired,
|
|
36
|
+
"llm.model": publicRequired,
|
|
37
|
+
"llm.operation": publicRequired,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
SchedulerRun: {
|
|
41
|
+
name: "scheduler.run",
|
|
42
|
+
kind: "operation",
|
|
43
|
+
defaultSeverity: "info",
|
|
44
|
+
mandatory: true,
|
|
45
|
+
sampling: { kind: "always" },
|
|
46
|
+
attributes: { "scheduler.job": publicRequired },
|
|
47
|
+
},
|
|
48
|
+
QueueJob: {
|
|
49
|
+
name: "queue.job",
|
|
50
|
+
kind: "operation",
|
|
51
|
+
defaultSeverity: "info",
|
|
52
|
+
mandatory: false,
|
|
53
|
+
sampling: { kind: "always" },
|
|
54
|
+
attributes: {
|
|
55
|
+
"queue.name": publicRequired,
|
|
56
|
+
"queue.job": publicRequired,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
PaymentAttempt: {
|
|
60
|
+
name: "payment.attempt",
|
|
61
|
+
kind: "operation",
|
|
62
|
+
defaultSeverity: "info",
|
|
63
|
+
mandatory: true,
|
|
64
|
+
sampling: { kind: "always" },
|
|
65
|
+
attributes: {
|
|
66
|
+
"payment.provider": publicRequired,
|
|
67
|
+
"payment.operation": publicRequired,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
UsageRecorded: {
|
|
71
|
+
name: "usage.recorded",
|
|
72
|
+
kind: "domain",
|
|
73
|
+
defaultSeverity: "info",
|
|
74
|
+
mandatory: false,
|
|
75
|
+
sampling: { kind: "always" },
|
|
76
|
+
attributes: {
|
|
77
|
+
"usage.type": publicRequired,
|
|
78
|
+
"usage.unit": publicRequired,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
AuditRecorded: {
|
|
82
|
+
name: "audit.recorded",
|
|
83
|
+
kind: "audit",
|
|
84
|
+
defaultSeverity: "info",
|
|
85
|
+
mandatory: true,
|
|
86
|
+
sampling: { kind: "always" },
|
|
87
|
+
attributes: {},
|
|
88
|
+
},
|
|
89
|
+
BrowserError: {
|
|
90
|
+
name: "browser.error",
|
|
91
|
+
kind: "defect",
|
|
92
|
+
defaultSeverity: "error",
|
|
93
|
+
mandatory: true,
|
|
94
|
+
sampling: { kind: "always" },
|
|
95
|
+
attributes: { "error.origin": publicRequired },
|
|
96
|
+
},
|
|
97
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { AuditAction, AuditOutcome } from "../audit/AuditRecord.js";
|
|
3
|
+
import { EventName } from "./EventName.js";
|
|
4
|
+
import { type EventKind as EventKindType, type EventSeverity as EventSeverityType, type EventAttributes } from "./TelemetryEvent.js";
|
|
5
|
+
import { InvalidTelemetryContract, InvalidTelemetryEvent } from "./TelemetryContractError.js";
|
|
6
|
+
import { type CompiledMetricDefinition, type MetricDefinitionsInput } from "./MetricDefinition.js";
|
|
7
|
+
export type { CounterMetricDefinitionInput, HistogramMetricDefinitionInput, MetricAttributeDefinitionInput, MetricDefinitionInput, MetricDefinitionsInput, MetricKind, ObservableGaugeMetricDefinitionInput, } from "./MetricDefinition.js";
|
|
8
|
+
export { isValidMetricName } from "./MetricDefinition.js";
|
|
9
|
+
export declare const AttributeClassification: Schema.Literals<readonly ["public", "internal", "sensitive", "forbidden"]>;
|
|
10
|
+
export type AttributeClassification = typeof AttributeClassification.Type;
|
|
11
|
+
export type AttributeDefinition = {
|
|
12
|
+
readonly classification: AttributeClassification;
|
|
13
|
+
readonly required: boolean;
|
|
14
|
+
readonly metricLabel: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type AttributeDefinitionsInput = {
|
|
17
|
+
readonly [attributeName: string]: AttributeDefinition;
|
|
18
|
+
};
|
|
19
|
+
export type SamplingPolicyInput = {
|
|
20
|
+
readonly kind: "always";
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "rate";
|
|
23
|
+
readonly rate: number;
|
|
24
|
+
};
|
|
25
|
+
export type EventDefinitionInput = {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly kind: EventKindType;
|
|
28
|
+
readonly defaultSeverity: EventSeverityType;
|
|
29
|
+
readonly mandatory: boolean;
|
|
30
|
+
readonly sampling: SamplingPolicyInput;
|
|
31
|
+
readonly attributes: AttributeDefinitionsInput;
|
|
32
|
+
};
|
|
33
|
+
export type EventDefinitionsInput = {
|
|
34
|
+
readonly [alias: string]: EventDefinitionInput;
|
|
35
|
+
};
|
|
36
|
+
export declare const defineEventDefinitions: <const Events extends EventDefinitionsInput>(events: Events) => Events;
|
|
37
|
+
export type AuditActionDefinitionInput = {
|
|
38
|
+
readonly action: string;
|
|
39
|
+
readonly resourceType: string;
|
|
40
|
+
readonly allowedOutcomes: ReadonlyArray<AuditOutcome>;
|
|
41
|
+
readonly reasonCodes?: ReadonlyArray<string>;
|
|
42
|
+
};
|
|
43
|
+
export type AuditActionDefinitionsInput = {
|
|
44
|
+
readonly [alias: string]: AuditActionDefinitionInput;
|
|
45
|
+
};
|
|
46
|
+
export type TelemetryContractInput = {
|
|
47
|
+
readonly version: number;
|
|
48
|
+
readonly events: EventDefinitionsInput;
|
|
49
|
+
readonly metrics: MetricDefinitionsInput;
|
|
50
|
+
readonly auditActions: AuditActionDefinitionsInput;
|
|
51
|
+
};
|
|
52
|
+
export declare const telemetryContractDefinition: <const Definition extends TelemetryContractInput>(definition: Definition) => Definition;
|
|
53
|
+
type StaticEventNames<Definition extends TelemetryContractInput> = {
|
|
54
|
+
readonly events: {
|
|
55
|
+
readonly [Alias in keyof Definition["events"]]: string extends Definition["events"][Alias]["name"] ? never : Definition["events"][Alias];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export type CompiledEventDefinition = {
|
|
59
|
+
readonly alias: string;
|
|
60
|
+
readonly name: EventName;
|
|
61
|
+
readonly kind: EventKindType;
|
|
62
|
+
readonly defaultSeverity: EventSeverityType;
|
|
63
|
+
readonly mandatory: boolean;
|
|
64
|
+
readonly sampling: SamplingPolicyInput;
|
|
65
|
+
readonly attributes: ReadonlyMap<string, AttributeDefinition>;
|
|
66
|
+
readonly requiredAttributes: ReadonlyArray<string>;
|
|
67
|
+
};
|
|
68
|
+
export type AuditActionDefinition = {
|
|
69
|
+
readonly action: AuditAction;
|
|
70
|
+
readonly resourceType: string;
|
|
71
|
+
readonly allowedOutcomes: ReadonlyArray<AuditOutcome>;
|
|
72
|
+
readonly reasonCodes: ReadonlyArray<string>;
|
|
73
|
+
};
|
|
74
|
+
export type CompiledAuditActionDefinition = AuditActionDefinition & {
|
|
75
|
+
readonly alias: string;
|
|
76
|
+
};
|
|
77
|
+
export type EventContractRegistry = {
|
|
78
|
+
readonly eventByName: ReadonlyMap<EventName, CompiledEventDefinition>;
|
|
79
|
+
};
|
|
80
|
+
export declare const validateContractEvent: (contract: EventContractRegistry, eventName: string, attributes: EventAttributes) => CompiledEventDefinition | InvalidTelemetryEvent;
|
|
81
|
+
export type TelemetryContract<Definition extends TelemetryContractInput> = {
|
|
82
|
+
readonly version: number;
|
|
83
|
+
readonly definition: Definition;
|
|
84
|
+
readonly provenance: string;
|
|
85
|
+
readonly eventNames: ReadonlyArray<EventName>;
|
|
86
|
+
readonly eventByAlias: ReadonlyMap<string, CompiledEventDefinition>;
|
|
87
|
+
readonly eventByName: ReadonlyMap<EventName, CompiledEventDefinition>;
|
|
88
|
+
readonly auditActionByAlias: ReadonlyMap<string, CompiledAuditActionDefinition>;
|
|
89
|
+
readonly auditActionByName: ReadonlyMap<string, CompiledAuditActionDefinition>;
|
|
90
|
+
readonly metrics: Definition["metrics"];
|
|
91
|
+
readonly metricByAlias: ReadonlyMap<string, CompiledMetricDefinition>;
|
|
92
|
+
readonly metricByName: ReadonlyMap<string, CompiledMetricDefinition>;
|
|
93
|
+
};
|
|
94
|
+
export declare const telemetryContractProvenance: <Definition extends TelemetryContractInput>(contract: TelemetryContract<Definition>) => string;
|
|
95
|
+
export declare const defineTelemetryContract: <const Definition extends TelemetryContractInput>(definition: Definition & StaticEventNames<Definition>) => Effect.Effect<TelemetryContract<Definition>, InvalidTelemetryContract, never>;
|