@kopai/core 0.0.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.
- package/LICENSE +190 -0
- package/dist/chunk-Bo1DHCg-.mjs +18 -0
- package/dist/index.cjs +1052 -0
- package/dist/index.d.cts +2888 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +2888 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +971 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +45 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1052 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __exportAll = (all, symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) {
|
|
11
|
+
__defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (symbols) {
|
|
17
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
+
key = keys[i];
|
|
25
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
+
__defProp(to, key, {
|
|
27
|
+
get: ((k) => from[k]).bind(null, key),
|
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
36
|
+
value: mod,
|
|
37
|
+
enumerable: true
|
|
38
|
+
}) : target, mod));
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
let zod = require("zod");
|
|
42
|
+
zod = __toESM(zod);
|
|
43
|
+
|
|
44
|
+
//#region src/denormalized-signals-zod.ts
|
|
45
|
+
var denormalized_signals_zod_exports = /* @__PURE__ */ __exportAll({
|
|
46
|
+
otelExponentialHistogramSchema: () => otelExponentialHistogramSchema,
|
|
47
|
+
otelGaugeSchema: () => otelGaugeSchema,
|
|
48
|
+
otelHistogramSchema: () => otelHistogramSchema,
|
|
49
|
+
otelLogsSchema: () => otelLogsSchema,
|
|
50
|
+
otelMetricsSchema: () => otelMetricsSchema,
|
|
51
|
+
otelSumSchema: () => otelSumSchema,
|
|
52
|
+
otelSummarySchema: () => otelSummarySchema,
|
|
53
|
+
otelTracesSchema: () => otelTracesSchema
|
|
54
|
+
});
|
|
55
|
+
const attributeValue = zod.z.union([
|
|
56
|
+
zod.z.string(),
|
|
57
|
+
zod.z.number(),
|
|
58
|
+
zod.z.boolean()
|
|
59
|
+
]);
|
|
60
|
+
const otelTracesSchema = zod.z.object({
|
|
61
|
+
SpanId: zod.z.string().describe("Unique identifier for a span within a trace. The ID is an 8-byte array."),
|
|
62
|
+
Timestamp: zod.z.string().describe("Start time of the span. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON."),
|
|
63
|
+
TraceId: zod.z.string().describe("Unique identifier for a trace. All spans from the same trace share the same trace_id. The ID is a 16-byte array."),
|
|
64
|
+
Duration: zod.z.string().optional().describe("Duration of the span in nanoseconds (end_time - start_time). Expressed as string in JSON."),
|
|
65
|
+
"Events.Attributes": zod.z.array(zod.z.record(zod.z.string(), attributeValue)).optional().describe("Attribute key/value pairs on the event (one object per event)."),
|
|
66
|
+
"Events.Name": zod.z.array(zod.z.string()).optional().describe("Name of the event. Semantically required to be non-empty."),
|
|
67
|
+
"Events.Timestamp": zod.z.array(zod.z.string()).optional().describe("Time the event occurred (nanoseconds). Expressed as strings in JSON."),
|
|
68
|
+
"Links.Attributes": zod.z.array(zod.z.record(zod.z.string(), attributeValue)).optional().describe("Attribute key/value pairs on the link (one object per link)."),
|
|
69
|
+
"Links.SpanId": zod.z.array(zod.z.string()).optional().describe("Unique identifier for the linked span. The ID is an 8-byte array."),
|
|
70
|
+
"Links.TraceId": zod.z.array(zod.z.string()).optional().describe("Unique identifier of a trace that the linked span is part of. The ID is a 16-byte array."),
|
|
71
|
+
"Links.TraceState": zod.z.array(zod.z.string()).optional().describe("The trace_state associated with the link."),
|
|
72
|
+
ParentSpanId: zod.z.string().optional().describe("The span_id of this span's parent span. Empty if this is a root span."),
|
|
73
|
+
ResourceAttributes: zod.z.record(zod.z.string(), attributeValue).optional().describe("Attributes that describe the resource."),
|
|
74
|
+
ScopeName: zod.z.string().optional().describe("Name denoting the instrumentation scope."),
|
|
75
|
+
ScopeVersion: zod.z.string().optional().describe("Version of the instrumentation scope."),
|
|
76
|
+
ServiceName: zod.z.string().optional().describe("Service name from resource attributes (service.name)."),
|
|
77
|
+
SpanAttributes: zod.z.record(zod.z.string(), attributeValue).optional().describe("Key/value pairs describing the span."),
|
|
78
|
+
SpanKind: zod.z.string().optional().describe("Type of span (INTERNAL, SERVER, CLIENT, PRODUCER, CONSUMER). Used to identify relationships between spans."),
|
|
79
|
+
SpanName: zod.z.string().optional().describe("Description of the span's operation. E.g., qualified method name or file name with line number."),
|
|
80
|
+
StatusCode: zod.z.string().optional().describe("Status code (UNSET, OK, ERROR)."),
|
|
81
|
+
StatusMessage: zod.z.string().optional().describe("Developer-facing human readable error message."),
|
|
82
|
+
TraceState: zod.z.string().optional().describe("Conveys information about request position in multiple distributed tracing graphs. W3C trace-context format.")
|
|
83
|
+
});
|
|
84
|
+
const otelLogsSchema = zod.z.object({
|
|
85
|
+
Timestamp: zod.z.string().describe("Time when the event occurred. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON."),
|
|
86
|
+
Body: zod.z.string().optional().describe("Body of the log record. Can be a human-readable string message or structured data."),
|
|
87
|
+
LogAttributes: zod.z.record(zod.z.string(), attributeValue).optional().describe("Additional attributes that describe the specific event occurrence."),
|
|
88
|
+
ResourceAttributes: zod.z.record(zod.z.string(), attributeValue).optional().describe("Attributes that describe the resource."),
|
|
89
|
+
ResourceSchemaUrl: zod.z.string().optional().describe("Schema URL for the resource data."),
|
|
90
|
+
ScopeAttributes: zod.z.record(zod.z.string(), attributeValue).optional().describe("Attributes of the instrumentation scope."),
|
|
91
|
+
ScopeName: zod.z.string().optional().describe("Name denoting the instrumentation scope."),
|
|
92
|
+
ScopeSchemaUrl: zod.z.string().optional().describe("Schema URL for the scope data."),
|
|
93
|
+
ScopeVersion: zod.z.string().optional().describe("Version of the instrumentation scope."),
|
|
94
|
+
ServiceName: zod.z.string().optional().describe("Service name from resource attributes (service.name)."),
|
|
95
|
+
SeverityNumber: zod.z.number().optional().describe("Numerical value of the severity, normalized to values described in Log Data Model."),
|
|
96
|
+
SeverityText: zod.z.string().optional().describe("Severity text (also known as log level). Original string representation as known at the source."),
|
|
97
|
+
SpanId: zod.z.string().optional().describe("Unique identifier for a span within a trace. The ID is an 8-byte array."),
|
|
98
|
+
TraceFlags: zod.z.number().optional().describe("Bit field. 8 least significant bits are trace flags as defined in W3C Trace Context."),
|
|
99
|
+
TraceId: zod.z.string().optional().describe("Unique identifier for a trace. All logs from the same trace share the same trace_id. The ID is a 16-byte array.")
|
|
100
|
+
});
|
|
101
|
+
const metricsBaseSchema = zod.z.object({
|
|
102
|
+
TimeUnix: zod.z.string().describe("Time when the data point was recorded. UNIX Epoch time in nanoseconds. Expressed as string in JSON."),
|
|
103
|
+
StartTimeUnix: zod.z.string().describe("Start time for cumulative/delta metrics. UNIX Epoch time in nanoseconds. Expressed as string in JSON."),
|
|
104
|
+
Attributes: zod.z.record(zod.z.string(), attributeValue).optional().describe("Key/value pairs that uniquely identify the timeseries."),
|
|
105
|
+
MetricName: zod.z.string().optional().describe("The name of the metric."),
|
|
106
|
+
MetricDescription: zod.z.string().optional().describe("A description of the metric, which can be used in documentation."),
|
|
107
|
+
MetricUnit: zod.z.string().optional().describe("The unit in which the metric value is reported (UCUM format)."),
|
|
108
|
+
ResourceAttributes: zod.z.record(zod.z.string(), attributeValue).optional().describe("Attributes that describe the resource."),
|
|
109
|
+
ResourceSchemaUrl: zod.z.string().optional().describe("Schema URL for the resource data."),
|
|
110
|
+
ScopeAttributes: zod.z.record(zod.z.string(), attributeValue).optional().describe("Attributes of the instrumentation scope."),
|
|
111
|
+
ScopeDroppedAttrCount: zod.z.number().optional().describe("Number of attributes dropped from the scope."),
|
|
112
|
+
ScopeName: zod.z.string().optional().describe("Name denoting the instrumentation scope."),
|
|
113
|
+
ScopeSchemaUrl: zod.z.string().optional().describe("Schema URL for the scope data."),
|
|
114
|
+
ScopeVersion: zod.z.string().optional().describe("Version of the instrumentation scope."),
|
|
115
|
+
ServiceName: zod.z.string().optional().describe("Service name from resource attributes (service.name)."),
|
|
116
|
+
"Exemplars.FilteredAttributes": zod.z.array(zod.z.record(zod.z.string(), attributeValue)).optional().describe("Filtered attributes of exemplars."),
|
|
117
|
+
"Exemplars.SpanId": zod.z.array(zod.z.string()).optional().describe("Span IDs associated with exemplars."),
|
|
118
|
+
"Exemplars.TimeUnix": zod.z.array(zod.z.string()).optional().describe("Timestamps of exemplars (nanoseconds). Expressed as strings in JSON."),
|
|
119
|
+
"Exemplars.TraceId": zod.z.array(zod.z.string()).optional().describe("Trace IDs associated with exemplars."),
|
|
120
|
+
"Exemplars.Value": zod.z.array(zod.z.number()).optional().describe("Values of exemplars.")
|
|
121
|
+
});
|
|
122
|
+
const otelGaugeSchema = metricsBaseSchema.extend({
|
|
123
|
+
MetricType: zod.z.literal("Gauge").describe("Gauge metric type."),
|
|
124
|
+
Value: zod.z.number().describe("Current scalar value."),
|
|
125
|
+
Flags: zod.z.number().optional().describe("Flags that apply to this data point (see DataPointFlags).")
|
|
126
|
+
});
|
|
127
|
+
const otelSumSchema = metricsBaseSchema.extend({
|
|
128
|
+
MetricType: zod.z.literal("Sum").describe("Sum metric type."),
|
|
129
|
+
Value: zod.z.number().describe("Scalar sum value."),
|
|
130
|
+
Flags: zod.z.number().optional().describe("Flags that apply to this data point (see DataPointFlags)."),
|
|
131
|
+
AggTemporality: zod.z.string().optional().describe("Aggregation temporality (DELTA or CUMULATIVE)."),
|
|
132
|
+
IsMonotonic: zod.z.number().optional().describe("Whether the sum is monotonic (0 = false, 1 = true).")
|
|
133
|
+
});
|
|
134
|
+
const otelHistogramSchema = metricsBaseSchema.extend({
|
|
135
|
+
MetricType: zod.z.literal("Histogram").describe("Histogram metric type."),
|
|
136
|
+
Count: zod.z.number().optional().describe("Number of values in the histogram."),
|
|
137
|
+
Sum: zod.z.number().optional().describe("Sum of all values."),
|
|
138
|
+
Min: zod.z.number().nullable().optional().describe("Minimum value recorded."),
|
|
139
|
+
Max: zod.z.number().nullable().optional().describe("Maximum value recorded."),
|
|
140
|
+
BucketCounts: zod.z.array(zod.z.number()).optional().describe("Count of values in each bucket."),
|
|
141
|
+
ExplicitBounds: zod.z.array(zod.z.number()).optional().describe("Bucket boundaries."),
|
|
142
|
+
AggTemporality: zod.z.string().optional().describe("Aggregation temporality (DELTA or CUMULATIVE).")
|
|
143
|
+
});
|
|
144
|
+
const otelExponentialHistogramSchema = metricsBaseSchema.extend({
|
|
145
|
+
MetricType: zod.z.literal("ExponentialHistogram").describe("Exponential histogram metric type."),
|
|
146
|
+
Count: zod.z.number().optional().describe("Number of values in the histogram."),
|
|
147
|
+
Sum: zod.z.number().optional().describe("Sum of all values."),
|
|
148
|
+
Min: zod.z.number().nullable().optional().describe("Minimum value recorded."),
|
|
149
|
+
Max: zod.z.number().nullable().optional().describe("Maximum value recorded."),
|
|
150
|
+
Scale: zod.z.number().optional().describe("Resolution of the histogram. Boundaries are at powers of base."),
|
|
151
|
+
ZeroCount: zod.z.number().optional().describe("Count of values that are exactly zero."),
|
|
152
|
+
PositiveBucketCounts: zod.z.array(zod.z.number()).optional().describe("Counts for positive value buckets."),
|
|
153
|
+
PositiveOffset: zod.z.number().optional().describe("Offset for positive bucket indices."),
|
|
154
|
+
NegativeBucketCounts: zod.z.array(zod.z.number()).optional().describe("Counts for negative value buckets."),
|
|
155
|
+
NegativeOffset: zod.z.number().optional().describe("Offset for negative bucket indices."),
|
|
156
|
+
AggTemporality: zod.z.string().optional().describe("Aggregation temporality (DELTA or CUMULATIVE).")
|
|
157
|
+
});
|
|
158
|
+
const otelSummarySchema = metricsBaseSchema.extend({
|
|
159
|
+
MetricType: zod.z.literal("Summary").describe("Summary metric type."),
|
|
160
|
+
Count: zod.z.number().optional().describe("Number of values in the summary."),
|
|
161
|
+
Sum: zod.z.number().optional().describe("Sum of all values."),
|
|
162
|
+
"ValueAtQuantiles.Quantile": zod.z.array(zod.z.number()).optional().describe("Quantile values (0.0 to 1.0)."),
|
|
163
|
+
"ValueAtQuantiles.Value": zod.z.array(zod.z.number()).optional().describe("Values at each quantile.")
|
|
164
|
+
});
|
|
165
|
+
const otelMetricsSchema = zod.z.discriminatedUnion("MetricType", [
|
|
166
|
+
otelGaugeSchema,
|
|
167
|
+
otelSumSchema,
|
|
168
|
+
otelHistogramSchema,
|
|
169
|
+
otelExponentialHistogramSchema,
|
|
170
|
+
otelSummarySchema
|
|
171
|
+
]);
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/telemetry-datasource.ts
|
|
175
|
+
var telemetry_datasource_exports = {};
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/otlp-generated.ts
|
|
179
|
+
var otlp_generated_exports = /* @__PURE__ */ __exportAll({
|
|
180
|
+
AggregationTemporality: () => AggregationTemporality,
|
|
181
|
+
DataPointFlags: () => DataPointFlags,
|
|
182
|
+
LogRecordFlags: () => LogRecordFlags,
|
|
183
|
+
SeverityNumber: () => SeverityNumber,
|
|
184
|
+
SpanFlags: () => SpanFlags,
|
|
185
|
+
SpanKind: () => SpanKind,
|
|
186
|
+
StatusCode: () => StatusCode
|
|
187
|
+
});
|
|
188
|
+
/**
|
|
189
|
+
* SpanFlags represents constants used to interpret the
|
|
190
|
+
* Span.flags field, which is protobuf 'fixed32' type and is to
|
|
191
|
+
* be used as bit-fields. Each non-zero value defined in this enum is
|
|
192
|
+
* a bit-mask. To extract the bit-field, for example, use an
|
|
193
|
+
* expression like:
|
|
194
|
+
*
|
|
195
|
+
* (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)
|
|
196
|
+
*
|
|
197
|
+
* See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
|
|
198
|
+
*
|
|
199
|
+
* Note that Span flags were introduced in version 1.1 of the
|
|
200
|
+
* OpenTelemetry protocol. Older Span producers do not set this
|
|
201
|
+
* field, consequently consumers should not rely on the absence of a
|
|
202
|
+
* particular flag bit to indicate the presence of a particular feature.
|
|
203
|
+
*/
|
|
204
|
+
let SpanFlags = /* @__PURE__ */ function(SpanFlags) {
|
|
205
|
+
/**
|
|
206
|
+
* SPAN_FLAGS_DO_NOT_USE - The zero value for the enum. Should not be used for comparisons.
|
|
207
|
+
* Instead use bitwise "and" with the appropriate mask as shown above.
|
|
208
|
+
*/
|
|
209
|
+
SpanFlags[SpanFlags["SPAN_FLAGS_DO_NOT_USE"] = 0] = "SPAN_FLAGS_DO_NOT_USE";
|
|
210
|
+
/** SPAN_FLAGS_TRACE_FLAGS_MASK - Bits 0-7 are used for trace flags. */
|
|
211
|
+
SpanFlags[SpanFlags["SPAN_FLAGS_TRACE_FLAGS_MASK"] = 255] = "SPAN_FLAGS_TRACE_FLAGS_MASK";
|
|
212
|
+
/**
|
|
213
|
+
* SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK - Bits 8 and 9 are used to indicate that the parent span or link span is remote.
|
|
214
|
+
* Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.
|
|
215
|
+
* Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.
|
|
216
|
+
*/
|
|
217
|
+
SpanFlags[SpanFlags["SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK"] = 256] = "SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK";
|
|
218
|
+
SpanFlags[SpanFlags["SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK"] = 512] = "SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK";
|
|
219
|
+
SpanFlags[SpanFlags["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
220
|
+
return SpanFlags;
|
|
221
|
+
}({});
|
|
222
|
+
/**
|
|
223
|
+
* SpanKind is the type of span. Can be used to specify additional relationships between spans
|
|
224
|
+
* in addition to a parent/child relationship.
|
|
225
|
+
*/
|
|
226
|
+
let SpanKind = /* @__PURE__ */ function(SpanKind) {
|
|
227
|
+
/**
|
|
228
|
+
* SPAN_KIND_UNSPECIFIED - Unspecified. Do NOT use as default.
|
|
229
|
+
* Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED.
|
|
230
|
+
*/
|
|
231
|
+
SpanKind[SpanKind["SPAN_KIND_UNSPECIFIED"] = 0] = "SPAN_KIND_UNSPECIFIED";
|
|
232
|
+
/**
|
|
233
|
+
* SPAN_KIND_INTERNAL - Indicates that the span represents an internal operation within an application,
|
|
234
|
+
* as opposed to an operation happening at the boundaries. Default value.
|
|
235
|
+
*/
|
|
236
|
+
SpanKind[SpanKind["SPAN_KIND_INTERNAL"] = 1] = "SPAN_KIND_INTERNAL";
|
|
237
|
+
/**
|
|
238
|
+
* SPAN_KIND_SERVER - Indicates that the span covers server-side handling of an RPC or other
|
|
239
|
+
* remote network request.
|
|
240
|
+
*/
|
|
241
|
+
SpanKind[SpanKind["SPAN_KIND_SERVER"] = 2] = "SPAN_KIND_SERVER";
|
|
242
|
+
/** SPAN_KIND_CLIENT - Indicates that the span describes a request to some remote service. */
|
|
243
|
+
SpanKind[SpanKind["SPAN_KIND_CLIENT"] = 3] = "SPAN_KIND_CLIENT";
|
|
244
|
+
/**
|
|
245
|
+
* SPAN_KIND_PRODUCER - Indicates that the span describes a producer sending a message to a broker.
|
|
246
|
+
* Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
|
|
247
|
+
* between producer and consumer spans. A PRODUCER span ends when the message was accepted
|
|
248
|
+
* by the broker while the logical processing of the message might span a much longer time.
|
|
249
|
+
*/
|
|
250
|
+
SpanKind[SpanKind["SPAN_KIND_PRODUCER"] = 4] = "SPAN_KIND_PRODUCER";
|
|
251
|
+
/**
|
|
252
|
+
* SPAN_KIND_CONSUMER - Indicates that the span describes consumer receiving a message from a broker.
|
|
253
|
+
* Like the PRODUCER kind, there is often no direct critical path latency relationship
|
|
254
|
+
* between producer and consumer spans.
|
|
255
|
+
*/
|
|
256
|
+
SpanKind[SpanKind["SPAN_KIND_CONSUMER"] = 5] = "SPAN_KIND_CONSUMER";
|
|
257
|
+
SpanKind[SpanKind["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
258
|
+
return SpanKind;
|
|
259
|
+
}({});
|
|
260
|
+
/**
|
|
261
|
+
* For the semantics of status codes see
|
|
262
|
+
* https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
|
|
263
|
+
*/
|
|
264
|
+
let StatusCode = /* @__PURE__ */ function(StatusCode) {
|
|
265
|
+
/** STATUS_CODE_UNSET - The default status. */
|
|
266
|
+
StatusCode[StatusCode["STATUS_CODE_UNSET"] = 0] = "STATUS_CODE_UNSET";
|
|
267
|
+
/**
|
|
268
|
+
* STATUS_CODE_OK - The Span has been validated by an Application developer or Operator to
|
|
269
|
+
* have completed successfully.
|
|
270
|
+
*/
|
|
271
|
+
StatusCode[StatusCode["STATUS_CODE_OK"] = 1] = "STATUS_CODE_OK";
|
|
272
|
+
/** STATUS_CODE_ERROR - The Span contains an error. */
|
|
273
|
+
StatusCode[StatusCode["STATUS_CODE_ERROR"] = 2] = "STATUS_CODE_ERROR";
|
|
274
|
+
StatusCode[StatusCode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
275
|
+
return StatusCode;
|
|
276
|
+
}({});
|
|
277
|
+
/** Possible values for LogRecord.SeverityNumber. */
|
|
278
|
+
let SeverityNumber = /* @__PURE__ */ function(SeverityNumber) {
|
|
279
|
+
/** SEVERITY_NUMBER_UNSPECIFIED - UNSPECIFIED is the default SeverityNumber, it MUST NOT be used. */
|
|
280
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_UNSPECIFIED"] = 0] = "SEVERITY_NUMBER_UNSPECIFIED";
|
|
281
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_TRACE"] = 1] = "SEVERITY_NUMBER_TRACE";
|
|
282
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_TRACE2"] = 2] = "SEVERITY_NUMBER_TRACE2";
|
|
283
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_TRACE3"] = 3] = "SEVERITY_NUMBER_TRACE3";
|
|
284
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_TRACE4"] = 4] = "SEVERITY_NUMBER_TRACE4";
|
|
285
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_DEBUG"] = 5] = "SEVERITY_NUMBER_DEBUG";
|
|
286
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_DEBUG2"] = 6] = "SEVERITY_NUMBER_DEBUG2";
|
|
287
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_DEBUG3"] = 7] = "SEVERITY_NUMBER_DEBUG3";
|
|
288
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_DEBUG4"] = 8] = "SEVERITY_NUMBER_DEBUG4";
|
|
289
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_INFO"] = 9] = "SEVERITY_NUMBER_INFO";
|
|
290
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_INFO2"] = 10] = "SEVERITY_NUMBER_INFO2";
|
|
291
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_INFO3"] = 11] = "SEVERITY_NUMBER_INFO3";
|
|
292
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_INFO4"] = 12] = "SEVERITY_NUMBER_INFO4";
|
|
293
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_WARN"] = 13] = "SEVERITY_NUMBER_WARN";
|
|
294
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_WARN2"] = 14] = "SEVERITY_NUMBER_WARN2";
|
|
295
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_WARN3"] = 15] = "SEVERITY_NUMBER_WARN3";
|
|
296
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_WARN4"] = 16] = "SEVERITY_NUMBER_WARN4";
|
|
297
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_ERROR"] = 17] = "SEVERITY_NUMBER_ERROR";
|
|
298
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_ERROR2"] = 18] = "SEVERITY_NUMBER_ERROR2";
|
|
299
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_ERROR3"] = 19] = "SEVERITY_NUMBER_ERROR3";
|
|
300
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_ERROR4"] = 20] = "SEVERITY_NUMBER_ERROR4";
|
|
301
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_FATAL"] = 21] = "SEVERITY_NUMBER_FATAL";
|
|
302
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_FATAL2"] = 22] = "SEVERITY_NUMBER_FATAL2";
|
|
303
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_FATAL3"] = 23] = "SEVERITY_NUMBER_FATAL3";
|
|
304
|
+
SeverityNumber[SeverityNumber["SEVERITY_NUMBER_FATAL4"] = 24] = "SEVERITY_NUMBER_FATAL4";
|
|
305
|
+
SeverityNumber[SeverityNumber["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
306
|
+
return SeverityNumber;
|
|
307
|
+
}({});
|
|
308
|
+
/**
|
|
309
|
+
* LogRecordFlags represents constants used to interpret the
|
|
310
|
+
* LogRecord.flags field, which is protobuf 'fixed32' type and is to
|
|
311
|
+
* be used as bit-fields. Each non-zero value defined in this enum is
|
|
312
|
+
* a bit-mask. To extract the bit-field, for example, use an
|
|
313
|
+
* expression like:
|
|
314
|
+
*
|
|
315
|
+
* (logRecord.flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK)
|
|
316
|
+
*/
|
|
317
|
+
let LogRecordFlags = /* @__PURE__ */ function(LogRecordFlags) {
|
|
318
|
+
/**
|
|
319
|
+
* LOG_RECORD_FLAGS_DO_NOT_USE - The zero value for the enum. Should not be used for comparisons.
|
|
320
|
+
* Instead use bitwise "and" with the appropriate mask as shown above.
|
|
321
|
+
*/
|
|
322
|
+
LogRecordFlags[LogRecordFlags["LOG_RECORD_FLAGS_DO_NOT_USE"] = 0] = "LOG_RECORD_FLAGS_DO_NOT_USE";
|
|
323
|
+
/** LOG_RECORD_FLAGS_TRACE_FLAGS_MASK - Bits 0-7 are used for trace flags. */
|
|
324
|
+
LogRecordFlags[LogRecordFlags["LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"] = 255] = "LOG_RECORD_FLAGS_TRACE_FLAGS_MASK";
|
|
325
|
+
LogRecordFlags[LogRecordFlags["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
326
|
+
return LogRecordFlags;
|
|
327
|
+
}({});
|
|
328
|
+
/**
|
|
329
|
+
* AggregationTemporality defines how a metric aggregator reports aggregated
|
|
330
|
+
* values. It describes how those values relate to the time interval over
|
|
331
|
+
* which they are aggregated.
|
|
332
|
+
*/
|
|
333
|
+
let AggregationTemporality = /* @__PURE__ */ function(AggregationTemporality) {
|
|
334
|
+
/** AGGREGATION_TEMPORALITY_UNSPECIFIED - UNSPECIFIED is the default AggregationTemporality, it MUST not be used. */
|
|
335
|
+
AggregationTemporality[AggregationTemporality["AGGREGATION_TEMPORALITY_UNSPECIFIED"] = 0] = "AGGREGATION_TEMPORALITY_UNSPECIFIED";
|
|
336
|
+
/**
|
|
337
|
+
* AGGREGATION_TEMPORALITY_DELTA - DELTA is an AggregationTemporality for a metric aggregator which reports
|
|
338
|
+
* changes since last report time. Successive metrics contain aggregation of
|
|
339
|
+
* values from continuous and non-overlapping intervals.
|
|
340
|
+
*
|
|
341
|
+
* The values for a DELTA metric are based only on the time interval
|
|
342
|
+
* associated with one measurement cycle. There is no dependency on
|
|
343
|
+
* previous measurements like is the case for CUMULATIVE metrics.
|
|
344
|
+
*
|
|
345
|
+
* For example, consider a system measuring the number of requests that
|
|
346
|
+
* it receives and reports the sum of these requests every second as a
|
|
347
|
+
* DELTA metric:
|
|
348
|
+
*
|
|
349
|
+
* 1. The system starts receiving at time=t_0.
|
|
350
|
+
* 2. A request is received, the system measures 1 request.
|
|
351
|
+
* 3. A request is received, the system measures 1 request.
|
|
352
|
+
* 4. A request is received, the system measures 1 request.
|
|
353
|
+
* 5. The 1 second collection cycle ends. A metric is exported for the
|
|
354
|
+
* number of requests received over the interval of time t_0 to
|
|
355
|
+
* t_0+1 with a value of 3.
|
|
356
|
+
* 6. A request is received, the system measures 1 request.
|
|
357
|
+
* 7. A request is received, the system measures 1 request.
|
|
358
|
+
* 8. The 1 second collection cycle ends. A metric is exported for the
|
|
359
|
+
* number of requests received over the interval of time t_0+1 to
|
|
360
|
+
* t_0+2 with a value of 2.
|
|
361
|
+
*/
|
|
362
|
+
AggregationTemporality[AggregationTemporality["AGGREGATION_TEMPORALITY_DELTA"] = 1] = "AGGREGATION_TEMPORALITY_DELTA";
|
|
363
|
+
/**
|
|
364
|
+
* AGGREGATION_TEMPORALITY_CUMULATIVE - CUMULATIVE is an AggregationTemporality for a metric aggregator which
|
|
365
|
+
* reports changes since a fixed start time. This means that current values
|
|
366
|
+
* of a CUMULATIVE metric depend on all previous measurements since the
|
|
367
|
+
* start time. Because of this, the sender is required to retain this state
|
|
368
|
+
* in some form. If this state is lost or invalidated, the CUMULATIVE metric
|
|
369
|
+
* values MUST be reset and a new fixed start time following the last
|
|
370
|
+
* reported measurement time sent MUST be used.
|
|
371
|
+
*
|
|
372
|
+
* For example, consider a system measuring the number of requests that
|
|
373
|
+
* it receives and reports the sum of these requests every second as a
|
|
374
|
+
* CUMULATIVE metric:
|
|
375
|
+
*
|
|
376
|
+
* 1. The system starts receiving at time=t_0.
|
|
377
|
+
* 2. A request is received, the system measures 1 request.
|
|
378
|
+
* 3. A request is received, the system measures 1 request.
|
|
379
|
+
* 4. A request is received, the system measures 1 request.
|
|
380
|
+
* 5. The 1 second collection cycle ends. A metric is exported for the
|
|
381
|
+
* number of requests received over the interval of time t_0 to
|
|
382
|
+
* t_0+1 with a value of 3.
|
|
383
|
+
* 6. A request is received, the system measures 1 request.
|
|
384
|
+
* 7. A request is received, the system measures 1 request.
|
|
385
|
+
* 8. The 1 second collection cycle ends. A metric is exported for the
|
|
386
|
+
* number of requests received over the interval of time t_0 to
|
|
387
|
+
* t_0+2 with a value of 5.
|
|
388
|
+
* 9. The system experiences a fault and loses state.
|
|
389
|
+
* 10. The system recovers and resumes receiving at time=t_1.
|
|
390
|
+
* 11. A request is received, the system measures 1 request.
|
|
391
|
+
* 12. The 1 second collection cycle ends. A metric is exported for the
|
|
392
|
+
* number of requests received over the interval of time t_1 to
|
|
393
|
+
* t_0+1 with a value of 1.
|
|
394
|
+
*
|
|
395
|
+
* Note: Even though, when reporting changes since last report time, using
|
|
396
|
+
* CUMULATIVE is valid, it is not recommended. This may cause problems for
|
|
397
|
+
* systems that do not use start_time to determine when the aggregation
|
|
398
|
+
* value was reset (e.g. Prometheus).
|
|
399
|
+
*/
|
|
400
|
+
AggregationTemporality[AggregationTemporality["AGGREGATION_TEMPORALITY_CUMULATIVE"] = 2] = "AGGREGATION_TEMPORALITY_CUMULATIVE";
|
|
401
|
+
AggregationTemporality[AggregationTemporality["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
402
|
+
return AggregationTemporality;
|
|
403
|
+
}({});
|
|
404
|
+
/**
|
|
405
|
+
* DataPointFlags is defined as a protobuf 'uint32' type and is to be used as a
|
|
406
|
+
* bit-field representing 32 distinct boolean flags. Each flag defined in this
|
|
407
|
+
* enum is a bit-mask. To test the presence of a single flag in the flags of
|
|
408
|
+
* a data point, for example, use an expression like:
|
|
409
|
+
*
|
|
410
|
+
* (point.flags & DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK) == DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK
|
|
411
|
+
*/
|
|
412
|
+
let DataPointFlags = /* @__PURE__ */ function(DataPointFlags) {
|
|
413
|
+
/**
|
|
414
|
+
* DATA_POINT_FLAGS_DO_NOT_USE - The zero value for the enum. Should not be used for comparisons.
|
|
415
|
+
* Instead use bitwise "and" with the appropriate mask as shown above.
|
|
416
|
+
*/
|
|
417
|
+
DataPointFlags[DataPointFlags["DATA_POINT_FLAGS_DO_NOT_USE"] = 0] = "DATA_POINT_FLAGS_DO_NOT_USE";
|
|
418
|
+
/**
|
|
419
|
+
* DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK - This DataPoint is valid but has no recorded value. This value
|
|
420
|
+
* SHOULD be used to reflect explicitly missing data in a series, as
|
|
421
|
+
* for an equivalent to the Prometheus "staleness marker".
|
|
422
|
+
*/
|
|
423
|
+
DataPointFlags[DataPointFlags["DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"] = 1] = "DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK";
|
|
424
|
+
DataPointFlags[DataPointFlags["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
425
|
+
return DataPointFlags;
|
|
426
|
+
}({});
|
|
427
|
+
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/otlp-metrics-generated.ts
|
|
430
|
+
var otlp_metrics_generated_exports = {};
|
|
431
|
+
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/otlp-zod.ts
|
|
434
|
+
var otlp_zod_exports = /* @__PURE__ */ __exportAll({
|
|
435
|
+
aggregationTemporalitySchema: () => aggregationTemporalitySchema,
|
|
436
|
+
anyValueSchema: () => anyValueSchema,
|
|
437
|
+
arrayValueSchema: () => arrayValueSchema,
|
|
438
|
+
dataPointFlagsSchema: () => dataPointFlagsSchema,
|
|
439
|
+
entityRefSchema: () => entityRefSchema,
|
|
440
|
+
exponentialHistogramDataPointBucketsSchema: () => exponentialHistogramDataPointBucketsSchema$1,
|
|
441
|
+
instrumentationScopeSchema: () => instrumentationScopeSchema,
|
|
442
|
+
keyValueListSchema: () => keyValueListSchema,
|
|
443
|
+
keyValueSchema: () => keyValueSchema,
|
|
444
|
+
logRecordFlagsSchema: () => logRecordFlagsSchema,
|
|
445
|
+
logRecordSchema: () => logRecordSchema,
|
|
446
|
+
logsDataSchema: () => logsDataSchema,
|
|
447
|
+
resourceLogsSchema: () => resourceLogsSchema,
|
|
448
|
+
resourceSchema: () => resourceSchema,
|
|
449
|
+
resourceSpansSchema: () => resourceSpansSchema,
|
|
450
|
+
scopeLogsSchema: () => scopeLogsSchema,
|
|
451
|
+
scopeSpansSchema: () => scopeSpansSchema,
|
|
452
|
+
severityNumberSchema: () => severityNumberSchema,
|
|
453
|
+
spanEventSchema: () => spanEventSchema,
|
|
454
|
+
spanFlagsSchema: () => spanFlagsSchema,
|
|
455
|
+
spanKindSchema: () => spanKindSchema,
|
|
456
|
+
spanLinkSchema: () => spanLinkSchema,
|
|
457
|
+
spanSchema: () => spanSchema,
|
|
458
|
+
statusCodeSchema: () => statusCodeSchema,
|
|
459
|
+
statusSchema: () => statusSchema,
|
|
460
|
+
summaryDataPointSchema: () => summaryDataPointSchema$1,
|
|
461
|
+
summaryDataPointValueAtQuantileSchema: () => summaryDataPointValueAtQuantileSchema$1,
|
|
462
|
+
summarySchema: () => summarySchema$1,
|
|
463
|
+
tracesDataSchema: () => tracesDataSchema
|
|
464
|
+
});
|
|
465
|
+
const entityRefSchema = zod.z.object({
|
|
466
|
+
schemaUrl: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
467
|
+
type: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
468
|
+
idKeys: zod.z.union([zod.z.array(zod.z.string()), zod.z.undefined()]).optional(),
|
|
469
|
+
descriptionKeys: zod.z.union([zod.z.array(zod.z.string()), zod.z.undefined()]).optional()
|
|
470
|
+
});
|
|
471
|
+
const spanFlagsSchema = zod.z.enum(SpanFlags);
|
|
472
|
+
const spanKindSchema = zod.z.enum(SpanKind);
|
|
473
|
+
const statusCodeSchema = zod.z.enum(StatusCode);
|
|
474
|
+
const severityNumberSchema = zod.z.enum(SeverityNumber);
|
|
475
|
+
const logRecordFlagsSchema = zod.z.enum(LogRecordFlags);
|
|
476
|
+
const aggregationTemporalitySchema = zod.z.union([zod.z.enum(AggregationTemporality), zod.z.number()]);
|
|
477
|
+
const dataPointFlagsSchema = zod.z.union([zod.z.enum(DataPointFlags), zod.z.number()]);
|
|
478
|
+
const exponentialHistogramDataPointBucketsSchema$1 = zod.z.object({
|
|
479
|
+
offset: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
480
|
+
bucketCounts: zod.z.union([zod.z.array(zod.z.union([zod.z.string(), zod.z.number()])), zod.z.undefined()]).optional()
|
|
481
|
+
});
|
|
482
|
+
const summaryDataPointValueAtQuantileSchema$1 = zod.z.object({
|
|
483
|
+
quantile: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
484
|
+
value: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
485
|
+
});
|
|
486
|
+
const statusSchema = zod.z.object({
|
|
487
|
+
message: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
488
|
+
code: zod.z.union([statusCodeSchema, zod.z.undefined()]).optional()
|
|
489
|
+
});
|
|
490
|
+
const anyValueSchema = zod.z.lazy(() => zod.z.object({
|
|
491
|
+
stringValue: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
492
|
+
boolValue: zod.z.union([zod.z.boolean(), zod.z.undefined()]).optional(),
|
|
493
|
+
intValue: zod.z.union([
|
|
494
|
+
zod.z.string(),
|
|
495
|
+
zod.z.number(),
|
|
496
|
+
zod.z.undefined()
|
|
497
|
+
]).optional(),
|
|
498
|
+
doubleValue: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
499
|
+
arrayValue: zod.z.union([arrayValueSchema, zod.z.undefined()]).optional(),
|
|
500
|
+
kvlistValue: zod.z.union([keyValueListSchema, zod.z.undefined()]).optional(),
|
|
501
|
+
bytesValue: zod.z.union([zod.z.string(), zod.z.undefined()]).optional()
|
|
502
|
+
}));
|
|
503
|
+
const arrayValueSchema = zod.z.lazy(() => zod.z.object({ values: zod.z.union([zod.z.array(anyValueSchema), zod.z.undefined()]).optional() }));
|
|
504
|
+
const keyValueListSchema = zod.z.lazy(() => zod.z.object({ values: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional() }));
|
|
505
|
+
const keyValueSchema = zod.z.lazy(() => zod.z.object({
|
|
506
|
+
key: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
507
|
+
value: zod.z.union([anyValueSchema, zod.z.undefined()]).optional()
|
|
508
|
+
}));
|
|
509
|
+
const instrumentationScopeSchema = zod.z.lazy(() => zod.z.object({
|
|
510
|
+
name: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
511
|
+
version: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
512
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
513
|
+
droppedAttributesCount: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
514
|
+
}));
|
|
515
|
+
const resourceSchema = zod.z.lazy(() => zod.z.object({
|
|
516
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
517
|
+
droppedAttributesCount: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
518
|
+
entityRefs: zod.z.union([zod.z.array(entityRefSchema), zod.z.undefined()]).optional()
|
|
519
|
+
}));
|
|
520
|
+
const tracesDataSchema = zod.z.lazy(() => zod.z.object({ resourceSpans: zod.z.union([zod.z.array(resourceSpansSchema), zod.z.undefined()]).optional() }));
|
|
521
|
+
const resourceSpansSchema = zod.z.lazy(() => zod.z.object({
|
|
522
|
+
resource: zod.z.union([resourceSchema, zod.z.undefined()]).optional(),
|
|
523
|
+
scopeSpans: zod.z.union([zod.z.array(scopeSpansSchema), zod.z.undefined()]).optional(),
|
|
524
|
+
schemaUrl: zod.z.union([zod.z.string(), zod.z.undefined()]).optional()
|
|
525
|
+
}));
|
|
526
|
+
const scopeSpansSchema = zod.z.lazy(() => zod.z.object({
|
|
527
|
+
scope: zod.z.union([instrumentationScopeSchema, zod.z.undefined()]).optional(),
|
|
528
|
+
spans: zod.z.union([zod.z.array(spanSchema), zod.z.undefined()]).optional(),
|
|
529
|
+
schemaUrl: zod.z.union([zod.z.string(), zod.z.undefined()]).optional()
|
|
530
|
+
}));
|
|
531
|
+
const spanSchema = zod.z.lazy(() => zod.z.object({
|
|
532
|
+
traceId: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
533
|
+
spanId: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
534
|
+
traceState: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
535
|
+
parentSpanId: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
536
|
+
flags: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
537
|
+
name: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
538
|
+
kind: zod.z.union([spanKindSchema, zod.z.undefined()]).optional(),
|
|
539
|
+
startTimeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
540
|
+
endTimeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
541
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
542
|
+
droppedAttributesCount: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
543
|
+
events: zod.z.union([zod.z.array(spanEventSchema), zod.z.undefined()]).optional(),
|
|
544
|
+
droppedEventsCount: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
545
|
+
links: zod.z.union([zod.z.array(spanLinkSchema), zod.z.undefined()]).optional(),
|
|
546
|
+
droppedLinksCount: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
547
|
+
status: zod.z.union([statusSchema, zod.z.undefined()]).optional()
|
|
548
|
+
}));
|
|
549
|
+
const spanEventSchema = zod.z.lazy(() => zod.z.object({
|
|
550
|
+
timeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
551
|
+
name: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
552
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
553
|
+
droppedAttributesCount: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
554
|
+
}));
|
|
555
|
+
const spanLinkSchema = zod.z.lazy(() => zod.z.object({
|
|
556
|
+
traceId: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
557
|
+
spanId: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
558
|
+
traceState: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
559
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
560
|
+
droppedAttributesCount: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
561
|
+
flags: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
562
|
+
}));
|
|
563
|
+
const logsDataSchema = zod.z.lazy(() => zod.z.object({ resourceLogs: zod.z.union([zod.z.array(resourceLogsSchema), zod.z.undefined()]).optional() }));
|
|
564
|
+
const resourceLogsSchema = zod.z.lazy(() => zod.z.object({
|
|
565
|
+
resource: zod.z.union([resourceSchema, zod.z.undefined()]).optional(),
|
|
566
|
+
scopeLogs: zod.z.union([zod.z.array(scopeLogsSchema), zod.z.undefined()]).optional(),
|
|
567
|
+
schemaUrl: zod.z.union([zod.z.string(), zod.z.undefined()]).optional()
|
|
568
|
+
}));
|
|
569
|
+
const scopeLogsSchema = zod.z.lazy(() => zod.z.object({
|
|
570
|
+
scope: zod.z.union([instrumentationScopeSchema, zod.z.undefined()]).optional(),
|
|
571
|
+
logRecords: zod.z.union([zod.z.array(logRecordSchema), zod.z.undefined()]).optional(),
|
|
572
|
+
schemaUrl: zod.z.union([zod.z.string(), zod.z.undefined()]).optional()
|
|
573
|
+
}));
|
|
574
|
+
const logRecordSchema = zod.z.lazy(() => zod.z.object({
|
|
575
|
+
timeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
576
|
+
observedTimeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
577
|
+
severityNumber: zod.z.union([severityNumberSchema, zod.z.undefined()]).optional(),
|
|
578
|
+
severityText: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
579
|
+
body: zod.z.union([anyValueSchema, zod.z.undefined()]).optional(),
|
|
580
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
581
|
+
droppedAttributesCount: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
582
|
+
flags: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
583
|
+
traceId: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
584
|
+
spanId: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
585
|
+
eventName: zod.z.union([zod.z.string(), zod.z.undefined()]).optional()
|
|
586
|
+
}));
|
|
587
|
+
const summarySchema$1 = zod.z.lazy(() => zod.z.object({ dataPoints: zod.z.union([zod.z.array(summaryDataPointSchema$1), zod.z.undefined()]).optional() }));
|
|
588
|
+
const summaryDataPointSchema$1 = zod.z.lazy(() => zod.z.object({
|
|
589
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
590
|
+
startTimeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
591
|
+
timeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
592
|
+
count: zod.z.union([
|
|
593
|
+
zod.z.string(),
|
|
594
|
+
zod.z.number(),
|
|
595
|
+
zod.z.undefined()
|
|
596
|
+
]).optional(),
|
|
597
|
+
sum: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
598
|
+
quantileValues: zod.z.union([zod.z.array(summaryDataPointValueAtQuantileSchema$1), zod.z.undefined()]).optional(),
|
|
599
|
+
flags: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
600
|
+
}));
|
|
601
|
+
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region src/otlp-metrics-zod.ts
|
|
604
|
+
var otlp_metrics_zod_exports = /* @__PURE__ */ __exportAll({
|
|
605
|
+
exemplarSchema: () => exemplarSchema,
|
|
606
|
+
exponentialHistogramDataPointBucketsSchema: () => exponentialHistogramDataPointBucketsSchema,
|
|
607
|
+
exponentialHistogramDataPointSchema: () => exponentialHistogramDataPointSchema,
|
|
608
|
+
exponentialHistogramSchema: () => exponentialHistogramSchema,
|
|
609
|
+
gaugeSchema: () => gaugeSchema,
|
|
610
|
+
histogramDataPointSchema: () => histogramDataPointSchema,
|
|
611
|
+
histogramSchema: () => histogramSchema,
|
|
612
|
+
metricSchema: () => metricSchema,
|
|
613
|
+
metricsDataSchema: () => metricsDataSchema,
|
|
614
|
+
numberDataPointSchema: () => numberDataPointSchema,
|
|
615
|
+
resourceMetricsSchema: () => resourceMetricsSchema,
|
|
616
|
+
scopeMetricsSchema: () => scopeMetricsSchema,
|
|
617
|
+
sumSchema: () => sumSchema,
|
|
618
|
+
summaryDataPointSchema: () => summaryDataPointSchema,
|
|
619
|
+
summaryDataPointValueAtQuantileSchema: () => summaryDataPointValueAtQuantileSchema,
|
|
620
|
+
summarySchema: () => summarySchema
|
|
621
|
+
});
|
|
622
|
+
/**
|
|
623
|
+
* Represents the value at a given quantile of a distribution.
|
|
624
|
+
*
|
|
625
|
+
* To record Min and Max values following conventions are used:
|
|
626
|
+
* - The 1.0 quantile is equivalent to the maximum value observed.
|
|
627
|
+
* - The 0.0 quantile is equivalent to the minimum value observed.
|
|
628
|
+
*
|
|
629
|
+
* See the following issue for more context:
|
|
630
|
+
* https://github.com/open-telemetry/opentelemetry-proto/issues/125
|
|
631
|
+
*/
|
|
632
|
+
const summaryDataPointValueAtQuantileSchema = zod.z.object({
|
|
633
|
+
quantile: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
634
|
+
value: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
635
|
+
});
|
|
636
|
+
/**
|
|
637
|
+
* Buckets are a set of bucket counts, encoded in a contiguous array
|
|
638
|
+
* of counts.
|
|
639
|
+
*/
|
|
640
|
+
const exponentialHistogramDataPointBucketsSchema = zod.z.object({
|
|
641
|
+
offset: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
642
|
+
bucketCounts: zod.z.union([zod.z.array(zod.z.union([zod.z.string(), zod.z.number()])), zod.z.undefined()]).optional()
|
|
643
|
+
});
|
|
644
|
+
/**
|
|
645
|
+
* A representation of an exemplar, which is a sample input measurement.
|
|
646
|
+
* Exemplars also hold information about the environment when the measurement
|
|
647
|
+
* was recorded, for example the span and trace ID of the active span when the
|
|
648
|
+
* exemplar was recorded.
|
|
649
|
+
*/
|
|
650
|
+
const exemplarSchema = zod.z.lazy(() => zod.z.object({
|
|
651
|
+
filteredAttributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
652
|
+
timeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
653
|
+
asDouble: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
654
|
+
asInt: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
655
|
+
spanId: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
656
|
+
traceId: zod.z.union([zod.z.instanceof(Uint8Array), zod.z.undefined()]).optional()
|
|
657
|
+
}));
|
|
658
|
+
/**
|
|
659
|
+
* NumberDataPoint is a single data point in a timeseries that describes the
|
|
660
|
+
* time-varying scalar value of a metric.
|
|
661
|
+
*/
|
|
662
|
+
const numberDataPointSchema = zod.z.lazy(() => zod.z.object({
|
|
663
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
664
|
+
startTimeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
665
|
+
timeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
666
|
+
asDouble: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
667
|
+
asInt: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
668
|
+
exemplars: zod.z.union([zod.z.array(exemplarSchema), zod.z.undefined()]).optional(),
|
|
669
|
+
flags: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
670
|
+
}));
|
|
671
|
+
/**
|
|
672
|
+
* HistogramDataPoint is a single data point in a timeseries that describes the
|
|
673
|
+
* time-varying values of a Histogram. A Histogram contains summary statistics
|
|
674
|
+
* for a population of values, it may optionally contain the distribution of
|
|
675
|
+
* those values across a set of buckets.
|
|
676
|
+
*
|
|
677
|
+
* If the histogram contains the distribution of values, then both
|
|
678
|
+
* "explicit_bounds" and "bucket counts" fields must be defined.
|
|
679
|
+
* If the histogram does not contain the distribution of values, then both
|
|
680
|
+
* "explicit_bounds" and "bucket_counts" must be omitted and only "count" and
|
|
681
|
+
* "sum" are known.
|
|
682
|
+
*/
|
|
683
|
+
const histogramDataPointSchema = zod.z.lazy(() => zod.z.object({
|
|
684
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
685
|
+
startTimeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
686
|
+
timeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
687
|
+
count: zod.z.union([
|
|
688
|
+
zod.z.string(),
|
|
689
|
+
zod.z.number(),
|
|
690
|
+
zod.z.undefined()
|
|
691
|
+
]).optional(),
|
|
692
|
+
sum: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
693
|
+
bucketCounts: zod.z.union([zod.z.array(zod.z.union([zod.z.string(), zod.z.number()])), zod.z.undefined()]).optional(),
|
|
694
|
+
explicitBounds: zod.z.union([zod.z.array(zod.z.number()), zod.z.undefined()]).optional(),
|
|
695
|
+
exemplars: zod.z.union([zod.z.array(exemplarSchema), zod.z.undefined()]).optional(),
|
|
696
|
+
flags: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
697
|
+
min: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
698
|
+
max: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
699
|
+
}));
|
|
700
|
+
/**
|
|
701
|
+
* ExponentialHistogramDataPoint is a single data point in a timeseries that describes the
|
|
702
|
+
* time-varying values of a ExponentialHistogram of double values. A ExponentialHistogram contains
|
|
703
|
+
* summary statistics for a population of values, it may optionally contain the
|
|
704
|
+
* distribution of those values across a set of buckets.
|
|
705
|
+
*/
|
|
706
|
+
const exponentialHistogramDataPointSchema = zod.z.lazy(() => zod.z.object({
|
|
707
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
708
|
+
startTimeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
709
|
+
timeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
710
|
+
count: zod.z.union([
|
|
711
|
+
zod.z.string(),
|
|
712
|
+
zod.z.number(),
|
|
713
|
+
zod.z.undefined()
|
|
714
|
+
]).optional(),
|
|
715
|
+
sum: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
716
|
+
scale: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
717
|
+
zeroCount: zod.z.union([
|
|
718
|
+
zod.z.string(),
|
|
719
|
+
zod.z.number(),
|
|
720
|
+
zod.z.undefined()
|
|
721
|
+
]).optional(),
|
|
722
|
+
positive: zod.z.union([exponentialHistogramDataPointBucketsSchema, zod.z.undefined()]).optional(),
|
|
723
|
+
negative: zod.z.union([exponentialHistogramDataPointBucketsSchema, zod.z.undefined()]).optional(),
|
|
724
|
+
flags: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
725
|
+
exemplars: zod.z.union([zod.z.array(exemplarSchema), zod.z.undefined()]).optional(),
|
|
726
|
+
min: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
727
|
+
max: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
728
|
+
zeroThreshold: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
729
|
+
}));
|
|
730
|
+
/**
|
|
731
|
+
* SummaryDataPoint is a single data point in a timeseries that describes the
|
|
732
|
+
* time-varying values of a Summary metric. The count and sum fields represent
|
|
733
|
+
* cumulative values.
|
|
734
|
+
*/
|
|
735
|
+
const summaryDataPointSchema = zod.z.lazy(() => zod.z.object({
|
|
736
|
+
attributes: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional(),
|
|
737
|
+
startTimeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
738
|
+
timeUnixNano: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
739
|
+
count: zod.z.union([
|
|
740
|
+
zod.z.string(),
|
|
741
|
+
zod.z.number(),
|
|
742
|
+
zod.z.undefined()
|
|
743
|
+
]).optional(),
|
|
744
|
+
sum: zod.z.union([zod.z.number(), zod.z.undefined()]).optional(),
|
|
745
|
+
quantileValues: zod.z.union([zod.z.array(summaryDataPointValueAtQuantileSchema), zod.z.undefined()]).optional(),
|
|
746
|
+
flags: zod.z.union([zod.z.number(), zod.z.undefined()]).optional()
|
|
747
|
+
}));
|
|
748
|
+
/**
|
|
749
|
+
* Gauge represents the type of a scalar metric that always exports the
|
|
750
|
+
* "current value" for every data point. It should be used for an "unknown"
|
|
751
|
+
* aggregation.
|
|
752
|
+
*
|
|
753
|
+
* A Gauge does not support different aggregation temporalities. Given the
|
|
754
|
+
* aggregation is unknown, points cannot be combined using the same
|
|
755
|
+
* aggregation, regardless of aggregation temporalities. Therefore,
|
|
756
|
+
* AggregationTemporality is not included. Consequently, this also means
|
|
757
|
+
* "StartTimeUnixNano" is ignored for all data points.
|
|
758
|
+
*/
|
|
759
|
+
const gaugeSchema = zod.z.lazy(() => zod.z.object({ dataPoints: zod.z.union([zod.z.array(numberDataPointSchema), zod.z.undefined()]).optional() }));
|
|
760
|
+
/**
|
|
761
|
+
* Sum represents the type of a scalar metric that is calculated as a sum of all
|
|
762
|
+
* reported measurements over a time interval.
|
|
763
|
+
*/
|
|
764
|
+
const sumSchema = zod.z.lazy(() => zod.z.object({
|
|
765
|
+
dataPoints: zod.z.union([zod.z.array(numberDataPointSchema), zod.z.undefined()]).optional(),
|
|
766
|
+
aggregationTemporality: zod.z.union([aggregationTemporalitySchema, zod.z.undefined()]).optional(),
|
|
767
|
+
isMonotonic: zod.z.union([zod.z.boolean(), zod.z.undefined()]).optional()
|
|
768
|
+
}));
|
|
769
|
+
/**
|
|
770
|
+
* Histogram represents the type of a metric that is calculated by aggregating
|
|
771
|
+
* as a Histogram of all reported measurements over a time interval.
|
|
772
|
+
*/
|
|
773
|
+
const histogramSchema = zod.z.lazy(() => zod.z.object({
|
|
774
|
+
dataPoints: zod.z.union([zod.z.array(histogramDataPointSchema), zod.z.undefined()]).optional(),
|
|
775
|
+
aggregationTemporality: zod.z.union([aggregationTemporalitySchema, zod.z.undefined()]).optional()
|
|
776
|
+
}));
|
|
777
|
+
/**
|
|
778
|
+
* ExponentialHistogram represents the type of a metric that is calculated by aggregating
|
|
779
|
+
* as a ExponentialHistogram of all reported double measurements over a time interval.
|
|
780
|
+
*/
|
|
781
|
+
const exponentialHistogramSchema = zod.z.lazy(() => zod.z.object({
|
|
782
|
+
dataPoints: zod.z.union([zod.z.array(exponentialHistogramDataPointSchema), zod.z.undefined()]).optional(),
|
|
783
|
+
aggregationTemporality: zod.z.union([aggregationTemporalitySchema, zod.z.undefined()]).optional()
|
|
784
|
+
}));
|
|
785
|
+
/**
|
|
786
|
+
* Summary metric data are used to convey quantile summaries,
|
|
787
|
+
* a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary)
|
|
788
|
+
* and OpenMetrics (see: https://github.com/prometheus/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45)
|
|
789
|
+
* data type. These data points cannot always be merged in a meaningful way.
|
|
790
|
+
* While they can be useful in some applications, histogram data points are
|
|
791
|
+
* recommended for new applications.
|
|
792
|
+
* Summary metrics do not have an aggregation temporality field. This is
|
|
793
|
+
* because the count and sum fields of a SummaryDataPoint are assumed to be
|
|
794
|
+
* cumulative values.
|
|
795
|
+
*/
|
|
796
|
+
const summarySchema = zod.z.lazy(() => zod.z.object({ dataPoints: zod.z.union([zod.z.array(summaryDataPointSchema), zod.z.undefined()]).optional() }));
|
|
797
|
+
/**
|
|
798
|
+
* Defines a Metric which has one or more timeseries. The following is a
|
|
799
|
+
* brief summary of the Metric data model. For more details, see:
|
|
800
|
+
*
|
|
801
|
+
* https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md
|
|
802
|
+
*
|
|
803
|
+
* The data model and relation between entities is shown in the
|
|
804
|
+
* diagram below. Here, "DataPoint" is the term used to refer to any
|
|
805
|
+
* one of the specific data point value types, and "points" is the term used
|
|
806
|
+
* to refer to any one of the lists of points contained in the Metric.
|
|
807
|
+
*
|
|
808
|
+
* - Metric is composed of a metadata and data.
|
|
809
|
+
* - Metadata part contains a name, description, unit.
|
|
810
|
+
* - Data is one of the possible types (Sum, Gauge, Histogram, Summary).
|
|
811
|
+
* - DataPoint contains timestamps, attributes, and one of the possible value type
|
|
812
|
+
* fields.
|
|
813
|
+
*
|
|
814
|
+
* Metric
|
|
815
|
+
* +------------+
|
|
816
|
+
* |name |
|
|
817
|
+
* |description |
|
|
818
|
+
* |unit | +------------------------------------+
|
|
819
|
+
* |data |---> |Gauge, Sum, Histogram, Summary, ... |
|
|
820
|
+
* +------------+ +------------------------------------+
|
|
821
|
+
*
|
|
822
|
+
* Data [One of Gauge, Sum, Histogram, Summary, ...]
|
|
823
|
+
* +-----------+
|
|
824
|
+
* |... | // Metadata about the Data.
|
|
825
|
+
* |points |--+
|
|
826
|
+
* +-----------+ |
|
|
827
|
+
* | +---------------------------+
|
|
828
|
+
* | |DataPoint 1 |
|
|
829
|
+
* v |+------+------+ +------+ |
|
|
830
|
+
* +-----+ ||label |label |...|label | |
|
|
831
|
+
* | 1 |-->||value1|value2|...|valueN| |
|
|
832
|
+
* +-----+ |+------+------+ +------+ |
|
|
833
|
+
* | . | |+-----+ |
|
|
834
|
+
* | . | ||value| |
|
|
835
|
+
* | . | |+-----+ |
|
|
836
|
+
* | . | +---------------------------+
|
|
837
|
+
* | . | .
|
|
838
|
+
* | . | .
|
|
839
|
+
* | . | .
|
|
840
|
+
* | . | +---------------------------+
|
|
841
|
+
* | . | |DataPoint M |
|
|
842
|
+
* +-----+ |+------+------+ +------+ |
|
|
843
|
+
* | M |-->||label |label |...|label | |
|
|
844
|
+
* +-----+ ||value1|value2|...|valueN| |
|
|
845
|
+
* |+------+------+ +------+ |
|
|
846
|
+
* |+-----+ |
|
|
847
|
+
* ||value| |
|
|
848
|
+
* |+-----+ |
|
|
849
|
+
* +---------------------------+
|
|
850
|
+
*
|
|
851
|
+
* Each distinct type of DataPoint represents the output of a specific
|
|
852
|
+
* aggregation function, the result of applying the DataPoint's
|
|
853
|
+
* associated function of to one or more measurements.
|
|
854
|
+
*
|
|
855
|
+
* All DataPoint types have three common fields:
|
|
856
|
+
* - Attributes includes key-value pairs associated with the data point
|
|
857
|
+
* - TimeUnixNano is required, set to the end time of the aggregation
|
|
858
|
+
* - StartTimeUnixNano is optional, but strongly encouraged for DataPoints
|
|
859
|
+
* having an AggregationTemporality field, as discussed below.
|
|
860
|
+
*
|
|
861
|
+
* Both TimeUnixNano and StartTimeUnixNano values are expressed as
|
|
862
|
+
* UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
|
|
863
|
+
*
|
|
864
|
+
* # TimeUnixNano
|
|
865
|
+
*
|
|
866
|
+
* This field is required, having consistent interpretation across
|
|
867
|
+
* DataPoint types. TimeUnixNano is the moment corresponding to when
|
|
868
|
+
* the data point's aggregate value was captured.
|
|
869
|
+
*
|
|
870
|
+
* Data points with the 0 value for TimeUnixNano SHOULD be rejected
|
|
871
|
+
* by consumers.
|
|
872
|
+
*
|
|
873
|
+
* # StartTimeUnixNano
|
|
874
|
+
*
|
|
875
|
+
* StartTimeUnixNano in general allows detecting when a sequence of
|
|
876
|
+
* observations is unbroken. This field indicates to consumers the
|
|
877
|
+
* start time for points with cumulative and delta
|
|
878
|
+
* AggregationTemporality, and it should be included whenever possible
|
|
879
|
+
* to support correct rate calculation. Although it may be omitted
|
|
880
|
+
* when the start time is truly unknown, setting StartTimeUnixNano is
|
|
881
|
+
* strongly encouraged.
|
|
882
|
+
*/
|
|
883
|
+
const metricSchema = zod.z.lazy(() => zod.z.object({
|
|
884
|
+
name: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
885
|
+
description: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
886
|
+
unit: zod.z.union([zod.z.string(), zod.z.undefined()]).optional(),
|
|
887
|
+
gauge: zod.z.union([gaugeSchema, zod.z.undefined()]).optional(),
|
|
888
|
+
sum: zod.z.union([sumSchema, zod.z.undefined()]).optional(),
|
|
889
|
+
histogram: zod.z.union([histogramSchema, zod.z.undefined()]).optional(),
|
|
890
|
+
exponentialHistogram: zod.z.union([exponentialHistogramSchema, zod.z.undefined()]).optional(),
|
|
891
|
+
summary: zod.z.union([summarySchema, zod.z.undefined()]).optional(),
|
|
892
|
+
metadata: zod.z.union([zod.z.array(keyValueSchema), zod.z.undefined()]).optional()
|
|
893
|
+
}));
|
|
894
|
+
/** A collection of Metrics produced by an Scope. */
|
|
895
|
+
const scopeMetricsSchema = zod.z.lazy(() => zod.z.object({
|
|
896
|
+
scope: zod.z.union([instrumentationScopeSchema, zod.z.undefined()]).optional(),
|
|
897
|
+
metrics: zod.z.union([zod.z.array(metricSchema), zod.z.undefined()]).optional(),
|
|
898
|
+
schemaUrl: zod.z.union([zod.z.string(), zod.z.undefined()]).optional()
|
|
899
|
+
}));
|
|
900
|
+
/** A collection of ScopeMetrics from a Resource. */
|
|
901
|
+
const resourceMetricsSchema = zod.z.lazy(() => zod.z.object({
|
|
902
|
+
resource: zod.z.union([resourceSchema, zod.z.undefined()]).optional(),
|
|
903
|
+
scopeMetrics: zod.z.union([zod.z.array(scopeMetricsSchema), zod.z.undefined()]).optional(),
|
|
904
|
+
schemaUrl: zod.z.union([zod.z.string(), zod.z.undefined()]).optional()
|
|
905
|
+
}));
|
|
906
|
+
/**
|
|
907
|
+
* MetricsData represents the metrics data that can be stored in a persistent
|
|
908
|
+
* storage, OR can be embedded by other protocols that transfer OTLP metrics
|
|
909
|
+
* data but do not implement the OTLP protocol.
|
|
910
|
+
*
|
|
911
|
+
* MetricsData
|
|
912
|
+
* └─── ResourceMetrics
|
|
913
|
+
* ├── Resource
|
|
914
|
+
* ├── SchemaURL
|
|
915
|
+
* └── ScopeMetrics
|
|
916
|
+
* ├── Scope
|
|
917
|
+
* ├── SchemaURL
|
|
918
|
+
* └── Metric
|
|
919
|
+
* ├── Name
|
|
920
|
+
* ├── Description
|
|
921
|
+
* ├── Unit
|
|
922
|
+
* └── data
|
|
923
|
+
* ├── Gauge
|
|
924
|
+
* ├── Sum
|
|
925
|
+
* ├── Histogram
|
|
926
|
+
* ├── ExponentialHistogram
|
|
927
|
+
* └── Summary
|
|
928
|
+
*
|
|
929
|
+
* The main difference between this message and collector protocol is that
|
|
930
|
+
* in this message there will not be any "control" or "metadata" specific to
|
|
931
|
+
* OTLP protocol.
|
|
932
|
+
*
|
|
933
|
+
* When new fields are added into this message, the OTLP request MUST be updated
|
|
934
|
+
* as well.
|
|
935
|
+
*/
|
|
936
|
+
const metricsDataSchema = zod.z.lazy(() => zod.z.object({ resourceMetrics: zod.z.union([zod.z.array(resourceMetricsSchema), zod.z.undefined()]).optional() }));
|
|
937
|
+
|
|
938
|
+
//#endregion
|
|
939
|
+
//#region src/data-filters-zod.ts
|
|
940
|
+
var data_filters_zod_exports = /* @__PURE__ */ __exportAll({
|
|
941
|
+
logsDataFilterSchema: () => logsDataFilterSchema,
|
|
942
|
+
metricsDataFilterSchema: () => metricsDataFilterSchema,
|
|
943
|
+
tracesDataFilterSchema: () => tracesDataFilterSchema
|
|
944
|
+
});
|
|
945
|
+
const tracesDataFilterSchema = zod.default.object({
|
|
946
|
+
traceId: zod.default.string().optional().describe("Unique identifier for a trace. All spans from the same trace share the same trace_id. The ID is a 16-byte array."),
|
|
947
|
+
spanId: zod.default.string().optional().describe("Unique identifier for a span within a trace. The ID is an 8-byte array."),
|
|
948
|
+
parentSpanId: zod.default.string().optional().describe("The span_id of this span's parent span. Empty if this is a root span."),
|
|
949
|
+
serviceName: zod.default.string().optional().describe("Service name from resource attributes (service.name)."),
|
|
950
|
+
spanName: zod.default.string().optional().describe("Description of the span's operation. E.g., qualified method name or file name with line number."),
|
|
951
|
+
spanKind: zod.default.string().optional().describe("Type of span (INTERNAL, SERVER, CLIENT, PRODUCER, CONSUMER). Used to identify relationships between spans."),
|
|
952
|
+
statusCode: zod.default.string().optional().describe("Status code (UNSET, OK, ERROR)."),
|
|
953
|
+
scopeName: zod.default.string().optional().describe("Name denoting the instrumentation scope."),
|
|
954
|
+
timestampMin: zod.default.string().optional().describe("Minimum start time of the span. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON."),
|
|
955
|
+
timestampMax: zod.default.string().optional().describe("Maximum start time of the span. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON."),
|
|
956
|
+
durationMin: zod.default.string().optional().describe("Minimum duration of the span in nanoseconds (end_time - start_time). Expressed as string in JSON."),
|
|
957
|
+
durationMax: zod.default.string().optional().describe("Maximum duration of the span in nanoseconds (end_time - start_time). Expressed as string in JSON."),
|
|
958
|
+
spanAttributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Key/value pairs describing the span."),
|
|
959
|
+
resourceAttributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Attributes that describe the resource."),
|
|
960
|
+
eventsAttributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Attribute key/value pairs on the event."),
|
|
961
|
+
linksAttributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Attribute key/value pairs on the link."),
|
|
962
|
+
limit: zod.default.number().int().positive().max(1e3).optional().describe("Max items to return. Default determined by datasource."),
|
|
963
|
+
cursor: zod.default.string().optional().describe("Opaque cursor from previous response for next page."),
|
|
964
|
+
sortOrder: zod.default.enum(["ASC", "DESC"]).optional().describe("Sort by timestamp. ASC = oldest first, DESC = newest first.")
|
|
965
|
+
});
|
|
966
|
+
const logsDataFilterSchema = zod.default.object({
|
|
967
|
+
traceId: zod.default.string().optional().describe("Unique identifier for a trace. All logs from the same trace share the same trace_id. The ID is a 16-byte array."),
|
|
968
|
+
spanId: zod.default.string().optional().describe("Unique identifier for a span within a trace. The ID is an 8-byte array."),
|
|
969
|
+
serviceName: zod.default.string().optional().describe("Service name from resource attributes (service.name)."),
|
|
970
|
+
scopeName: zod.default.string().optional().describe("Name denoting the instrumentation scope."),
|
|
971
|
+
severityText: zod.default.string().optional().describe("Severity text (also known as log level). Original string representation as known at the source."),
|
|
972
|
+
severityNumberMin: zod.default.number().optional().describe("Minimum severity number (inclusive). Normalized to values described in Log Data Model."),
|
|
973
|
+
severityNumberMax: zod.default.number().optional().describe("Maximum severity number (inclusive). Normalized to values described in Log Data Model."),
|
|
974
|
+
bodyContains: zod.default.string().optional().describe("Filter logs where body contains this substring."),
|
|
975
|
+
timestampMin: zod.default.string().optional().describe("Minimum time when the event occurred. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON."),
|
|
976
|
+
timestampMax: zod.default.string().optional().describe("Maximum time when the event occurred. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON."),
|
|
977
|
+
logAttributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Additional attributes that describe the specific event occurrence."),
|
|
978
|
+
resourceAttributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Attributes that describe the resource."),
|
|
979
|
+
scopeAttributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Attributes of the instrumentation scope."),
|
|
980
|
+
limit: zod.default.number().int().positive().max(1e3).optional().describe("Max items to return. Default determined by datasource."),
|
|
981
|
+
cursor: zod.default.string().optional().describe("Opaque cursor from previous response for next page."),
|
|
982
|
+
sortOrder: zod.default.enum(["ASC", "DESC"]).optional().describe("Sort by timestamp. ASC = oldest first, DESC = newest first.")
|
|
983
|
+
});
|
|
984
|
+
const metricsDataFilterSchema = zod.default.object({
|
|
985
|
+
metricType: zod.default.enum([
|
|
986
|
+
"Gauge",
|
|
987
|
+
"Sum",
|
|
988
|
+
"Histogram",
|
|
989
|
+
"ExponentialHistogram",
|
|
990
|
+
"Summary"
|
|
991
|
+
]).describe("Metric type to query."),
|
|
992
|
+
metricName: zod.default.string().optional().describe("The name of the metric."),
|
|
993
|
+
serviceName: zod.default.string().optional().describe("Service name from resource attributes (service.name)."),
|
|
994
|
+
scopeName: zod.default.string().optional().describe("Name denoting the instrumentation scope."),
|
|
995
|
+
timeUnixMin: zod.default.string().optional().describe("Minimum time when the data point was recorded. UNIX Epoch time in nanoseconds. Expressed as string in JSON."),
|
|
996
|
+
timeUnixMax: zod.default.string().optional().describe("Maximum time when the data point was recorded. UNIX Epoch time in nanoseconds. Expressed as string in JSON."),
|
|
997
|
+
attributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Key/value pairs that uniquely identify the timeseries."),
|
|
998
|
+
resourceAttributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Attributes that describe the resource."),
|
|
999
|
+
scopeAttributes: zod.default.record(zod.default.string(), zod.default.string()).optional().describe("Attributes of the instrumentation scope."),
|
|
1000
|
+
limit: zod.default.number().int().positive().max(1e3).optional().describe("Max items to return. Default determined by datasource."),
|
|
1001
|
+
cursor: zod.default.string().optional().describe("Opaque cursor from previous response for next page."),
|
|
1002
|
+
sortOrder: zod.default.enum(["ASC", "DESC"]).optional().describe("Sort by timestamp. ASC = oldest first, DESC = newest first.")
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
//#endregion
|
|
1006
|
+
//#region src/index.ts
|
|
1007
|
+
const name = "@kopai/core";
|
|
1008
|
+
|
|
1009
|
+
//#endregion
|
|
1010
|
+
Object.defineProperty(exports, 'dataFilterSchemas', {
|
|
1011
|
+
enumerable: true,
|
|
1012
|
+
get: function () {
|
|
1013
|
+
return data_filters_zod_exports;
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
Object.defineProperty(exports, 'datasource', {
|
|
1017
|
+
enumerable: true,
|
|
1018
|
+
get: function () {
|
|
1019
|
+
return telemetry_datasource_exports;
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
Object.defineProperty(exports, 'denormalizedSignals', {
|
|
1023
|
+
enumerable: true,
|
|
1024
|
+
get: function () {
|
|
1025
|
+
return denormalized_signals_zod_exports;
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
exports.name = name;
|
|
1029
|
+
Object.defineProperty(exports, 'otlp', {
|
|
1030
|
+
enumerable: true,
|
|
1031
|
+
get: function () {
|
|
1032
|
+
return otlp_generated_exports;
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
Object.defineProperty(exports, 'otlpMetrics', {
|
|
1036
|
+
enumerable: true,
|
|
1037
|
+
get: function () {
|
|
1038
|
+
return otlp_metrics_generated_exports;
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
Object.defineProperty(exports, 'otlpMetricsZod', {
|
|
1042
|
+
enumerable: true,
|
|
1043
|
+
get: function () {
|
|
1044
|
+
return otlp_metrics_zod_exports;
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
Object.defineProperty(exports, 'otlpZod', {
|
|
1048
|
+
enumerable: true,
|
|
1049
|
+
get: function () {
|
|
1050
|
+
return otlp_zod_exports;
|
|
1051
|
+
}
|
|
1052
|
+
});
|