@r_masseater/vitest-otlp 0.0.0 → 0.0.2

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.
@@ -1,256 +0,0 @@
1
- import { create, toBinary } from "@bufbuild/protobuf";
2
- import { Array, Effect, ManagedRuntime, Match, Option, Predicate, Record, Result, pipe } from "effect";
3
- import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
4
- import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
5
- import { Hex } from "effect/encoding";
6
- // src/generated/opentelemetry/proto/common/v1/common_pb.ts
7
- /**
8
- * Describes the file opentelemetry/proto/common/v1/common.proto.
9
- */
10
- const file_opentelemetry_proto_common_v1_common = /*@__PURE__*/ fileDesc("CipvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbW1vbi92MS9jb21tb24ucHJvdG8SHW9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxIq0CCghBbnlWYWx1ZRIWCgxzdHJpbmdfdmFsdWUYASABKAlIABIUCgpib29sX3ZhbHVlGAIgASgISAASEwoJaW50X3ZhbHVlGAMgASgDSAASFgoMZG91YmxlX3ZhbHVlGAQgASgBSAASQAoLYXJyYXlfdmFsdWUYBSABKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5BcnJheVZhbHVlSAASQwoMa3ZsaXN0X3ZhbHVlGAYgASgLMisub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWVMaXN0SAASFQoLYnl0ZXNfdmFsdWUYByABKAxIABIfChVzdHJpbmdfdmFsdWVfc3RyaW5kZXgYCCABKAVIAEIHCgV2YWx1ZSJFCgpBcnJheVZhbHVlEjcKBnZhbHVlcxgBIAMoCzInLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxLkFueVZhbHVlIkcKDEtleVZhbHVlTGlzdBI3CgZ2YWx1ZXMYASADKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5LZXlWYWx1ZSJlCghLZXlWYWx1ZRILCgNrZXkYASABKAkSNgoFdmFsdWUYAiABKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5BbnlWYWx1ZRIUCgxrZXlfc3RyaW5kZXgYAyABKAUilAEKFEluc3RydW1lbnRhdGlvblNjb3BlEgwKBG5hbWUYASABKAkSDwoHdmVyc2lvbhgCIAEoCRI7CgphdHRyaWJ1dGVzGAMgAygLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWUSIAoYZHJvcHBlZF9hdHRyaWJ1dGVzX2NvdW50GAQgASgNIlgKCUVudGl0eVJlZhISCgpzY2hlbWFfdXJsGAEgASgJEgwKBHR5cGUYAiABKAkSDwoHaWRfa2V5cxgDIAMoCRIYChBkZXNjcmlwdGlvbl9rZXlzGAQgAygJQnsKIGlvLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxQgtDb21tb25Qcm90b1ABWihnby5vcGVudGVsZW1ldHJ5LmlvL3Byb3RvL290bHAvY29tbW9uL3YxqgIdT3BlblRlbGVtZXRyeS5Qcm90by5Db21tb24uVjFiBnByb3RvMw");
11
- // src/generated/opentelemetry/proto/resource/v1/resource_pb.ts
12
- /**
13
- * Describes the file opentelemetry/proto/resource/v1/resource.proto.
14
- */
15
- const file_opentelemetry_proto_resource_v1_resource = /*@__PURE__*/ fileDesc("Ci5vcGVudGVsZW1ldHJ5L3Byb3RvL3Jlc291cmNlL3YxL3Jlc291cmNlLnByb3RvEh9vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxIqgBCghSZXNvdXJjZRI7CgphdHRyaWJ1dGVzGAEgAygLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWUSIAoYZHJvcHBlZF9hdHRyaWJ1dGVzX2NvdW50GAIgASgNEj0KC2VudGl0eV9yZWZzGAMgAygLMigub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuRW50aXR5UmVmQoMBCiJpby5vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxQg1SZXNvdXJjZVByb3RvUAFaKmdvLm9wZW50ZWxlbWV0cnkuaW8vcHJvdG8vb3RscC9yZXNvdXJjZS92MaoCH09wZW5UZWxlbWV0cnkuUHJvdG8uUmVzb3VyY2UuVjFiBnByb3RvMw", [file_opentelemetry_proto_common_v1_common]);
16
- /**
17
- * Describes the message opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.
18
- * Use `create(ExportLogsServiceRequestSchema)` to create a new message.
19
- */
20
- const ExportLogsServiceRequestSchema = /*@__PURE__*/ messageDesc(/* @__PURE__ */ fileDesc("CjhvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbGxlY3Rvci9sb2dzL3YxL2xvZ3Nfc2VydmljZS5wcm90bxIlb3BlbnRlbGVtZXRyeS5wcm90by5jb2xsZWN0b3IubG9ncy52MSJcChhFeHBvcnRMb2dzU2VydmljZVJlcXVlc3QSQAoNcmVzb3VyY2VfbG9ncxgBIAMoCzIpLm9wZW50ZWxlbWV0cnkucHJvdG8ubG9ncy52MS5SZXNvdXJjZUxvZ3MidQoZRXhwb3J0TG9nc1NlcnZpY2VSZXNwb25zZRJYCg9wYXJ0aWFsX3N1Y2Nlc3MYASABKAsyPy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci5sb2dzLnYxLkV4cG9ydExvZ3NQYXJ0aWFsU3VjY2VzcyJPChhFeHBvcnRMb2dzUGFydGlhbFN1Y2Nlc3MSHAoUcmVqZWN0ZWRfbG9nX3JlY29yZHMYASABKAMSFQoNZXJyb3JfbWVzc2FnZRgCIAEoCTKdAQoLTG9nc1NlcnZpY2USjQEKBkV4cG9ydBI/Lm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLmxvZ3MudjEuRXhwb3J0TG9nc1NlcnZpY2VSZXF1ZXN0GkAub3BlbnRlbGVt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ERIaChZTRVZFUklUWV9OVU1CRVJfRVJST1IyEBISGgoWU0VWRVJJVFlfTlVNQkVSX0VSUk9SMxATEhoKFlNFVkVSSVRZX05VTUJFUl9FUlJPUjQQFBIZChVTRVZFUklUWV9OVU1CRVJfRkFUQUwQFRIaChZTRVZFUklUWV9OVU1CRVJfRkFUQUwyEBYSGgoWU0VWRVJJVFlfTlVNQkVSX0ZBVEFMMxAXEhoKFlNFVkVSSVRZX05VTUJFUl9GQVRBTDQQGCpZCg5Mb2dSZWNvcmRGbGFncxIfChtMT0dfUkVDT1JEX0ZMQUdTX0RPX05PVF9VU0UQABImCiFMT0dfUkVDT1JEX0ZMQUdTX1RSQUNFX0ZMQUdTX01BU0sQ/wFCcwoeaW8ub3BlbnRlbGVtZXRyeS5wcm90by5sb2dzLnYxQglMb2dzUHJvdG9QAVomZ28ub3BlbnRlbGVtZXRyeS5pby9wcm90by9vdGxwL2xvZ3MvdjGqAhtPcGVuVGVsZW1ldHJ5LlByb3RvLkxvZ3MuVjFiBnByb3RvMw", [file_opentelemetry_proto_common_v1_common, file_opentelemetry_proto_resource_v1_resource])]), 0);
21
- /**
22
- * Describes the message opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.
23
- * Use `create(ExportTraceServiceRequestSchema)` to create a new message.
24
- */
25
- const ExportTraceServiceRequestSchema = /*@__PURE__*/ messageDesc(/* @__PURE__ */ fileDesc("CjpvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbGxlY3Rvci90cmFjZS92MS90cmFjZV9zZXJ2aWNlLnByb3RvEiZvcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci50cmFjZS52MSJgChlFeHBvcnRUcmFjZVNlcnZpY2VSZXF1ZXN0EkMKDnJlc291cmNlX3NwYW5zGAEgAygLMisub3BlbnRlbGVtZXRyeS5wcm90by50cmFjZS52MS5SZXNvdXJjZVNwYW5zIngKGkV4cG9ydFRyYWNlU2VydmljZVJlc3BvbnNlEloKD3BhcnRpYWxfc3V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b3RscC90cmFjZS92MaoCHE9wZW5UZWxlbWV0cnkuUHJvdG8uVHJhY2UuVjFiBnByb3RvMw", [file_opentelemetry_proto_common_v1_common, file_opentelemetry_proto_resource_v1_resource])]), 0);
26
- // src/tail-events.ts
27
- const NANOS_PER_MILLI = 1000000n;
28
- const SEVERITIES = {
29
- debug: 5,
30
- info: 9,
31
- log: 9,
32
- warn: 13,
33
- error: 17
34
- };
35
- const SPAN_STATUSES = {
36
- unset: 0,
37
- ok: 1,
38
- error: 2
39
- };
40
- const nanos = (date) => BigInt(date.getTime()) * NANOS_PER_MILLI;
41
- const statusOf = (outcome) => Match.value(outcome).pipe(Match.when("ok", () => 0), Match.orElse(() => 2));
42
- const onsetAttributes = (onset) => [...onset.attributes ?? [], ...Match.value(onset.info).pipe(Match.when({ type: "fetch" }, (info) => [{
43
- name: "http.request.method",
44
- value: info.method
45
- }, {
46
- name: "url.full",
47
- value: info.url
48
- }]), Match.orElse(() => []))];
49
- const textOf = (part) => Match.value(part).pipe(Match.when(Predicate.isString, (text) => text), Match.orElse((other) => JSON.stringify(other)));
50
- const logBody = (message) => Match.value(message).pipe(Match.when(Array.isArray, (parts) => pipe(parts, Array.map(textOf), Array.join(" "))), Match.orElse(textOf));
51
- const exceptionAttributes = (exception) => [
52
- {
53
- name: "exception.type",
54
- value: exception.name
55
- },
56
- {
57
- name: "exception.message",
58
- value: exception.message
59
- },
60
- ...pipe(Option.fromNullishOr(exception.stack), Option.match({
61
- onNone: () => [],
62
- onSome: (stack) => [{
63
- name: "exception.stacktrace",
64
- value: stack
65
- }]
66
- }))
67
- ];
68
- const returnAttributes = (info) => pipe(Option.fromNullishOr(info), Option.match({
69
- onNone: () => [],
70
- onSome: ({ statusCode }) => [{
71
- name: "http.response.status_code",
72
- value: statusCode
73
- }]
74
- }));
75
- const updateSpan = (spanId, update) => (invocation) => ({
76
- ...invocation,
77
- spans: Option.getOrElse(Record.modify(invocation.spans, spanId, update), () => invocation.spans)
78
- });
79
- const addSpan = (draft) => (invocation) => ({
80
- ...invocation,
81
- spans: Record.set(invocation.spans, draft.spanId, draft)
82
- });
83
- const withAttributes = (attributes) => (draft) => ({
84
- ...draft,
85
- attributes: [...draft.attributes, ...attributes]
86
- });
87
- const closed = (end, outcome) => (draft) => ({
88
- ...draft,
89
- end: Option.some(end),
90
- status: statusOf(outcome)
91
- });
92
- const updated = (info) => (draft) => Match.value(info).pipe(Match.discriminatorsExhaustive("type")({
93
- name: ({ name }) => ({
94
- ...draft,
95
- name
96
- }),
97
- status: ({ status }) => ({
98
- ...draft,
99
- status: SPAN_STATUSES[status.code]
100
- })
101
- }));
102
- const opened = (tail, opening) => ({
103
- ...opening,
104
- parentSpanId: tail.spanContext.spanId ?? "",
105
- start: nanos(tail.timestamp),
106
- end: Option.none(),
107
- attributes: [],
108
- status: 0
109
- });
110
- const onOnset = (invocation, tail, onset) => ({
111
- traceId: tail.spanContext.traceId,
112
- serviceName: onset.scriptName ?? invocation.serviceName,
113
- spans: { [onset.spanId]: {
114
- ...opened(tail, {
115
- spanId: onset.spanId,
116
- name: onset.info.type,
117
- kind: 2
118
- }),
119
- attributes: onsetAttributes(onset)
120
- } },
121
- logs: []
122
- });
123
- const onLog = (tail, log) => (invocation) => ({
124
- ...invocation,
125
- logs: [...invocation.logs, {
126
- spanId: tail.spanContext.spanId ?? "",
127
- time: nanos(tail.timestamp),
128
- severity: SEVERITIES[log.level],
129
- level: log.level,
130
- body: logBody(log.message)
131
- }]
132
- });
133
- const step = (invocation, tail) => {
134
- const own = tail.spanContext.spanId ?? "";
135
- const end = nanos(tail.timestamp);
136
- return Match.value(tail.event).pipe(Match.discriminatorsExhaustive("type")({
137
- onset: (onset) => onOnset(invocation, tail, onset),
138
- spanOpen: (open) => addSpan(opened(tail, {
139
- spanId: open.spanId,
140
- name: open.name,
141
- kind: 3
142
- }))(invocation),
143
- attributes: ({ info }) => updateSpan(own, withAttributes(info))(invocation),
144
- spanClose: ({ outcome }) => updateSpan(own, closed(end, outcome))(invocation),
145
- outcome: ({ outcome }) => updateSpan(own, closed(end, outcome))(invocation),
146
- spanUpdate: ({ info }) => updateSpan(own, updated(info))(invocation),
147
- return: ({ info }) => updateSpan(own, withAttributes(returnAttributes(info)))(invocation),
148
- exception: (exception) => updateSpan(own, withAttributes(exceptionAttributes(exception)))(invocation),
149
- log: (log) => onLog(tail, log)(invocation),
150
- diagnosticChannel: () => invocation,
151
- streamDiagnostic: () => invocation
152
- }));
153
- };
154
- const invocationOf = (serviceName) => (events) => {
155
- let invocation = {
156
- traceId: "",
157
- serviceName,
158
- spans: {},
159
- logs: []
160
- };
161
- for (const tail of events) invocation = step(invocation, tail);
162
- return invocation;
163
- };
164
- // src/tail-otlp.ts
165
- const SCOPE_NAME = "cloudflare-workers";
166
- const stringValue = (value) => ({ value: {
167
- case: "stringValue",
168
- value
169
- } });
170
- const boolValue = (value) => ({ value: {
171
- case: "boolValue",
172
- value
173
- } });
174
- const intValue = (value) => ({ value: {
175
- case: "intValue",
176
- value
177
- } });
178
- const doubleValue = (value) => ({ value: {
179
- case: "doubleValue",
180
- value
181
- } });
182
- const numberValue = (value) => Match.value(value).pipe(Match.when((whole) => Number.isInteger(whole), (whole) => intValue(BigInt(whole))), Match.orElse(doubleValue));
183
- const scalarValue = (value) => Match.value(value).pipe(Match.when(Predicate.isString, stringValue), Match.when(Predicate.isBoolean, boolValue), Match.when(Predicate.isBigInt, intValue), Match.orElse(numberValue));
184
- const arrayValue = (values) => ({ value: {
185
- case: "arrayValue",
186
- value: { values: pipe(values, Array.map(scalarValue)) }
187
- } });
188
- const anyValue = (attribute) => Match.value(attribute.value).pipe(Match.when(Predicate.isString, stringValue), Match.when(Predicate.isBoolean, boolValue), Match.when(Predicate.isBigInt, intValue), Match.when(Predicate.isNumber, numberValue), Match.orElse(arrayValue));
189
- const keyValue = (attribute) => ({
190
- key: attribute.name,
191
- value: anyValue(attribute)
192
- });
193
- const idBytes = (hex) => Result.getOrElse(Hex.decode(hex), () => /* @__PURE__ */ new Uint8Array());
194
- const spanInit = (traceId) => (draft) => ({
195
- traceId: idBytes(traceId),
196
- spanId: idBytes(draft.spanId),
197
- parentSpanId: idBytes(draft.parentSpanId),
198
- name: draft.name,
199
- kind: draft.kind,
200
- startTimeUnixNano: draft.start,
201
- endTimeUnixNano: Option.getOrElse(draft.end, () => draft.start),
202
- attributes: pipe(draft.attributes, Array.map(keyValue)),
203
- status: { code: draft.status }
204
- });
205
- const logInit = (traceId) => (log) => ({
206
- timeUnixNano: log.time,
207
- severityNumber: log.severity,
208
- severityText: log.level,
209
- body: stringValue(log.body),
210
- traceId: idBytes(traceId),
211
- spanId: idBytes(log.spanId)
212
- });
213
- const resourceOf = (invocation) => [keyValue({
214
- name: "service.name",
215
- value: invocation.serviceName
216
- })];
217
- const tracesOf = (invocation) => {
218
- const spans = pipe(Record.values(invocation.spans), Array.map(spanInit(invocation.traceId)));
219
- return create(ExportTraceServiceRequestSchema, { resourceSpans: [{
220
- resource: { attributes: resourceOf(invocation) },
221
- scopeSpans: [{
222
- scope: { name: SCOPE_NAME },
223
- spans
224
- }]
225
- }] });
226
- };
227
- const logsOf = (invocation) => {
228
- const logRecords = pipe(invocation.logs, Array.map(logInit(invocation.traceId)));
229
- return create(ExportLogsServiceRequestSchema, { resourceLogs: [{
230
- resource: { attributes: resourceOf(invocation) },
231
- scopeLogs: [{
232
- scope: { name: SCOPE_NAME },
233
- logRecords
234
- }]
235
- }] });
236
- };
237
- // src/tail.worker.ts
238
- const PROTOBUF_CONTENT_TYPE = "application/x-protobuf";
239
- const post = (url, schema, message) => {
240
- const body = toBinary(schema, message);
241
- return HttpClient.execute(HttpClientRequest.post(url).pipe(HttpClientRequest.bodyUint8Array(body, PROTOBUF_CONTENT_TYPE)));
242
- };
243
- const exportInvocation = (endpoint, invocation) => Effect.all([post(`${endpoint}/v1/traces`, ExportTraceServiceRequestSchema, tracesOf(invocation)), post(`${endpoint}/v1/logs`, ExportLogsServiceRequestSchema, logsOf(invocation))], { concurrency: "unbounded" });
244
- const runtime = ManagedRuntime.make(FetchHttpClient.layer);
245
- const tailStream = (onset, env) => {
246
- const events = [onset];
247
- const exportAll = Effect.suspend(() => exportInvocation(env.OTEL_EXPORTER_OTLP_ENDPOINT, invocationOf(env.OTEL_SERVICE_NAME)(events)));
248
- return (event) => {
249
- events.push(event);
250
- return runtime.runPromise(Effect.when(exportAll, Effect.succeed(event.event.type === "outcome")));
251
- };
252
- };
253
- const tailWorker = { tailStream };
254
- export { tailWorker as default };
255
-
256
- //# sourceMappingURL=tail.worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tail.worker.js","names":[],"sources":["../src/generated/opentelemetry/proto/common/v1/common_pb.ts","../src/generated/opentelemetry/proto/resource/v1/resource_pb.ts","../src/generated/opentelemetry/proto/logs/v1/logs_pb.ts","../src/generated/opentelemetry/proto/collector/logs/v1/logs_service_pb.ts","../src/generated/opentelemetry/proto/trace/v1/trace_pb.ts","../src/generated/opentelemetry/proto/collector/trace/v1/trace_service_pb.ts","../src/tail-events.ts","../src/tail-otlp.ts","../src/tail.worker.ts"],"sourcesContent":["// Copyright 2019, OpenTelemetry Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// @generated by protoc-gen-es v2.16.0 with parameter \"target=ts,import_extension=ts\"\n// @generated from file opentelemetry/proto/common/v1/common.proto (package opentelemetry.proto.common.v1, syntax proto3)\n/* eslint-disable */\n\nimport type { GenFile, GenMessage } from \"@bufbuild/protobuf/codegenv2\";\nimport { fileDesc, messageDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file opentelemetry/proto/common/v1/common.proto.\n */\nexport const file_opentelemetry_proto_common_v1_common: GenFile = /*@__PURE__*/\n fileDesc(\"CipvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbW1vbi92MS9jb21tb24ucHJvdG8SHW9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxIq0CCghBbnlWYWx1ZRIWCgxzdHJpbmdfdmFsdWUYASABKAlIABIUCgpib29sX3ZhbHVlGAIgASgISAASEwoJaW50X3ZhbHVlGAMgASgDSAASFgoMZG91YmxlX3ZhbHVlGAQgASgBSAASQAoLYXJyYXlfdmFsdWUYBSABKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5BcnJheVZhbHVlSAASQwoMa3ZsaXN0X3ZhbHVlGAYgASgLMisub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWVMaXN0SAASFQoLYnl0ZXNfdmFsdWUYByABKAxIABIfChVzdHJpbmdfdmFsdWVfc3RyaW5kZXgYCCABKAVIAEIHCgV2YWx1ZSJFCgpBcnJheVZhbHVlEjcKBnZhbHVlcxgBIAMoCzInLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxLkFueVZhbHVlIkcKDEtleVZhbHVlTGlzdBI3CgZ2YWx1ZXMYASADKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5LZXlWYWx1ZSJlCghLZXlWYWx1ZRILCgNrZXkYASABKAkSNgoFdmFsdWUYAiABKAsyJy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbW1vbi52MS5BbnlWYWx1ZRIUCgxrZXlfc3RyaW5kZXgYAyABKAUilAEKFEluc3RydW1lbnRhdGlvblNjb3BlEgwKBG5hbWUYASABKAkSDwoHdmVyc2lvbhgCIAEoCRI7CgphdHRyaWJ1dGVzGAMgAygLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWUSIAoYZHJvcHBlZF9hdHRyaWJ1dGVzX2NvdW50GAQgASgNIlgKCUVudGl0eVJlZhISCgpzY2hlbWFfdXJsGAEgASgJEgwKBHR5cGUYAiABKAkSDwoHaWRfa2V5cxgDIAMoCRIYChBkZXNjcmlwdGlvbl9rZXlzGAQgAygJQnsKIGlvLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxQgtDb21tb25Qcm90b1ABWihnby5vcGVudGVsZW1ldHJ5LmlvL3Byb3RvL290bHAvY29tbW9uL3YxqgIdT3BlblRlbGVtZXRyeS5Qcm90by5Db21tb24uVjFiBnByb3RvMw\");\n\n/**\n * Represents any type of attribute value. AnyValue may contain a\n * primitive value such as a string or integer or it may contain an arbitrary nested\n * object containing arrays, key-value lists and primitives.\n *\n * @generated from message opentelemetry.proto.common.v1.AnyValue\n */\nexport type AnyValue = Message<\"opentelemetry.proto.common.v1.AnyValue\"> & {\n /**\n * The value is one of the listed fields. It is valid for all values to be unspecified\n * in which case this AnyValue is considered to be \"empty\".\n *\n * @generated from oneof opentelemetry.proto.common.v1.AnyValue.value\n */\n value: {\n /**\n * @generated from field: string string_value = 1;\n */\n value: string;\n case: \"stringValue\";\n } | {\n /**\n * @generated from field: bool bool_value = 2;\n */\n value: boolean;\n case: \"boolValue\";\n } | {\n /**\n * @generated from field: int64 int_value = 3;\n */\n value: bigint;\n case: \"intValue\";\n } | {\n /**\n * @generated from field: double double_value = 4;\n */\n value: number;\n case: \"doubleValue\";\n } | {\n /**\n * @generated from field: opentelemetry.proto.common.v1.ArrayValue array_value = 5;\n */\n value: ArrayValue;\n case: \"arrayValue\";\n } | {\n /**\n * @generated from field: opentelemetry.proto.common.v1.KeyValueList kvlist_value = 6;\n */\n value: KeyValueList;\n case: \"kvlistValue\";\n } | {\n /**\n * @generated from field: bytes bytes_value = 7;\n */\n value: Uint8Array;\n case: \"bytesValue\";\n } | {\n /**\n * Reference to the string value in ProfilesDictionary.string_table.\n *\n * Note: This is currently used exclusively in the Profiling signal.\n * Implementers of OTLP receivers for signals other than Profiling should\n * treat the presence of this value as a non-fatal issue.\n * Log an error or warning indicating an unexpected field intended for the\n * Profiling signal and process the data as if this value were absent or\n * empty, ignoring its semantic content for the non-Profiling signal.\n *\n * Status: [Alpha]\n *\n * [Since v1.10.0]\n *\n * @generated from field: int32 string_value_strindex = 8;\n */\n value: number;\n case: \"stringValueStrindex\";\n } | { case: undefined; value?: undefined };\n};\n\n/**\n * Describes the message opentelemetry.proto.common.v1.AnyValue.\n * Use `create(AnyValueSchema)` to create a new message.\n */\nexport const AnyValueSchema: GenMessage<AnyValue> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_common_v1_common, 0);\n\n/**\n * ArrayValue is a list of AnyValue messages. We need ArrayValue as a message\n * since oneof in AnyValue does not allow repeated fields.\n *\n * @generated from message opentelemetry.proto.common.v1.ArrayValue\n */\nexport type ArrayValue = Message<\"opentelemetry.proto.common.v1.ArrayValue\"> & {\n /**\n * Array of values. The array may be empty (contain 0 elements).\n *\n * @generated from field: repeated opentelemetry.proto.common.v1.AnyValue values = 1;\n */\n values: AnyValue[];\n};\n\n/**\n * Describes the message opentelemetry.proto.common.v1.ArrayValue.\n * Use `create(ArrayValueSchema)` to create a new message.\n */\nexport const ArrayValueSchema: GenMessage<ArrayValue> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_common_v1_common, 1);\n\n/**\n * KeyValueList is a list of KeyValue messages. We need KeyValueList as a message\n * since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need\n * a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to\n * avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches\n * are semantically equivalent.\n *\n * @generated from message opentelemetry.proto.common.v1.KeyValueList\n */\nexport type KeyValueList = Message<\"opentelemetry.proto.common.v1.KeyValueList\"> & {\n /**\n * A collection of key/value pairs of key-value pairs. The list may be empty (may\n * contain 0 elements).\n *\n * The keys MUST be unique (it is not allowed to have more than one\n * value with the same key).\n * The behavior of software that receives duplicated keys can be unpredictable.\n *\n * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue values = 1;\n */\n values: KeyValue[];\n};\n\n/**\n * Describes the message opentelemetry.proto.common.v1.KeyValueList.\n * Use `create(KeyValueListSchema)` to create a new message.\n */\nexport const KeyValueListSchema: GenMessage<KeyValueList> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_common_v1_common, 2);\n\n/**\n * Represents a key-value pair that is used to store Span attributes, Link\n * attributes, etc.\n *\n * @generated from message opentelemetry.proto.common.v1.KeyValue\n */\nexport type KeyValue = Message<\"opentelemetry.proto.common.v1.KeyValue\"> & {\n /**\n * The key name of the pair.\n * key_strindex MUST NOT be set if key is used.\n *\n * @generated from field: string key = 1;\n */\n key: string;\n\n /**\n * The value of the pair.\n *\n * @generated from field: opentelemetry.proto.common.v1.AnyValue value = 2;\n */\n value?: AnyValue | undefined;\n\n /**\n * Reference to the string key in ProfilesDictionary.string_table.\n * key MUST NOT be set if key_strindex is used.\n *\n * Note: This is currently used exclusively in the Profiling signal.\n * Implementers of OTLP receivers for signals other than Profiling should\n * treat the presence of this key as a non-fatal issue.\n * Log an error or warning indicating an unexpected field intended for the\n * Profiling signal and process the data as if this value were absent or\n * empty, ignoring its semantic content for the non-Profiling signal.\n *\n * Status: [Alpha]\n *\n * [Since v1.10.0]\n *\n * @generated from field: int32 key_strindex = 3;\n */\n keyStrindex: number;\n};\n\n/**\n * Describes the message opentelemetry.proto.common.v1.KeyValue.\n * Use `create(KeyValueSchema)` to create a new message.\n */\nexport const KeyValueSchema: GenMessage<KeyValue> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_common_v1_common, 3);\n\n/**\n * InstrumentationScope is a message representing the instrumentation scope information\n * such as the fully qualified name and version. \n *\n * @generated from message opentelemetry.proto.common.v1.InstrumentationScope\n */\nexport type InstrumentationScope = Message<\"opentelemetry.proto.common.v1.InstrumentationScope\"> & {\n /**\n * A name denoting the Instrumentation scope.\n * An empty instrumentation scope name means the name is unknown.\n *\n * @generated from field: string name = 1;\n */\n name: string;\n\n /**\n * Defines the version of the instrumentation scope.\n * An empty instrumentation scope version means the version is unknown.\n *\n * @generated from field: string version = 2;\n */\n version: string;\n\n /**\n * Additional attributes that describe the scope. [Optional].\n * Attribute keys MUST be unique (it is not allowed to have more than one\n * attribute with the same key).\n * The behavior of software that receives duplicated keys can be unpredictable.\n *\n * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 3;\n */\n attributes: KeyValue[];\n\n /**\n * The number of attributes that were discarded. Attributes\n * can be discarded because their keys are too long or because there are too many\n * attributes. If this value is 0, then no attributes were dropped.\n *\n * @generated from field: uint32 dropped_attributes_count = 4;\n */\n droppedAttributesCount: number;\n};\n\n/**\n * Describes the message opentelemetry.proto.common.v1.InstrumentationScope.\n * Use `create(InstrumentationScopeSchema)` to create a new message.\n */\nexport const InstrumentationScopeSchema: GenMessage<InstrumentationScope> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_common_v1_common, 4);\n\n/**\n * A reference to an Entity.\n * Entity represents an object of interest associated with produced telemetry: e.g spans, metrics, profiles, or logs.\n *\n * Status: [Development]\n *\n * [Since v1.6.0]\n *\n * @generated from message opentelemetry.proto.common.v1.EntityRef\n */\nexport type EntityRef = Message<\"opentelemetry.proto.common.v1.EntityRef\"> & {\n /**\n * The Schema URL, if known. This is the identifier of the Schema that the entity data\n * is recorded in. To learn more about Schema URL see\n * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url\n *\n * This schema_url applies to the data in this message and to the Resource attributes\n * referenced by id_keys and description_keys.\n * TODO: discuss if we are happy with this somewhat complicated definition of what\n * the schema_url applies to.\n *\n * This field obsoletes the schema_url field in ResourceMetrics/ResourceSpans/ResourceLogs.\n *\n * @generated from field: string schema_url = 1;\n */\n schemaUrl: string;\n\n /**\n * Defines the type of the entity. MUST not change during the lifetime of the entity.\n * For example: \"service\" or \"host\". This field is required and MUST not be empty\n * for valid entities.\n *\n * @generated from field: string type = 2;\n */\n type: string;\n\n /**\n * Attribute Keys that identify the entity.\n * MUST not change during the lifetime of the entity. The Id must contain at least one attribute.\n * These keys MUST exist in the containing {message}.attributes.\n *\n * @generated from field: repeated string id_keys = 3;\n */\n idKeys: string[];\n\n /**\n * Descriptive (non-identifying) attribute keys of the entity.\n * MAY change over the lifetime of the entity. MAY be empty.\n * These attribute keys are not part of entity's identity.\n * These keys MUST exist in the containing {message}.attributes.\n *\n * @generated from field: repeated string description_keys = 4;\n */\n descriptionKeys: string[];\n};\n\n/**\n * Describes the message opentelemetry.proto.common.v1.EntityRef.\n * Use `create(EntityRefSchema)` to create a new message.\n */\nexport const EntityRefSchema: GenMessage<EntityRef> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_common_v1_common, 5);\n\n","// Copyright 2019, OpenTelemetry Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// @generated by protoc-gen-es v2.16.0 with parameter \"target=ts,import_extension=ts\"\n// @generated from file opentelemetry/proto/resource/v1/resource.proto (package opentelemetry.proto.resource.v1, syntax proto3)\n/* eslint-disable */\n\nimport type { GenFile, GenMessage } from \"@bufbuild/protobuf/codegenv2\";\nimport { fileDesc, messageDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport type { EntityRef, KeyValue } from \"../../common/v1/common_pb.ts\";\nimport { file_opentelemetry_proto_common_v1_common } from \"../../common/v1/common_pb.ts\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file opentelemetry/proto/resource/v1/resource.proto.\n */\nexport const file_opentelemetry_proto_resource_v1_resource: GenFile = /*@__PURE__*/\n fileDesc(\"Ci5vcGVudGVsZW1ldHJ5L3Byb3RvL3Jlc291cmNlL3YxL3Jlc291cmNlLnByb3RvEh9vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxIqgBCghSZXNvdXJjZRI7CgphdHRyaWJ1dGVzGAEgAygLMicub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuS2V5VmFsdWUSIAoYZHJvcHBlZF9hdHRyaWJ1dGVzX2NvdW50GAIgASgNEj0KC2VudGl0eV9yZWZzGAMgAygLMigub3BlbnRlbGVtZXRyeS5wcm90by5jb21tb24udjEuRW50aXR5UmVmQoMBCiJpby5vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxQg1SZXNvdXJjZVByb3RvUAFaKmdvLm9wZW50ZWxlbWV0cnkuaW8vcHJvdG8vb3RscC9yZXNvdXJjZS92MaoCH09wZW5UZWxlbWV0cnkuUHJvdG8uUmVzb3VyY2UuVjFiBnByb3RvMw\", [file_opentelemetry_proto_common_v1_common]);\n\n/**\n * Resource information.\n *\n * @generated from message opentelemetry.proto.resource.v1.Resource\n */\nexport type Resource = Message<\"opentelemetry.proto.resource.v1.Resource\"> & {\n /**\n * Set of attributes that describe the resource.\n * Attribute keys MUST be unique (it is not allowed to have more than one\n * attribute with the same key).\n * The behavior of software that receives duplicated keys can be unpredictable.\n *\n * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 1;\n */\n attributes: KeyValue[];\n\n /**\n * The number of dropped attributes. If the value is 0, then\n * no attributes were dropped.\n *\n * @generated from field: uint32 dropped_attributes_count = 2;\n */\n droppedAttributesCount: number;\n\n /**\n * Set of entities that participate in this Resource.\n *\n * Note: keys in the references MUST exist in attributes of this message.\n *\n * Status: [Development]\n *\n * [Since v1.6.0]\n *\n * @generated from field: repeated opentelemetry.proto.common.v1.EntityRef entity_refs = 3;\n */\n entityRefs: EntityRef[];\n};\n\n/**\n * Describes the message opentelemetry.proto.resource.v1.Resource.\n * Use `create(ResourceSchema)` to create a new message.\n */\nexport const ResourceSchema: GenMessage<Resource> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_resource_v1_resource, 0);\n\n","// Copyright 2020, OpenTelemetry Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// @generated by protoc-gen-es v2.16.0 with parameter \"target=ts,import_extension=ts\"\n// @generated from file opentelemetry/proto/logs/v1/logs.proto (package opentelemetry.proto.logs.v1, syntax proto3)\n/* eslint-disable */\n\nimport type { GenEnum, GenFile, GenMessage } from \"@bufbuild/protobuf/codegenv2\";\nimport { enumDesc, fileDesc, messageDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport type { AnyValue, InstrumentationScope, KeyValue } from \"../../common/v1/common_pb.ts\";\nimport { file_opentelemetry_proto_common_v1_common } from \"../../common/v1/common_pb.ts\";\nimport type { Resource } from \"../../resource/v1/resource_pb.ts\";\nimport { file_opentelemetry_proto_resource_v1_resource } from \"../../resource/v1/resource_pb.ts\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file opentelemetry/proto/logs/v1/logs.proto.\n */\nexport const file_opentelemetry_proto_logs_v1_logs: GenFile = /*@__PURE__*/\n fileDesc(\"CiZvcGVudGVsZW1ldHJ5L3Byb3RvL2xvZ3MvdjEvbG9ncy5wcm90bxIbb3BlbnRlbGVtZXRyeS5wcm90by5sb2dzLnYxIkwKCExvZ3NEYXRhEkAKDXJlc291cmNlX2xvZ3MYASADKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLmxvZ3MudjEuUmVzb3VyY2VMb2dzIqMBCgxSZXNvdXJjZUxvZ3MSOwoIcmVzb3VyY2UYASABKAsyKS5vcGVudGVsZW1ldHJ5LnBy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elemetry_proto_resource_v1_resource]);\n\n/**\n * LogsData represents the logs data that can be stored in a persistent storage,\n * OR can be embedded by other protocols that transfer OTLP logs data but do not\n * implement the OTLP protocol.\n *\n * The main difference between this message and collector protocol is that\n * in this message there will not be any \"control\" or \"metadata\" specific to\n * OTLP protocol.\n *\n * When new fields are added into this message, the OTLP request MUST be updated\n * as well.\n *\n * @generated from message opentelemetry.proto.logs.v1.LogsData\n */\nexport type LogsData = Message<\"opentelemetry.proto.logs.v1.LogsData\"> & {\n /**\n * An array of ResourceLogs.\n * For data coming from a single resource this array will typically contain\n * one element. Intermediary nodes that receive data from multiple origins\n * typically batch the data before forwarding further and in that case this\n * array will contain multiple elements.\n *\n * @generated from field: repeated opentelemetry.proto.logs.v1.ResourceLogs resource_logs = 1;\n */\n resourceLogs: ResourceLogs[];\n};\n\n/**\n * Describes the message opentelemetry.proto.logs.v1.LogsData.\n * Use `create(LogsDataSchema)` to create a new message.\n */\nexport const LogsDataSchema: GenMessage<LogsData> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_logs_v1_logs, 0);\n\n/**\n * A collection of ScopeLogs from a Resource.\n *\n * @generated from message opentelemetry.proto.logs.v1.ResourceLogs\n */\nexport type ResourceLogs = Message<\"opentelemetry.proto.logs.v1.ResourceLogs\"> & {\n /**\n * The resource for the logs in this message.\n * If this field is not set then resource info is unknown.\n *\n * @generated from field: opentelemetry.proto.resource.v1.Resource resource = 1;\n */\n resource?: Resource | undefined;\n\n /**\n * A list of ScopeLogs that originate from a resource.\n *\n * @generated from field: repeated opentelemetry.proto.logs.v1.ScopeLogs scope_logs = 2;\n */\n scopeLogs: ScopeLogs[];\n\n /**\n * The Schema URL, if known. This is the identifier of the Schema that the resource data\n * is recorded in. Notably, the last part of the URL path is the version number of the\n * schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see\n * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url\n * This schema_url applies to the data in the \"resource\" field. It does not apply\n * to the data in the \"scope_logs\" field which have their own schema_url field.\n *\n * @generated from field: string schema_url = 3;\n */\n schemaUrl: string;\n};\n\n/**\n * Describes the message opentelemetry.proto.logs.v1.ResourceLogs.\n * Use `create(ResourceLogsSchema)` to create a new message.\n */\nexport const ResourceLogsSchema: GenMessage<ResourceLogs> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_logs_v1_logs, 1);\n\n/**\n * A collection of Logs produced by a Scope.\n *\n * @generated from message opentelemetry.proto.logs.v1.ScopeLogs\n */\nexport type ScopeLogs = Message<\"opentelemetry.proto.logs.v1.ScopeLogs\"> & {\n /**\n * The instrumentation scope information for the logs in this message.\n * Semantically when InstrumentationScope isn't set, it is equivalent with\n * an empty instrumentation scope name (unknown).\n *\n * @generated from field: opentelemetry.proto.common.v1.InstrumentationScope scope = 1;\n */\n scope?: InstrumentationScope | undefined;\n\n /**\n * A list of log records.\n *\n * @generated from field: repeated opentelemetry.proto.logs.v1.LogRecord log_records = 2;\n */\n logRecords: LogRecord[];\n\n /**\n * The Schema URL, if known. This is the identifier of the Schema that the log data\n * is recorded in. Notably, the last part of the URL path is the version number of the\n * schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see\n * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url\n * This schema_url applies to the data in the \"scope\" field and all logs in the\n * \"log_records\" field.\n *\n * @generated from field: string schema_url = 3;\n */\n schemaUrl: string;\n};\n\n/**\n * Describes the message opentelemetry.proto.logs.v1.ScopeLogs.\n * Use `create(ScopeLogsSchema)` to create a new message.\n */\nexport const ScopeLogsSchema: GenMessage<ScopeLogs> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_logs_v1_logs, 2);\n\n/**\n * A log record according to OpenTelemetry Log Data Model:\n * https://github.com/open-telemetry/oteps/blob/main/text/logs/0097-log-data-model.md\n *\n * @generated from message opentelemetry.proto.logs.v1.LogRecord\n */\nexport type LogRecord = Message<\"opentelemetry.proto.logs.v1.LogRecord\"> & {\n /**\n * time_unix_nano is the time when the event occurred.\n * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.\n * Value of 0 indicates unknown or missing timestamp.\n *\n * @generated from field: fixed64 time_unix_nano = 1;\n */\n timeUnixNano: bigint;\n\n /**\n * Time when the event was observed by the collection system.\n * For events that originate in OpenTelemetry (e.g. using OpenTelemetry Logging SDK)\n * this timestamp is typically set at the generation time and is equal to Timestamp.\n * For events originating externally and collected by OpenTelemetry (e.g. using\n * Collector) this is the time when OpenTelemetry's code observed the event measured\n * by the clock of the OpenTelemetry code. This field MUST be set once the event is\n * observed by OpenTelemetry.\n *\n * For converting OpenTelemetry log data to formats that support only one timestamp or\n * when receiving OpenTelemetry log data by recipients that support only one timestamp\n * internally the following logic is recommended:\n * - Use time_unix_nano if it is present, otherwise use observed_time_unix_nano.\n *\n * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.\n * Value of 0 indicates unknown or missing timestamp.\n *\n * @generated from field: fixed64 observed_time_unix_nano = 11;\n */\n observedTimeUnixNano: bigint;\n\n /**\n * Numerical value of the severity, normalized to values described in Log Data Model.\n * [Optional].\n *\n * @generated from field: opentelemetry.proto.logs.v1.SeverityNumber severity_number = 2;\n */\n severityNumber: SeverityNumber;\n\n /**\n * The severity text (also known as log level). The original string representation as\n * it is known at the source. [Optional].\n *\n * @generated from field: string severity_text = 3;\n */\n severityText: string;\n\n /**\n * A value containing the body of the log record. Can be for example a human-readable\n * string message (including multi-line) describing the event in a free form or it can\n * be a structured data composed of arrays and maps of other values. [Optional].\n *\n * @generated from field: opentelemetry.proto.common.v1.AnyValue body = 5;\n */\n body?: AnyValue | undefined;\n\n /**\n * Additional attributes that describe the specific event occurrence. [Optional].\n * Attribute keys MUST be unique (it is not allowed to have more than one\n * attribute with the same key).\n * The behavior of software that receives duplicated keys can be unpredictable.\n *\n * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 6;\n */\n attributes: KeyValue[];\n\n /**\n * @generated from field: uint32 dropped_attributes_count = 7;\n */\n droppedAttributesCount: number;\n\n /**\n * Flags, a bit field. 8 least significant bits are the trace flags as\n * defined in W3C Trace Context specification. 24 most significant bits are reserved\n * and must be set to 0. Readers must not assume that 24 most significant bits\n * will be zero and must correctly mask the bits when reading 8-bit trace flag (use\n * flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK). [Optional].\n *\n * @generated from field: fixed32 flags = 8;\n */\n flags: number;\n\n /**\n * A unique identifier for a trace. All logs from the same trace share\n * the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR\n * of length other than 16 bytes is considered invalid (empty string in OTLP/JSON\n * is zero-length and thus is also invalid).\n *\n * This field is optional.\n *\n * The receivers SHOULD assume that the log record is not associated with a\n * trace if any of the following is true:\n * - the field is not present,\n * - the field contains an invalid value.\n *\n * @generated from field: bytes trace_id = 9;\n */\n traceId: Uint8Array;\n\n /**\n * A unique identifier for a span within a trace, assigned when the span\n * is created. The ID is an 8-byte array. An ID with all zeroes OR of length\n * other than 8 bytes is considered invalid (empty string in OTLP/JSON\n * is zero-length and thus is also invalid).\n *\n * This field is optional. If the sender specifies a valid span_id then it SHOULD also\n * specify a valid trace_id.\n *\n * The receivers SHOULD assume that the log record is not associated with a\n * span if any of the following is true:\n * - the field is not present,\n * - the field contains an invalid value.\n *\n * @generated from field: bytes span_id = 10;\n */\n spanId: Uint8Array;\n\n /**\n * A unique identifier of event category/type.\n * All events with the same event_name are expected to conform to the same\n * schema for both their attributes and their body.\n *\n * Recommended to be fully qualified and short (no longer than 256 characters).\n *\n * Presence of event_name on the log record identifies this record\n * as an event.\n *\n * [Optional].\n *\n * [Since v1.5.0]\n *\n * @generated from field: string event_name = 12;\n */\n eventName: string;\n};\n\n/**\n * Describes the message opentelemetry.proto.logs.v1.LogRecord.\n * Use `create(LogRecordSchema)` to create a new message.\n */\nexport const LogRecordSchema: GenMessage<LogRecord> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_logs_v1_logs, 3);\n\n/**\n * Possible values for LogRecord.SeverityNumber.\n *\n * @generated from enum opentelemetry.proto.logs.v1.SeverityNumber\n */\nexport enum SeverityNumber {\n /**\n * @generated from enum value: SEVERITY_NUMBER_UNSPECIFIED = 0;\n */\n UNSPECIFIED = 0,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_TRACE = 1;\n */\n TRACE = 1,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_TRACE2 = 2;\n */\n TRACE2 = 2,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_TRACE3 = 3;\n */\n TRACE3 = 3,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_TRACE4 = 4;\n */\n TRACE4 = 4,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_DEBUG = 5;\n */\n DEBUG = 5,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_DEBUG2 = 6;\n */\n DEBUG2 = 6,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_DEBUG3 = 7;\n */\n DEBUG3 = 7,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_DEBUG4 = 8;\n */\n DEBUG4 = 8,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_INFO = 9;\n */\n INFO = 9,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_INFO2 = 10;\n */\n INFO2 = 10,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_INFO3 = 11;\n */\n INFO3 = 11,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_INFO4 = 12;\n */\n INFO4 = 12,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_WARN = 13;\n */\n WARN = 13,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_WARN2 = 14;\n */\n WARN2 = 14,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_WARN3 = 15;\n */\n WARN3 = 15,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_WARN4 = 16;\n */\n WARN4 = 16,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_ERROR = 17;\n */\n ERROR = 17,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_ERROR2 = 18;\n */\n ERROR2 = 18,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_ERROR3 = 19;\n */\n ERROR3 = 19,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_ERROR4 = 20;\n */\n ERROR4 = 20,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_FATAL = 21;\n */\n FATAL = 21,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_FATAL2 = 22;\n */\n FATAL2 = 22,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_FATAL3 = 23;\n */\n FATAL3 = 23,\n\n /**\n * @generated from enum value: SEVERITY_NUMBER_FATAL4 = 24;\n */\n FATAL4 = 24,\n}\n\n/**\n * Describes the enum opentelemetry.proto.logs.v1.SeverityNumber.\n */\nexport const SeverityNumberSchema: GenEnum<SeverityNumber> = /*@__PURE__*/\n enumDesc(file_opentelemetry_proto_logs_v1_logs, 0);\n\n/**\n * LogRecordFlags represents constants used to interpret the\n * LogRecord.flags field, which is protobuf 'fixed32' type and is to\n * be used as bit-fields. Each non-zero value defined in this enum is\n * a bit-mask. To extract the bit-field, for example, use an\n * expression like:\n *\n * (logRecord.flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK)\n *\n *\n * @generated from enum opentelemetry.proto.logs.v1.LogRecordFlags\n */\nexport enum LogRecordFlags {\n /**\n * The zero value for the enum. Should not be used for comparisons.\n * Instead use bitwise \"and\" with the appropriate mask as shown above.\n *\n * @generated from enum value: LOG_RECORD_FLAGS_DO_NOT_USE = 0;\n */\n DO_NOT_USE = 0,\n\n /**\n * Bits 0-7 are used for trace flags.\n *\n * @generated from enum value: LOG_RECORD_FLAGS_TRACE_FLAGS_MASK = 255;\n */\n TRACE_FLAGS_MASK = 255,\n}\n\n/**\n * Describes the enum opentelemetry.proto.logs.v1.LogRecordFlags.\n */\nexport const LogRecordFlagsSchema: GenEnum<LogRecordFlags> = /*@__PURE__*/\n enumDesc(file_opentelemetry_proto_logs_v1_logs, 1);\n\n","// Copyright 2020, OpenTelemetry Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// @generated by protoc-gen-es v2.16.0 with parameter \"target=ts,import_extension=ts\"\n// @generated from file opentelemetry/proto/collector/logs/v1/logs_service.proto (package opentelemetry.proto.collector.logs.v1, syntax proto3)\n/* eslint-disable */\n\nimport type { GenFile, GenMessage, GenService } from \"@bufbuild/protobuf/codegenv2\";\nimport { fileDesc, messageDesc, serviceDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport type { ResourceLogs } from \"../../../logs/v1/logs_pb.ts\";\nimport { file_opentelemetry_proto_logs_v1_logs } from \"../../../logs/v1/logs_pb.ts\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file opentelemetry/proto/collector/logs/v1/logs_service.proto.\n */\nexport const file_opentelemetry_proto_collector_logs_v1_logs_service: GenFile = /*@__PURE__*/\n fileDesc(\"CjhvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbGxlY3Rvci9sb2dzL3YxL2xvZ3Nfc2VydmljZS5wcm90bxIlb3BlbnRlbGVtZXRyeS5wcm90by5jb2xsZWN0b3IubG9ncy52MSJcChhFeHBvcnRMb2dzU2VydmljZVJlcXVlc3QSQAoNcmVzb3VyY2VfbG9ncxgBIAMoCzIpLm9wZW50ZWxlbWV0cnkucHJvdG8ubG9ncy52MS5SZXNvdXJjZUxvZ3MidQoZRXhwb3J0TG9nc1NlcnZpY2VSZXNwb25zZRJYCg9wYXJ0aWFsX3N1Y2Nlc3MYASABKAsyPy5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci5sb2dzLnYxLkV4cG9ydExvZ3NQYXJ0aWFsU3VjY2VzcyJPChhFeHBvcnRMb2dzUGFydGlhbFN1Y2Nlc3MSHAoUcmVqZWN0ZWRfbG9nX3JlY29yZHMYASABKAMSFQoNZXJyb3JfbWVzc2FnZRgCIAEoCTKdAQoLTG9nc1NlcnZpY2USjQEKBkV4cG9ydBI/Lm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLmxvZ3MudjEuRXhwb3J0TG9nc1NlcnZpY2VSZXF1ZXN0GkAub3BlbnRlbGVtZXRyeS5wcm90by5jb2xsZWN0b3IubG9ncy52MS5FeHBvcnRMb2dzU2VydmljZVJlc3BvbnNlIgBCmAEKKGlvLm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLmxvZ3MudjFCEExvZ3NTZXJ2aWNlUHJvdG9QAVowZ28ub3BlbnRlbGVtZXRyeS5pby9wcm90by9vdGxwL2NvbGxlY3Rvci9sb2dzL3YxqgIlT3BlblRlbGVtZXRyeS5Qcm90by5Db2xsZWN0b3IuTG9ncy5WMWIGcHJvdG8z\", [file_opentelemetry_proto_logs_v1_logs]);\n\n/**\n * @generated from message opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest\n */\nexport type ExportLogsServiceRequest = Message<\"opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest\"> & {\n /**\n * An array of ResourceLogs.\n * For data coming from a single resource this array will typically contain one\n * element. Intermediary nodes (such as OpenTelemetry Collector) that receive\n * data from multiple origins typically batch the data before forwarding further and\n * in that case this array will contain multiple elements.\n *\n * @generated from field: repeated opentelemetry.proto.logs.v1.ResourceLogs resource_logs = 1;\n */\n resourceLogs: ResourceLogs[];\n};\n\n/**\n * Describes the message opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.\n * Use `create(ExportLogsServiceRequestSchema)` to create a new message.\n */\nexport const ExportLogsServiceRequestSchema: GenMessage<ExportLogsServiceRequest> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_collector_logs_v1_logs_service, 0);\n\n/**\n * @generated from message opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse\n */\nexport type ExportLogsServiceResponse = Message<\"opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse\"> & {\n /**\n * The details of a partially successful export request.\n *\n * If the request is only partially accepted\n * (i.e. when the server accepts only parts of the data and rejects the rest)\n * the server MUST initialize the `partial_success` field and MUST\n * set the `rejected_<signal>` with the number of items it rejected.\n *\n * Servers MAY also make use of the `partial_success` field to convey\n * warnings/suggestions to senders even when the request was fully accepted.\n * In such cases, the `rejected_<signal>` MUST have a value of `0` and\n * the `error_message` MUST be non-empty.\n *\n * A `partial_success` message with an empty value (rejected_<signal> = 0 and\n * `error_message` = \"\") is equivalent to it not being set/present. Senders\n * SHOULD interpret it the same way as in the full success case.\n *\n * @generated from field: opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess partial_success = 1;\n */\n partialSuccess?: ExportLogsPartialSuccess | undefined;\n};\n\n/**\n * Describes the message opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.\n * Use `create(ExportLogsServiceResponseSchema)` to create a new message.\n */\nexport const ExportLogsServiceResponseSchema: GenMessage<ExportLogsServiceResponse> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_collector_logs_v1_logs_service, 1);\n\n/**\n * @generated from message opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess\n */\nexport type ExportLogsPartialSuccess = Message<\"opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess\"> & {\n /**\n * The number of rejected log records.\n *\n * A `rejected_<signal>` field holding a `0` value indicates that the\n * request was fully accepted.\n *\n * @generated from field: int64 rejected_log_records = 1;\n */\n rejectedLogRecords: bigint;\n\n /**\n * A developer-facing human-readable message in English. It should be used\n * either to explain why the server rejected parts of the data during a partial\n * success or to convey warnings/suggestions during a full success. The message\n * should offer guidance on how users can address such issues.\n *\n * error_message is an optional field. An error_message with an empty value\n * is equivalent to it not being set.\n *\n * @generated from field: string error_message = 2;\n */\n errorMessage: string;\n};\n\n/**\n * Describes the message opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.\n * Use `create(ExportLogsPartialSuccessSchema)` to create a new message.\n */\nexport const ExportLogsPartialSuccessSchema: GenMessage<ExportLogsPartialSuccess> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_collector_logs_v1_logs_service, 2);\n\n/**\n * Service that can be used to push logs between one Application instrumented with\n * OpenTelemetry and an collector, or between an collector and a central collector (in this\n * case logs are sent/received to/from multiple Applications).\n *\n * @generated from service opentelemetry.proto.collector.logs.v1.LogsService\n */\nexport const LogsService: GenService<{\n /**\n * @generated from rpc opentelemetry.proto.collector.logs.v1.LogsService.Export\n */\n export: {\n methodKind: \"unary\";\n input: typeof ExportLogsServiceRequestSchema;\n output: typeof ExportLogsServiceResponseSchema;\n },\n}> = /*@__PURE__*/\n serviceDesc(file_opentelemetry_proto_collector_logs_v1_logs_service, 0);\n\n","// Copyright 2019, OpenTelemetry Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// @generated by protoc-gen-es v2.16.0 with parameter \"target=ts,import_extension=ts\"\n// @generated from file opentelemetry/proto/trace/v1/trace.proto (package opentelemetry.proto.trace.v1, syntax proto3)\n/* eslint-disable */\n\nimport type { GenEnum, GenFile, GenMessage } from \"@bufbuild/protobuf/codegenv2\";\nimport { enumDesc, fileDesc, messageDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport type { InstrumentationScope, KeyValue } from \"../../common/v1/common_pb.ts\";\nimport { file_opentelemetry_proto_common_v1_common } from \"../../common/v1/common_pb.ts\";\nimport type { Resource } from \"../../resource/v1/resource_pb.ts\";\nimport { file_opentelemetry_proto_resource_v1_resource } from \"../../resource/v1/resource_pb.ts\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file opentelemetry/proto/trace/v1/trace.proto.\n */\nexport const file_opentelemetry_proto_trace_v1_trace: GenFile = /*@__PURE__*/\n fileDesc(\"CihvcGVudGVsZW1ldHJ5L3Byb3RvL3RyYWNlL3YxL3RyYWNlLnByb3RvEhxvcGVudGVsZW1ldHJ5LnByb3RvLnRyYWNlLnYxIlEKClRyYWNlc0RhdGESQwoOcmVzb3VyY2Vfc3BhbnMYASADKAsyKy5vcGVudGVsZW1ldHJ5LnByb3RvLnRyYWNlLnYxLlJlc291cmNlU3BhbnMipwEKDVJlc291cmNlU3BhbnMSOwoIcmVzb3VyY2UYASABKAsyKS5vcGVudGVsZW1ldHJ5LnByb3RvLnJlc291cmNlLnYxLlJlc291cmNlEj0KC3Njb3BlX3NwYW5zGAIgAygLMigub3BlbnRlbGVtZXRyeS5wcm90by50cmFjZS52MS5TY29wZVNwYW5zEhIKCnNjaGVtYV91cmwYAyABKAlKBgjoBxDpByKXAQoKU2NvcGVTcGFucxJCCgVzY29wZRgBIAEoCzIzLm9wZW50ZWxlbWV0cnkucHJvdG8uY29tbW9uLnYxLkluc3RydW1lbnRhdGlvblNjb3BlEjEKBXNwYW5zGAIgAygLMiIub3BlbnRlbGVtZXRyeS5wcm90by50cmFjZS52MS5TcGFuEhIKCnNjaGVtYV91cmwYAyABKAkihAgKBFNwYW4SEAoIdHJhY2VfaWQYASABKAwSDwoHc3Bhbl9pZBgCIAEoDBITCgt0cmFjZV9zdGF0ZRgDIAEoCRIWCg5wYXJlbnRfc3Bhbl9pZBgEIAEoDBINCgVmbGFncxgQIAEoBxIMCgRuYW1lGAUgASgJEjkKBGtpbmQYBiABKA4yKy5vcGVudGVsZW1ldHJ5LnByb3RvLnRyYWNlLnYxLlNwYW4uU3BhbktpbmQSHAoUc3RhcnRf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IWChJTUEFOX0tJTkRfQ09OU1VNRVIQBSKuAQoGU3RhdHVzEg8KB21lc3NhZ2UYAiABKAkSPQoEY29kZRgDIAEoDjIvLm9wZW50ZWxlbWV0cnkucHJvdG8udHJhY2UudjEuU3RhdHVzLlN0YXR1c0NvZGUiTgoKU3RhdHVzQ29kZRIVChFTVEFUVVNfQ09ERV9VTlNFVBAAEhIKDlNUQVRVU19DT0RFX09LEAESFQoRU1RBVFVTX0NPREVfRVJST1IQAkoECAEQAiqcAQoJU3BhbkZsYWdzEhkKFVNQQU5fRkxBR1NfRE9fTk9UX1VTRRAAEiAKG1NQQU5fRkxBR1NfVFJBQ0VfRkxBR1NfTUFTSxD/ARIqCiVTUEFOX0ZMQUdTX0NPTlRFWFRfSEFTX0lTX1JFTU9URV9NQVNLEIACEiYKIVNQQU5fRkxBR1NfQ09OVEVYVF9JU19SRU1PVEVfTUFTSxCABEJ3Ch9pby5vcGVudGVsZW1ldHJ5LnByb3RvLnRyYWNlLnYxQgpUcmFjZVByb3RvUAFaJ2dvLm9wZW50ZWxlbWV0cnkuaW8vcHJvdG8vb3RscC90cmFjZS92MaoCHE9wZW5UZWxlbWV0cnkuUHJvdG8uVHJhY2UuVjFiBnByb3RvMw\", [file_opentelemetry_proto_common_v1_common, file_opentelemetry_proto_resource_v1_resource]);\n\n/**\n * TracesData represents the traces data that can be stored in a persistent storage,\n * OR can be embedded by other protocols that transfer OTLP traces data but do\n * not implement the OTLP protocol.\n *\n * The main difference between this message and collector protocol is that\n * in this message there will not be any \"control\" or \"metadata\" specific to\n * OTLP protocol.\n *\n * When new fields are added into this message, the OTLP request MUST be updated\n * as well.\n *\n * @generated from message opentelemetry.proto.trace.v1.TracesData\n */\nexport type TracesData = Message<\"opentelemetry.proto.trace.v1.TracesData\"> & {\n /**\n * An array of ResourceSpans.\n * For data coming from a single resource this array will typically contain\n * one element. Intermediary nodes that receive data from multiple origins\n * typically batch the data before forwarding further and in that case this\n * array will contain multiple elements.\n *\n * @generated from field: repeated opentelemetry.proto.trace.v1.ResourceSpans resource_spans = 1;\n */\n resourceSpans: ResourceSpans[];\n};\n\n/**\n * Describes the message opentelemetry.proto.trace.v1.TracesData.\n * Use `create(TracesDataSchema)` to create a new message.\n */\nexport const TracesDataSchema: GenMessage<TracesData> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_trace_v1_trace, 0);\n\n/**\n * A collection of ScopeSpans from a Resource.\n *\n * @generated from message opentelemetry.proto.trace.v1.ResourceSpans\n */\nexport type ResourceSpans = Message<\"opentelemetry.proto.trace.v1.ResourceSpans\"> & {\n /**\n * The resource for the spans in this message.\n * If this field is not set then no resource info is known.\n *\n * @generated from field: opentelemetry.proto.resource.v1.Resource resource = 1;\n */\n resource?: Resource | undefined;\n\n /**\n * A list of ScopeSpans that originate from a resource.\n *\n * @generated from field: repeated opentelemetry.proto.trace.v1.ScopeSpans scope_spans = 2;\n */\n scopeSpans: ScopeSpans[];\n\n /**\n * The Schema URL, if known. This is the identifier of the Schema that the resource data\n * is recorded in. Notably, the last part of the URL path is the version number of the\n * schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see\n * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url\n * This schema_url applies to the data in the \"resource\" field. It does not apply\n * to the data in the \"scope_spans\" field which have their own schema_url field.\n *\n * @generated from field: string schema_url = 3;\n */\n schemaUrl: string;\n};\n\n/**\n * Describes the message opentelemetry.proto.trace.v1.ResourceSpans.\n * Use `create(ResourceSpansSchema)` to create a new message.\n */\nexport const ResourceSpansSchema: GenMessage<ResourceSpans> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_trace_v1_trace, 1);\n\n/**\n * A collection of Spans produced by an InstrumentationScope.\n *\n * @generated from message opentelemetry.proto.trace.v1.ScopeSpans\n */\nexport type ScopeSpans = Message<\"opentelemetry.proto.trace.v1.ScopeSpans\"> & {\n /**\n * The instrumentation scope information for the spans in this message.\n * Semantically when InstrumentationScope isn't set, it is equivalent with\n * an empty instrumentation scope name (unknown).\n *\n * @generated from field: opentelemetry.proto.common.v1.InstrumentationScope scope = 1;\n */\n scope?: InstrumentationScope | undefined;\n\n /**\n * A list of Spans that originate from an instrumentation scope.\n *\n * @generated from field: repeated opentelemetry.proto.trace.v1.Span spans = 2;\n */\n spans: Span[];\n\n /**\n * The Schema URL, if known. This is the identifier of the Schema that the span data\n * is recorded in. Notably, the last part of the URL path is the version number of the\n * schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see\n * https://opentelemetry.io/docs/specs/otel/schemas/#schema-url\n * This schema_url applies to the data in the \"scope\" field and all spans and span\n * events in the \"spans\" field.\n *\n * @generated from field: string schema_url = 3;\n */\n schemaUrl: string;\n};\n\n/**\n * Describes the message opentelemetry.proto.trace.v1.ScopeSpans.\n * Use `create(ScopeSpansSchema)` to create a new message.\n */\nexport const ScopeSpansSchema: GenMessage<ScopeSpans> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_trace_v1_trace, 2);\n\n/**\n * A Span represents a single operation performed by a single component of the system.\n *\n * The next available field id is 17.\n *\n * @generated from message opentelemetry.proto.trace.v1.Span\n */\nexport type Span = Message<\"opentelemetry.proto.trace.v1.Span\"> & {\n /**\n * A unique identifier for a trace. All spans from the same trace share\n * the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR\n * of length other than 16 bytes is considered invalid (empty string in OTLP/JSON\n * is zero-length and thus is also invalid).\n *\n * This field is required.\n *\n * @generated from field: bytes trace_id = 1;\n */\n traceId: Uint8Array;\n\n /**\n * A unique identifier for a span within a trace, assigned when the span\n * is created. The ID is an 8-byte array. An ID with all zeroes OR of length\n * other than 8 bytes is considered invalid (empty string in OTLP/JSON\n * is zero-length and thus is also invalid).\n *\n * This field is required.\n *\n * @generated from field: bytes span_id = 2;\n */\n spanId: Uint8Array;\n\n /**\n * trace_state conveys information about request position in multiple distributed tracing graphs.\n * It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header\n * See also https://github.com/w3c/distributed-tracing for more details about this field.\n *\n * @generated from field: string trace_state = 3;\n */\n traceState: string;\n\n /**\n * The `span_id` of this span's parent span. If this is a root span, then this\n * field must be empty. The ID is an 8-byte array.\n *\n * @generated from field: bytes parent_span_id = 4;\n */\n parentSpanId: Uint8Array;\n\n /**\n * Flags, a bit field.\n *\n * Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace\n * Context specification. To read the 8-bit W3C trace flag, use\n * `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.\n *\n * See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.\n *\n * Bits 8 and 9 represent the 3 states of whether a span's parent\n * is remote. The states are (unknown, is not remote, is remote).\n * To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.\n * To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.\n *\n * When creating span messages, if the message is logically forwarded from another source\n * with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD\n * be copied as-is. If creating from a source that does not have an equivalent flags field\n * (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST\n * be set to zero.\n * Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.\n *\n * [Optional].\n *\n * [Since v1.1.0]\n *\n * @generated from field: fixed32 flags = 16;\n */\n flags: number;\n\n /**\n * A description of the span's operation.\n *\n * For example, the name can be a qualified method name or a file name\n * and a line number where the operation is called. A best practice is to use\n * the same display name at the same call point in an application.\n * This makes it easier to correlate spans in different traces.\n *\n * This field is semantically required to be set to non-empty string.\n * Empty value is equivalent to an unknown span name.\n *\n * This field is required.\n *\n * @generated from field: string name = 5;\n */\n name: string;\n\n /**\n * Distinguishes between spans generated in a particular context. For example,\n * two spans with the same name may be distinguished using `CLIENT` (caller)\n * and `SERVER` (callee) to identify queueing latency associated with the span.\n *\n * @generated from field: opentelemetry.proto.trace.v1.Span.SpanKind kind = 6;\n */\n kind: Span_SpanKind;\n\n /**\n * The start time of the span. On the client side, this is the time\n * kept by the local machine where the span execution starts. On the server side, this\n * is the time when the server's application handler starts running.\n * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.\n *\n * This field is semantically required and it is expected that end_time >= start_time.\n *\n * @generated from field: fixed64 start_time_unix_nano = 7;\n */\n startTimeUnixNano: bigint;\n\n /**\n * The end time of the span. On the client side, this is the time\n * kept by the local machine where the span execution ends. On the server side, this\n * is the time when the server application handler stops running.\n * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.\n *\n * This field is semantically required and it is expected that end_time >= start_time.\n *\n * @generated from field: fixed64 end_time_unix_nano = 8;\n */\n endTimeUnixNano: bigint;\n\n /**\n * A collection of key/value pairs. Note, global attributes\n * like service name can be set using the resource API. Examples of attributes:\n *\n * \"user_agent.original\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36\"\n * \"http.response.status_code\": 200\n * \"com.example.myattribute\": true\n * \"com.example.score\": 10.239\n *\n * Attribute keys MUST be unique (it is not allowed to have more than one\n * attribute with the same key).\n * The behavior of software that receives duplicated keys can be unpredictable.\n *\n * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 9;\n */\n attributes: KeyValue[];\n\n /**\n * The number of attributes that were discarded. Attributes\n * can be discarded because their keys are too long or because there are too many\n * attributes. If this value is 0, then no attributes were dropped.\n *\n * @generated from field: uint32 dropped_attributes_count = 10;\n */\n droppedAttributesCount: number;\n\n /**\n * A collection of Event items.\n *\n * @generated from field: repeated opentelemetry.proto.trace.v1.Span.Event events = 11;\n */\n events: Span_Event[];\n\n /**\n * The number of dropped events. If the value is 0, then no\n * events were dropped.\n *\n * @generated from field: uint32 dropped_events_count = 12;\n */\n droppedEventsCount: number;\n\n /**\n * A collection of Links, which are references from this span to a span\n * in the same or different trace.\n *\n * @generated from field: repeated opentelemetry.proto.trace.v1.Span.Link links = 13;\n */\n links: Span_Link[];\n\n /**\n * The number of dropped links after the maximum size was\n * enforced. If this value is 0, then no links were dropped.\n *\n * @generated from field: uint32 dropped_links_count = 14;\n */\n droppedLinksCount: number;\n\n /**\n * An optional final status for this span. Semantically when Status isn't set, it means\n * span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0).\n *\n * @generated from field: opentelemetry.proto.trace.v1.Status status = 15;\n */\n status?: Status | undefined;\n};\n\n/**\n * Describes the message opentelemetry.proto.trace.v1.Span.\n * Use `create(SpanSchema)` to create a new message.\n */\nexport const SpanSchema: GenMessage<Span> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_trace_v1_trace, 3);\n\n/**\n * Event is a time-stamped annotation of the span, consisting of user-supplied\n * text description and key-value pairs.\n *\n * @generated from message opentelemetry.proto.trace.v1.Span.Event\n */\nexport type Span_Event = Message<\"opentelemetry.proto.trace.v1.Span.Event\"> & {\n /**\n * The time the event occurred.\n *\n * @generated from field: fixed64 time_unix_nano = 1;\n */\n timeUnixNano: bigint;\n\n /**\n * The name of the event.\n * This field is semantically required to be set to non-empty string.\n *\n * @generated from field: string name = 2;\n */\n name: string;\n\n /**\n * A collection of attribute key/value pairs on the event.\n * Attribute keys MUST be unique (it is not allowed to have more than one\n * attribute with the same key).\n * The behavior of software that receives duplicated keys can be unpredictable.\n *\n * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 3;\n */\n attributes: KeyValue[];\n\n /**\n * The number of dropped attributes. If the value is 0,\n * then no attributes were dropped.\n *\n * @generated from field: uint32 dropped_attributes_count = 4;\n */\n droppedAttributesCount: number;\n};\n\n/**\n * Describes the message opentelemetry.proto.trace.v1.Span.Event.\n * Use `create(Span_EventSchema)` to create a new message.\n */\nexport const Span_EventSchema: GenMessage<Span_Event> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_trace_v1_trace, 3, 0);\n\n/**\n * A pointer from the current span to another span in the same trace or in a\n * different trace. For example, this can be used in batching operations,\n * where a single batch handler processes multiple requests from different\n * traces or when the handler receives a request from a different project.\n *\n * @generated from message opentelemetry.proto.trace.v1.Span.Link\n */\nexport type Span_Link = Message<\"opentelemetry.proto.trace.v1.Span.Link\"> & {\n /**\n * A unique identifier of a trace that this linked span is part of. The ID is a\n * 16-byte array.\n *\n * @generated from field: bytes trace_id = 1;\n */\n traceId: Uint8Array;\n\n /**\n * A unique identifier for the linked span. The ID is an 8-byte array.\n *\n * @generated from field: bytes span_id = 2;\n */\n spanId: Uint8Array;\n\n /**\n * The trace_state associated with the link.\n *\n * @generated from field: string trace_state = 3;\n */\n traceState: string;\n\n /**\n * A collection of attribute key/value pairs on the link.\n * Attribute keys MUST be unique (it is not allowed to have more than one\n * attribute with the same key).\n * The behavior of software that receives duplicated keys can be unpredictable.\n *\n * @generated from field: repeated opentelemetry.proto.common.v1.KeyValue attributes = 4;\n */\n attributes: KeyValue[];\n\n /**\n * The number of dropped attributes. If the value is 0,\n * then no attributes were dropped.\n *\n * @generated from field: uint32 dropped_attributes_count = 5;\n */\n droppedAttributesCount: number;\n\n /**\n * Flags, a bit field.\n *\n * Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace\n * Context specification. To read the 8-bit W3C trace flag, use\n * `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.\n *\n * See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.\n *\n * Bits 8 and 9 represent the 3 states of whether the link is remote.\n * The states are (unknown, is not remote, is remote).\n * To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.\n * To read whether the link is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.\n *\n * Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.\n * When creating new spans, bits 10-31 (most-significant 22-bits) MUST be zero.\n *\n * [Optional].\n *\n * [Since v1.1.0]\n *\n * @generated from field: fixed32 flags = 6;\n */\n flags: number;\n};\n\n/**\n * Describes the message opentelemetry.proto.trace.v1.Span.Link.\n * Use `create(Span_LinkSchema)` to create a new message.\n */\nexport const Span_LinkSchema: GenMessage<Span_Link> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_trace_v1_trace, 3, 1);\n\n/**\n * SpanKind is the type of span. Can be used to specify additional relationships between spans\n * in addition to a parent/child relationship.\n *\n * @generated from enum opentelemetry.proto.trace.v1.Span.SpanKind\n */\nexport enum Span_SpanKind {\n /**\n * Unspecified. Do NOT use as default.\n * Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED.\n *\n * @generated from enum value: SPAN_KIND_UNSPECIFIED = 0;\n */\n UNSPECIFIED = 0,\n\n /**\n * Indicates that the span represents an internal operation within an application,\n * as opposed to an operation happening at the boundaries. Default value.\n *\n * @generated from enum value: SPAN_KIND_INTERNAL = 1;\n */\n INTERNAL = 1,\n\n /**\n * Indicates that the span covers server-side handling of an RPC or other\n * remote network request.\n *\n * @generated from enum value: SPAN_KIND_SERVER = 2;\n */\n SERVER = 2,\n\n /**\n * Indicates that the span describes a request to some remote service.\n *\n * @generated from enum value: SPAN_KIND_CLIENT = 3;\n */\n CLIENT = 3,\n\n /**\n * Indicates that the span describes a producer sending a message to a broker.\n * Unlike CLIENT and SERVER, there is often no direct critical path latency relationship\n * between producer and consumer spans. A PRODUCER span ends when the message was accepted\n * by the broker while the logical processing of the message might span a much longer time.\n *\n * @generated from enum value: SPAN_KIND_PRODUCER = 4;\n */\n PRODUCER = 4,\n\n /**\n * Indicates that the span describes consumer receiving a message from a broker.\n * Like the PRODUCER kind, there is often no direct critical path latency relationship\n * between producer and consumer spans.\n *\n * @generated from enum value: SPAN_KIND_CONSUMER = 5;\n */\n CONSUMER = 5,\n}\n\n/**\n * Describes the enum opentelemetry.proto.trace.v1.Span.SpanKind.\n */\nexport const Span_SpanKindSchema: GenEnum<Span_SpanKind> = /*@__PURE__*/\n enumDesc(file_opentelemetry_proto_trace_v1_trace, 3, 0);\n\n/**\n * The Status type defines a logical error model that is suitable for different\n * programming environments, including REST APIs and RPC APIs.\n *\n * @generated from message opentelemetry.proto.trace.v1.Status\n */\nexport type Status = Message<\"opentelemetry.proto.trace.v1.Status\"> & {\n /**\n * A developer-facing human readable error message.\n *\n * @generated from field: string message = 2;\n */\n message: string;\n\n /**\n * The status code.\n *\n * @generated from field: opentelemetry.proto.trace.v1.Status.StatusCode code = 3;\n */\n code: Status_StatusCode;\n};\n\n/**\n * Describes the message opentelemetry.proto.trace.v1.Status.\n * Use `create(StatusSchema)` to create a new message.\n */\nexport const StatusSchema: GenMessage<Status> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_trace_v1_trace, 4);\n\n/**\n * For the semantics of status codes see\n * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status\n *\n * @generated from enum opentelemetry.proto.trace.v1.Status.StatusCode\n */\nexport enum Status_StatusCode {\n /**\n * The default status.\n *\n * @generated from enum value: STATUS_CODE_UNSET = 0;\n */\n UNSET = 0,\n\n /**\n * The Span has been validated by an Application developer or Operator to \n * have completed successfully.\n *\n * @generated from enum value: STATUS_CODE_OK = 1;\n */\n OK = 1,\n\n /**\n * The Span contains an error.\n *\n * @generated from enum value: STATUS_CODE_ERROR = 2;\n */\n ERROR = 2,\n}\n\n/**\n * Describes the enum opentelemetry.proto.trace.v1.Status.StatusCode.\n */\nexport const Status_StatusCodeSchema: GenEnum<Status_StatusCode> = /*@__PURE__*/\n enumDesc(file_opentelemetry_proto_trace_v1_trace, 4, 0);\n\n/**\n * SpanFlags represents constants used to interpret the\n * Span.flags field, which is protobuf 'fixed32' type and is to\n * be used as bit-fields. Each non-zero value defined in this enum is\n * a bit-mask. To extract the bit-field, for example, use an\n * expression like:\n *\n * (span.flags & SPAN_FLAGS_TRACE_FLAGS_MASK)\n *\n * See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.\n *\n * Note that Span flags were introduced in version 1.1 of the\n * OpenTelemetry protocol. Older Span producers do not set this\n * field, consequently consumers should not rely on the absence of a\n * particular flag bit to indicate the presence of a particular feature.\n *\n * [Since v1.1.0]\n *\n * @generated from enum opentelemetry.proto.trace.v1.SpanFlags\n */\nexport enum SpanFlags {\n /**\n * The zero value for the enum. Should not be used for comparisons.\n * Instead use bitwise \"and\" with the appropriate mask as shown above.\n *\n * @generated from enum value: SPAN_FLAGS_DO_NOT_USE = 0;\n */\n DO_NOT_USE = 0,\n\n /**\n * Bits 0-7 are used for trace flags.\n *\n * @generated from enum value: SPAN_FLAGS_TRACE_FLAGS_MASK = 255;\n */\n TRACE_FLAGS_MASK = 255,\n\n /**\n * Bits 8 and 9 are used to indicate that the parent span or link span is remote.\n * Bit 8 (`HAS_IS_REMOTE`) indicates whether the value is known.\n * Bit 9 (`IS_REMOTE`) indicates whether the span or link is remote.\n *\n * [Since v1.2.0]\r\n *\n * @generated from enum value: SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 256;\n */\n CONTEXT_HAS_IS_REMOTE_MASK = 256,\n\n /**\n * [Since v1.2.0]\n *\n * @generated from enum value: SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 512;\n */\n CONTEXT_IS_REMOTE_MASK = 512,\n}\n\n/**\n * Describes the enum opentelemetry.proto.trace.v1.SpanFlags.\n */\nexport const SpanFlagsSchema: GenEnum<SpanFlags> = /*@__PURE__*/\n enumDesc(file_opentelemetry_proto_trace_v1_trace, 0);\n\n","// Copyright 2019, OpenTelemetry Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// @generated by protoc-gen-es v2.16.0 with parameter \"target=ts,import_extension=ts\"\n// @generated from file opentelemetry/proto/collector/trace/v1/trace_service.proto (package opentelemetry.proto.collector.trace.v1, syntax proto3)\n/* eslint-disable */\n\nimport type { GenFile, GenMessage, GenService } from \"@bufbuild/protobuf/codegenv2\";\nimport { fileDesc, messageDesc, serviceDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport type { ResourceSpans } from \"../../../trace/v1/trace_pb.ts\";\nimport { file_opentelemetry_proto_trace_v1_trace } from \"../../../trace/v1/trace_pb.ts\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file opentelemetry/proto/collector/trace/v1/trace_service.proto.\n */\nexport const file_opentelemetry_proto_collector_trace_v1_trace_service: GenFile = /*@__PURE__*/\n fileDesc(\"CjpvcGVudGVsZW1ldHJ5L3Byb3RvL2NvbGxlY3Rvci90cmFjZS92MS90cmFjZV9zZXJ2aWNlLnByb3RvEiZvcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci50cmFjZS52MSJgChlFeHBvcnRUcmFjZVNlcnZpY2VSZXF1ZXN0EkMKDnJlc291cmNlX3NwYW5zGAEgAygLMisub3BlbnRlbGVtZXRyeS5wcm90by50cmFjZS52MS5SZXNvdXJjZVNwYW5zIngKGkV4cG9ydFRyYWNlU2VydmljZVJlc3BvbnNlEloKD3BhcnRpYWxfc3VjY2VzcxgBIAEoCzJBLm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLnRyYWNlLnYxLkV4cG9ydFRyYWNlUGFydGlhbFN1Y2Nlc3MiSgoZRXhwb3J0VHJhY2VQYXJ0aWFsU3VjY2VzcxIWCg5yZWplY3RlZF9zcGFucxgBIAEoAxIVCg1lcnJvcl9tZXNzYWdlGAIgASgJMqIBCgxUcmFjZVNlcnZpY2USkQEKBkV4cG9ydBJBLm9wZW50ZWxlbWV0cnkucHJvdG8uY29sbGVjdG9yLnRyYWNlLnYxLkV4cG9ydFRyYWNlU2VydmljZVJlcXVlc3QaQi5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci50cmFjZS52MS5FeHBvcnRUcmFjZVNlcnZpY2VSZXNwb25zZSIAQpwBCilpby5vcGVudGVsZW1ldHJ5LnByb3RvLmNvbGxlY3Rvci50cmFjZS52MUIRVHJhY2VTZXJ2aWNlUHJvdG9QAVoxZ28ub3BlbnRlbGVtZXRyeS5pby9wcm90by9vdGxwL2NvbGxlY3Rvci90cmFjZS92MaoCJk9wZW5UZWxlbWV0cnkuUHJvdG8uQ29sbGVjdG9yLlRyYWNlLlYxYgZwcm90bzM\", [file_opentelemetry_proto_trace_v1_trace]);\n\n/**\n * @generated from message opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest\n */\nexport type ExportTraceServiceRequest = Message<\"opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest\"> & {\n /**\n * An array of ResourceSpans.\n * For data coming from a single resource this array will typically contain one\n * element. Intermediary nodes (such as OpenTelemetry Collector) that receive\n * data from multiple origins typically batch the data before forwarding further and\n * in that case this array will contain multiple elements.\n *\n * @generated from field: repeated opentelemetry.proto.trace.v1.ResourceSpans resource_spans = 1;\n */\n resourceSpans: ResourceSpans[];\n};\n\n/**\n * Describes the message opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.\n * Use `create(ExportTraceServiceRequestSchema)` to create a new message.\n */\nexport const ExportTraceServiceRequestSchema: GenMessage<ExportTraceServiceRequest> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_collector_trace_v1_trace_service, 0);\n\n/**\n * @generated from message opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse\n */\nexport type ExportTraceServiceResponse = Message<\"opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse\"> & {\n /**\n * The details of a partially successful export request.\n *\n * If the request is only partially accepted\n * (i.e. when the server accepts only parts of the data and rejects the rest)\n * the server MUST initialize the `partial_success` field and MUST\n * set the `rejected_<signal>` with the number of items it rejected.\n *\n * Servers MAY also make use of the `partial_success` field to convey\n * warnings/suggestions to senders even when the request was fully accepted.\n * In such cases, the `rejected_<signal>` MUST have a value of `0` and\n * the `error_message` MUST be non-empty.\n *\n * A `partial_success` message with an empty value (rejected_<signal> = 0 and\n * `error_message` = \"\") is equivalent to it not being set/present. Senders\n * SHOULD interpret it the same way as in the full success case.\n *\n * @generated from field: opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess partial_success = 1;\n */\n partialSuccess?: ExportTracePartialSuccess | undefined;\n};\n\n/**\n * Describes the message opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.\n * Use `create(ExportTraceServiceResponseSchema)` to create a new message.\n */\nexport const ExportTraceServiceResponseSchema: GenMessage<ExportTraceServiceResponse> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_collector_trace_v1_trace_service, 1);\n\n/**\n * @generated from message opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess\n */\nexport type ExportTracePartialSuccess = Message<\"opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess\"> & {\n /**\n * The number of rejected spans.\n *\n * A `rejected_<signal>` field holding a `0` value indicates that the\n * request was fully accepted.\n *\n * @generated from field: int64 rejected_spans = 1;\n */\n rejectedSpans: bigint;\n\n /**\n * A developer-facing human-readable message in English. It should be used\n * either to explain why the server rejected parts of the data during a partial\n * success or to convey warnings/suggestions during a full success. The message\n * should offer guidance on how users can address such issues.\n *\n * error_message is an optional field. An error_message with an empty value\n * is equivalent to it not being set.\n *\n * @generated from field: string error_message = 2;\n */\n errorMessage: string;\n};\n\n/**\n * Describes the message opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.\n * Use `create(ExportTracePartialSuccessSchema)` to create a new message.\n */\nexport const ExportTracePartialSuccessSchema: GenMessage<ExportTracePartialSuccess> = /*@__PURE__*/\n messageDesc(file_opentelemetry_proto_collector_trace_v1_trace_service, 2);\n\n/**\n * Service that can be used to push spans between one Application instrumented with\n * OpenTelemetry and a collector, or between a collector and a central collector (in this\n * case spans are sent/received to/from multiple Applications).\n *\n * @generated from service opentelemetry.proto.collector.trace.v1.TraceService\n */\nexport const TraceService: GenService<{\n /**\n * @generated from rpc opentelemetry.proto.collector.trace.v1.TraceService.Export\n */\n export: {\n methodKind: \"unary\";\n input: typeof ExportTraceServiceRequestSchema;\n output: typeof ExportTraceServiceResponseSchema;\n },\n}> = /*@__PURE__*/\n serviceDesc(file_opentelemetry_proto_collector_trace_v1_trace_service, 0);\n\n","import type { TailStream } from \"@cloudflare/workers-types/index.ts\";\nimport { Array, Match, Option, Predicate, Record, pipe } from \"effect\";\n\nimport { SeverityNumber } from \"./generated/opentelemetry/proto/logs/v1/logs_pb.ts\";\nimport {\n Span_SpanKind,\n Status_StatusCode,\n} from \"./generated/opentelemetry/proto/trace/v1/trace_pb.ts\";\n\ntype TailEvent = TailStream.TailEvent<TailStream.EventType>;\ntype Attribute = TailStream.Attribute;\n\ninterface Draft {\n readonly spanId: string;\n readonly parentSpanId: string;\n readonly name: string;\n readonly kind: Span_SpanKind;\n readonly start: bigint;\n readonly end: Option.Option<bigint>;\n readonly attributes: readonly TailStream.Attribute[];\n readonly status: Status_StatusCode;\n}\n\ninterface LogDraft {\n readonly spanId: string;\n readonly time: bigint;\n readonly severity: SeverityNumber;\n readonly level: string;\n readonly body: string;\n}\n\ninterface Invocation {\n readonly traceId: string;\n readonly serviceName: string;\n readonly spans: Readonly<Record<string, Draft>>;\n readonly logs: readonly LogDraft[];\n}\n\nconst NANOS_PER_MILLI = 1_000_000n;\n\nconst SEVERITIES: Readonly<Record<TailStream.Log[\"level\"], SeverityNumber>> = {\n debug: SeverityNumber.DEBUG,\n info: SeverityNumber.INFO,\n log: SeverityNumber.INFO,\n warn: SeverityNumber.WARN,\n error: SeverityNumber.ERROR,\n};\n\nconst SPAN_STATUSES: Readonly<Record<TailStream.SpanStatusCode, Status_StatusCode>> = {\n unset: Status_StatusCode.UNSET,\n ok: Status_StatusCode.OK,\n error: Status_StatusCode.ERROR,\n};\n\nconst nanos = (date: Date): bigint => BigInt(date.getTime()) * NANOS_PER_MILLI;\n\nconst statusOf = (outcome: TailStream.EventOutcome): Status_StatusCode =>\n Match.value(outcome).pipe(\n Match.when(\"ok\", () => Status_StatusCode.UNSET),\n Match.orElse(() => Status_StatusCode.ERROR),\n );\n\nconst onsetAttributes = (onset: TailStream.Onset): readonly Attribute[] => [\n ...(onset.attributes ?? []),\n ...Match.value(onset.info).pipe(\n Match.when({ type: \"fetch\" }, (info): readonly Attribute[] => [\n { name: \"http.request.method\", value: info.method },\n { name: \"url.full\", value: info.url },\n ]),\n Match.orElse((): readonly Attribute[] => []),\n ),\n];\n\nconst textOf = (part: unknown): string =>\n Match.value(part).pipe(\n Match.when(Predicate.isString, (text) => text),\n Match.orElse((other) => JSON.stringify(other)),\n );\n\nconst logBody = (message: object | string): string =>\n Match.value(message).pipe(\n Match.when(Array.isArray, (parts: readonly unknown[]) =>\n pipe(parts, Array.map(textOf), Array.join(\" \")),\n ),\n Match.orElse(textOf),\n );\n\nconst exceptionAttributes = (exception: TailStream.Exception): readonly Attribute[] => [\n { name: \"exception.type\", value: exception.name },\n { name: \"exception.message\", value: exception.message },\n ...pipe(\n Option.fromNullishOr(exception.stack),\n Option.match({\n onNone: (): readonly Attribute[] => [],\n onSome: (stack): readonly Attribute[] => [{ name: \"exception.stacktrace\", value: stack }],\n }),\n ),\n];\n\nconst returnAttributes = (info: TailStream.FetchResponseInfo | undefined): readonly Attribute[] =>\n pipe(\n Option.fromNullishOr(info),\n Option.match({\n onNone: (): readonly Attribute[] => [],\n onSome: ({ statusCode }): readonly Attribute[] => [\n { name: \"http.response.status_code\", value: statusCode },\n ],\n }),\n );\n\nconst updateSpan =\n (spanId: string, update: (draft: Draft) => Draft) =>\n (invocation: Invocation): Invocation => ({\n ...invocation,\n spans: Option.getOrElse(\n Record.modify(invocation.spans, spanId, update),\n () => invocation.spans,\n ),\n });\n\nconst addSpan =\n (draft: Draft) =>\n (invocation: Invocation): Invocation => ({\n ...invocation,\n spans: Record.set(invocation.spans, draft.spanId, draft),\n });\n\nconst withAttributes =\n (attributes: readonly Attribute[]) =>\n (draft: Draft): Draft => ({ ...draft, attributes: [...draft.attributes, ...attributes] });\n\nconst closed =\n (end: bigint, outcome: TailStream.EventOutcome) =>\n (draft: Draft): Draft => ({ ...draft, end: Option.some(end), status: statusOf(outcome) });\n\nconst updated =\n (info: TailStream.SpanUpdateInfo) =>\n (draft: Draft): Draft =>\n Match.value(info).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n name: ({ name }) => ({ ...draft, name }),\n status: ({ status }) => ({ ...draft, status: SPAN_STATUSES[status.code] }),\n }),\n );\n\ntype Opening = Pick<Draft, \"spanId\" | \"name\" | \"kind\">;\n\nconst opened = (tail: TailEvent, opening: Opening): Draft => ({\n ...opening,\n parentSpanId: tail.spanContext.spanId ?? \"\",\n start: nanos(tail.timestamp),\n end: Option.none(),\n attributes: [],\n status: Status_StatusCode.UNSET,\n});\n\nconst onOnset = (invocation: Invocation, tail: TailEvent, onset: TailStream.Onset): Invocation => ({\n traceId: tail.spanContext.traceId,\n serviceName: onset.scriptName ?? invocation.serviceName,\n spans: {\n [onset.spanId]: {\n ...opened(tail, { spanId: onset.spanId, name: onset.info.type, kind: Span_SpanKind.SERVER }),\n attributes: onsetAttributes(onset),\n },\n },\n logs: [],\n});\n\nconst onLog =\n (tail: TailEvent, log: TailStream.Log) =>\n (invocation: Invocation): Invocation => ({\n ...invocation,\n logs: [\n ...invocation.logs,\n {\n spanId: tail.spanContext.spanId ?? \"\",\n time: nanos(tail.timestamp),\n severity: SEVERITIES[log.level],\n level: log.level,\n body: logBody(log.message),\n },\n ],\n });\n\nconst step = (invocation: Invocation, tail: TailEvent): Invocation => {\n const own = tail.spanContext.spanId ?? \"\";\n const end = nanos(tail.timestamp);\n return Match.value(tail.event).pipe(\n Match.discriminatorsExhaustive(\"type\")({\n onset: (onset) => onOnset(invocation, tail, onset),\n spanOpen: (open) =>\n addSpan(opened(tail, { spanId: open.spanId, name: open.name, kind: Span_SpanKind.CLIENT }))(\n invocation,\n ),\n attributes: ({ info }) => updateSpan(own, withAttributes(info))(invocation),\n spanClose: ({ outcome }) => updateSpan(own, closed(end, outcome))(invocation),\n outcome: ({ outcome }) => updateSpan(own, closed(end, outcome))(invocation),\n spanUpdate: ({ info }) => updateSpan(own, updated(info))(invocation),\n return: ({ info }) => updateSpan(own, withAttributes(returnAttributes(info)))(invocation),\n exception: (exception) =>\n updateSpan(own, withAttributes(exceptionAttributes(exception)))(invocation),\n log: (log) => onLog(tail, log)(invocation),\n diagnosticChannel: () => invocation,\n streamDiagnostic: () => invocation,\n }),\n );\n};\n\nconst invocationOf =\n (serviceName: string) =>\n (events: readonly TailEvent[]): Invocation => {\n let invocation: Invocation = { traceId: \"\", serviceName, spans: {}, logs: [] };\n for (const tail of events) {\n invocation = step(invocation, tail);\n }\n return invocation;\n };\n\nexport { invocationOf };\nexport type { Draft, Invocation, LogDraft, TailEvent };\n","import { create } from \"@bufbuild/protobuf\";\nimport type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport type { TailStream } from \"@cloudflare/workers-types/index.ts\";\nimport { Array, Match, Option, Predicate, Record, Result, pipe } from \"effect\";\nimport { Hex } from \"effect/encoding\";\n\nimport type { ExportLogsServiceRequest } from \"./generated/opentelemetry/proto/collector/logs/v1/logs_service_pb.ts\";\nimport { ExportLogsServiceRequestSchema } from \"./generated/opentelemetry/proto/collector/logs/v1/logs_service_pb.ts\";\nimport type { ExportTraceServiceRequest } from \"./generated/opentelemetry/proto/collector/trace/v1/trace_service_pb.ts\";\nimport { ExportTraceServiceRequestSchema } from \"./generated/opentelemetry/proto/collector/trace/v1/trace_service_pb.ts\";\nimport type {\n AnyValueSchema,\n KeyValueSchema,\n} from \"./generated/opentelemetry/proto/common/v1/common_pb.ts\";\nimport type { LogRecordSchema } from \"./generated/opentelemetry/proto/logs/v1/logs_pb.ts\";\nimport type { SpanSchema } from \"./generated/opentelemetry/proto/trace/v1/trace_pb.ts\";\nimport type { Draft, Invocation, LogDraft } from \"./tail-events.ts\";\n\ntype AnyValueInit = MessageInitShape<typeof AnyValueSchema>;\ntype KeyValueInit = MessageInitShape<typeof KeyValueSchema>;\ntype Attribute = TailStream.Attribute;\ntype Scalar = string | boolean | number | bigint;\n\nconst SCOPE_NAME = \"cloudflare-workers\";\n\nconst stringValue = (value: string): AnyValueInit => ({ value: { case: \"stringValue\", value } });\nconst boolValue = (value: boolean): AnyValueInit => ({ value: { case: \"boolValue\", value } });\nconst intValue = (value: bigint): AnyValueInit => ({ value: { case: \"intValue\", value } });\nconst doubleValue = (value: number): AnyValueInit => ({ value: { case: \"doubleValue\", value } });\nconst numberValue = (value: number): AnyValueInit =>\n Match.value(value).pipe(\n Match.when(\n (whole: number) => Number.isInteger(whole),\n (whole) => intValue(BigInt(whole)),\n ),\n Match.orElse(doubleValue),\n );\n\nconst scalarValue = (value: Scalar): AnyValueInit =>\n Match.value(value).pipe(\n Match.when(Predicate.isString, stringValue),\n Match.when(Predicate.isBoolean, boolValue),\n Match.when(Predicate.isBigInt, intValue),\n Match.orElse(numberValue),\n );\n\nconst arrayValue = (values: readonly Scalar[]): AnyValueInit => ({\n value: { case: \"arrayValue\", value: { values: pipe(values, Array.map(scalarValue)) } },\n});\n\nconst anyValue = (attribute: Attribute): AnyValueInit =>\n Match.value(attribute.value).pipe(\n Match.when(Predicate.isString, stringValue),\n Match.when(Predicate.isBoolean, boolValue),\n Match.when(Predicate.isBigInt, intValue),\n Match.when(Predicate.isNumber, numberValue),\n Match.orElse(arrayValue),\n );\n\nconst keyValue = (attribute: Attribute): KeyValueInit => ({\n key: attribute.name,\n value: anyValue(attribute),\n});\n\nconst idBytes = (hex: string): Uint8Array =>\n Result.getOrElse(Hex.decode(hex), () => new Uint8Array());\n\nconst spanInit =\n (traceId: string) =>\n (draft: Draft): MessageInitShape<typeof SpanSchema> => ({\n traceId: idBytes(traceId),\n spanId: idBytes(draft.spanId),\n parentSpanId: idBytes(draft.parentSpanId),\n name: draft.name,\n kind: draft.kind,\n startTimeUnixNano: draft.start,\n endTimeUnixNano: Option.getOrElse(draft.end, () => draft.start),\n attributes: pipe(draft.attributes, Array.map(keyValue)),\n status: { code: draft.status },\n });\n\nconst logInit =\n (traceId: string) =>\n (log: LogDraft): MessageInitShape<typeof LogRecordSchema> => ({\n timeUnixNano: log.time,\n severityNumber: log.severity,\n severityText: log.level,\n body: stringValue(log.body),\n traceId: idBytes(traceId),\n spanId: idBytes(log.spanId),\n });\n\nconst resourceOf = (invocation: Invocation): KeyValueInit[] => [\n keyValue({ name: \"service.name\", value: invocation.serviceName }),\n];\n\nconst tracesOf = (invocation: Invocation): ExportTraceServiceRequest => {\n const spans = pipe(Record.values(invocation.spans), Array.map(spanInit(invocation.traceId)));\n return create(ExportTraceServiceRequestSchema, {\n resourceSpans: [\n {\n resource: { attributes: resourceOf(invocation) },\n scopeSpans: [{ scope: { name: SCOPE_NAME }, spans }],\n },\n ],\n });\n};\n\nconst logsOf = (invocation: Invocation): ExportLogsServiceRequest => {\n const logRecords = pipe(invocation.logs, Array.map(logInit(invocation.traceId)));\n return create(ExportLogsServiceRequestSchema, {\n resourceLogs: [\n {\n resource: { attributes: resourceOf(invocation) },\n scopeLogs: [{ scope: { name: SCOPE_NAME }, logRecords }],\n },\n ],\n });\n};\n\nexport { logsOf, tracesOf };\n","import { toBinary } from \"@bufbuild/protobuf\";\nimport type { DescMessage, MessageShape } from \"@bufbuild/protobuf\";\nimport { Effect, ManagedRuntime } from \"effect\";\nimport { FetchHttpClient, HttpClient, HttpClientRequest } from \"effect/http\";\nimport type { HttpClientError } from \"effect/http\";\n\nimport { ExportLogsServiceRequestSchema } from \"./generated/opentelemetry/proto/collector/logs/v1/logs_service_pb.ts\";\nimport { ExportTraceServiceRequestSchema } from \"./generated/opentelemetry/proto/collector/trace/v1/trace_service_pb.ts\";\nimport type { Invocation, TailEvent } from \"./tail-events.ts\";\nimport { invocationOf } from \"./tail-events.ts\";\nimport { logsOf, tracesOf } from \"./tail-otlp.ts\";\n\ninterface Env {\n readonly OTEL_EXPORTER_OTLP_ENDPOINT: string;\n readonly OTEL_SERVICE_NAME: string;\n}\n\nconst PROTOBUF_CONTENT_TYPE = \"application/x-protobuf\";\n\nconst post = <Desc extends DescMessage>(\n url: string,\n schema: Desc,\n message: MessageShape<Desc>,\n): Effect.Effect<unknown, HttpClientError.HttpClientError, HttpClient.HttpClient> => {\n const body = toBinary(schema, message);\n return HttpClient.execute(\n HttpClientRequest.post(url).pipe(HttpClientRequest.bodyUint8Array(body, PROTOBUF_CONTENT_TYPE)),\n );\n};\n\nconst exportInvocation = (\n endpoint: string,\n invocation: Invocation,\n): Effect.Effect<unknown, HttpClientError.HttpClientError, HttpClient.HttpClient> =>\n Effect.all(\n [\n post(`${endpoint}/v1/traces`, ExportTraceServiceRequestSchema, tracesOf(invocation)),\n post(`${endpoint}/v1/logs`, ExportLogsServiceRequestSchema, logsOf(invocation)),\n ],\n { concurrency: \"unbounded\" },\n );\n\nconst runtime = ManagedRuntime.make(FetchHttpClient.layer);\n\nconst tailStream = (onset: TailEvent, env: Env): ((event: TailEvent) => Promise<unknown>) => {\n const events: TailEvent[] = [onset];\n const exportAll = Effect.suspend(() =>\n exportInvocation(env.OTEL_EXPORTER_OTLP_ENDPOINT, invocationOf(env.OTEL_SERVICE_NAME)(events)),\n );\n return (event) => {\n events.push(event);\n return runtime.runPromise(\n Effect.when(exportAll, Effect.succeed(event.event.type === \"outcome\")),\n );\n };\n};\n\nconst tailWorker = { tailStream };\n\nexport default tailWorker;\n"],"mappings":";;;;;;;;;AAyBA,MAAa,4CACX,uBAAS,wzCAAwzC;;;;;ACCn0C,MAAa,gDACX,uBAAS,khBAAkhB,CAAC,yCAAyC,CAAC;;;;;AEsBxkB,MAAa,iCACX,0BAAY,gBAvBZ,SAAS,47BAA47B,CAAC,gBDEt8B,SAAS,01EAA01E,CAAC,2CAA2C,6CAA6C,CCFt/C,CAAqC,CAuB/9B,GAAyD,CAAC;;;;;AEDxE,MAAa,kCACX,0BAAY,gBAvBZ,SAAS,+8BAA+8B,CAAC,gBDEz9B,SAAS,8kFAA8kF,CAAC,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O,gCAAgC,EAC5C,cAAc,CACZ;EACE,UAAU,EAAE,YAAY,WAAW,UAAU,EAAE;EAC/C,WAAW,CAAC;GAAE,OAAO,EAAE,MAAM,WAAW;GAAG;EAAW,CAAC;CACzD,CACF,EACF,CAAC;AACH;;ACrGA,MAAM,wBAAwB;AAE9B,MAAM,QACJ,KACA,QACA,YACmF;CACnF,MAAM,OAAO,SAAS,QAAQ,OAAO;CACrC,OAAO,WAAW,QAChB,kBAAkB,KAAK,GAAG,CAAC,CAAC,KAAK,kBAAkB,eAAe,MAAM,qBAAqB,CAAC,CAChG;AACF;AAEA,MAAM,oBACJ,UACA,eAEA,OAAO,IACL,CACE,KAAK,GAAG,SAAS,aAAa,iCAAiC,SAAS,UAAU,CAAC,GACnF,KAAK,GAAG,SAAS,WAAW,gCAAgC,OAAO,UAAU,CAAC,CAChF,GACA,EAAE,aAAa,YAAY,CAC7B;AAEF,MAAM,UAAU,eAAe,KAAK,gBAAgB,KAAK;AAEzD,MAAM,cAAc,OAAkB,QAAuD;CAC3F,MAAM,SAAsB,CAAC,KAAK;CAClC,MAAM,YAAY,OAAO,cACvB,iBAAiB,IAAI,6BAA6B,aAAa,IAAI,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAC/F;CACA,QAAQ,UAAU;EAChB,OAAO,KAAK,KAAK;EACjB,OAAO,QAAQ,WACb,OAAO,KAAK,WAAW,OAAO,QAAQ,MAAM,MAAM,SAAS,SAAS,CAAC,CACvE;CACF;AACF;AAEA,MAAM,aAAa,EAAE,WAAW"}
@@ -1,26 +0,0 @@
1
- import { t as ReceiverNotRunning } from "./store-8DpTwYxj.mjs";
2
- import { Effect, Schema } from "effect";
3
- declare const TailWorkerBuildFailed_base: Schema.Class<TailWorkerBuildFailed, Schema.TaggedStruct<"TailWorkerBuildFailed", {
4
- readonly message: Schema.String;
5
- }>, import("effect/Cause").YieldableError & {
6
- readonly brand: unique symbol;
7
- }>;
8
- declare class TailWorkerBuildFailed extends TailWorkerBuildFailed_base {}
9
- interface TailWorker {
10
- name: string;
11
- compatibilityDate: string;
12
- modules: {
13
- type: "ESModule";
14
- path: string;
15
- contents: string;
16
- }[];
17
- bindings: Record<string, string>;
18
- }
19
- interface TailWorkerOptions {
20
- readonly name?: string;
21
- readonly compatibilityDate?: string;
22
- readonly serviceName?: string;
23
- }
24
- declare const tailWorker: ({ name, compatibilityDate, serviceName }?: TailWorkerOptions) => Effect.Effect<TailWorker, TailWorkerBuildFailed | ReceiverNotRunning>;
25
- export { type TailWorker, TailWorkerBuildFailed, type TailWorkerOptions, tailWorker };
26
- //# sourceMappingURL=workers.d.mts.map
package/dist/workers.mjs DELETED
@@ -1,54 +0,0 @@
1
- import { n as currentReceiver } from "./store-DSDf4Wia.mjs";
2
- import { Array, Effect, Option, Predicate, Schema, pipe } from "effect";
3
- import { fileURLToPath } from "node:url";
4
- import { build } from "vite-plus";
5
- // src/workers.ts
6
- const taggedError = Schema.TaggedError;
7
- var TailWorkerBuildFailed = class extends taggedError()("TailWorkerBuildFailed", { message: Schema.String }) {};
8
- const DEFAULT_NAME = "vitest-otlp-tail";
9
- const DEFAULT_SERVICE_NAME = "worker";
10
- const DEFAULT_COMPATIBILITY_DATE = "2026-07-01";
11
- const ENTRY = "@r_masseater/vitest-otlp/tail-worker";
12
- const WORKER_CONDITIONS = [
13
- "workerd",
14
- "worker",
15
- "browser",
16
- "import",
17
- "default"
18
- ];
19
- const failed = (message) => TailWorkerBuildFailed.make({ message });
20
- const chunkCode = (output) => pipe(Array.head(Array.ensure(output)), Option.filter(Predicate.hasProperty("output")), Option.map((result) => result.output), Option.filter(Predicate.isIterable), Option.flatMap((chunks) => Array.head(Array.fromIterable(chunks))), Option.filter(Predicate.hasProperty("code")), Option.map((chunk) => chunk.code), Option.filter(Predicate.isString));
21
- const bundle = Effect.tryPromise({
22
- try: () => build({
23
- configFile: false,
24
- logLevel: "silent",
25
- resolve: { conditions: WORKER_CONDITIONS },
26
- build: {
27
- write: false,
28
- minify: false,
29
- target: "esnext",
30
- lib: {
31
- entry: fileURLToPath(import.meta.resolve(ENTRY)),
32
- formats: ["es"],
33
- fileName: "tail"
34
- }
35
- }
36
- }),
37
- catch: (cause) => failed(`Bundling the tail worker failed: ${String(cause)}`)
38
- }).pipe(Effect.flatMap((output) => Effect.fromOption(chunkCode(output)).pipe(Effect.mapError(() => failed("Bundling the tail worker produced no code.")))), Effect.withSpan("vitest-otlp.tail-worker.bundle"));
39
- const tailWorker = ({ name = DEFAULT_NAME, compatibilityDate = DEFAULT_COMPATIBILITY_DATE, serviceName = DEFAULT_SERVICE_NAME } = {}) => Effect.all([bundle, currentReceiver]).pipe(Effect.map(([contents, receiver]) => ({
40
- name,
41
- compatibilityDate,
42
- modules: [{
43
- type: "ESModule",
44
- path: "tail.worker.mjs",
45
- contents
46
- }],
47
- bindings: {
48
- OTEL_EXPORTER_OTLP_ENDPOINT: receiver.address.httpEndpoint,
49
- OTEL_SERVICE_NAME: serviceName
50
- }
51
- })));
52
- export { TailWorkerBuildFailed, tailWorker };
53
-
54
- //# sourceMappingURL=workers.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workers.mjs","names":[],"sources":["../src/workers.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\n\nimport { Array, Effect, Option, Predicate, Schema, pipe } from \"effect\";\nimport { build } from \"vite-plus\";\n\nimport type { ReceiverNotRunning } from \"./store.ts\";\nimport { currentReceiver } from \"./store.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass TailWorkerBuildFailed extends taggedError<\n TailWorkerBuildFailed,\n { readonly brand: unique symbol }\n>()(\"TailWorkerBuildFailed\", { message: Schema.String }) {}\n\ninterface TailWorker {\n name: string;\n compatibilityDate: string;\n modules: { type: \"ESModule\"; path: string; contents: string }[];\n bindings: Record<string, string>;\n}\n\ninterface TailWorkerOptions {\n readonly name?: string;\n readonly compatibilityDate?: string;\n readonly serviceName?: string;\n}\n\nconst DEFAULT_NAME = \"vitest-otlp-tail\";\nconst DEFAULT_SERVICE_NAME = \"worker\";\nconst DEFAULT_COMPATIBILITY_DATE = \"2026-07-01\";\nconst ENTRY = \"@r_masseater/vitest-otlp/tail-worker\";\nconst WORKER_CONDITIONS = [\"workerd\", \"worker\", \"browser\", \"import\", \"default\"];\n\nconst failed = (message: string): TailWorkerBuildFailed => TailWorkerBuildFailed.make({ message });\n\nconst chunkCode = (output: unknown): Option.Option<string> =>\n pipe(\n Array.head(Array.ensure(output)),\n Option.filter(Predicate.hasProperty(\"output\")),\n Option.map((result) => result.output),\n Option.filter(Predicate.isIterable),\n Option.flatMap((chunks) => Array.head(Array.fromIterable(chunks))),\n Option.filter(Predicate.hasProperty(\"code\")),\n Option.map((chunk) => chunk.code),\n Option.filter(Predicate.isString),\n );\n\nconst bundle: Effect.Effect<string, TailWorkerBuildFailed> = Effect.tryPromise({\n try: () =>\n build({\n configFile: false,\n logLevel: \"silent\",\n resolve: { conditions: WORKER_CONDITIONS },\n build: {\n write: false,\n minify: false,\n target: \"esnext\",\n lib: {\n entry: fileURLToPath(import.meta.resolve(ENTRY)),\n formats: [\"es\"],\n fileName: \"tail\",\n },\n },\n }),\n catch: (cause) => failed(`Bundling the tail worker failed: ${String(cause)}`),\n}).pipe(\n Effect.flatMap((output) =>\n Effect.fromOption(chunkCode(output)).pipe(\n Effect.mapError(() => failed(\"Bundling the tail worker produced no code.\")),\n ),\n ),\n Effect.withSpan(\"vitest-otlp.tail-worker.bundle\"),\n);\n\nconst tailWorker = ({\n name = DEFAULT_NAME,\n compatibilityDate = DEFAULT_COMPATIBILITY_DATE,\n serviceName = DEFAULT_SERVICE_NAME,\n}: TailWorkerOptions = {}): Effect.Effect<TailWorker, TailWorkerBuildFailed | ReceiverNotRunning> =>\n Effect.all([bundle, currentReceiver]).pipe(\n Effect.map(([contents, receiver]) => ({\n name,\n compatibilityDate,\n modules: [{ type: \"ESModule\", path: \"tail.worker.mjs\", contents }],\n bindings: {\n OTEL_EXPORTER_OTLP_ENDPOINT: receiver.address.httpEndpo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