autotel 2.18.0 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/attributes.cjs +21 -20
  2. package/dist/attributes.js +2 -1
  3. package/dist/chunk-2ZKEORFN.cjs +14 -0
  4. package/dist/chunk-2ZKEORFN.cjs.map +1 -0
  5. package/dist/chunk-4A53YIAX.js +180 -0
  6. package/dist/chunk-4A53YIAX.js.map +1 -0
  7. package/dist/{chunk-QKVQWGTF.js → chunk-5JLXDCL2.js} +3 -3
  8. package/dist/{chunk-QKVQWGTF.js.map → chunk-5JLXDCL2.js.map} +1 -1
  9. package/dist/chunk-7552UTQW.js +11 -0
  10. package/dist/chunk-7552UTQW.js.map +1 -0
  11. package/dist/{chunk-NWT5SYOX.cjs → chunk-BEVIAKTB.cjs} +5 -5
  12. package/dist/{chunk-NWT5SYOX.cjs.map → chunk-BEVIAKTB.cjs.map} +1 -1
  13. package/dist/chunk-ESMHTKLJ.cjs +206 -0
  14. package/dist/chunk-ESMHTKLJ.cjs.map +1 -0
  15. package/dist/{chunk-QP5LVD4L.js → chunk-G47ZCJGW.js} +25 -3
  16. package/dist/{chunk-QP5LVD4L.js.map → chunk-G47ZCJGW.js.map} +1 -1
  17. package/dist/{chunk-WC2AMGBX.js → chunk-LCMARHLX.js} +3 -3
  18. package/dist/{chunk-WC2AMGBX.js.map → chunk-LCMARHLX.js.map} +1 -1
  19. package/dist/{chunk-HZ23L5KR.cjs → chunk-LGT7XA5O.cjs} +5 -5
  20. package/dist/{chunk-HZ23L5KR.cjs.map → chunk-LGT7XA5O.cjs.map} +1 -1
  21. package/dist/{chunk-4HPWUYCV.js → chunk-M4US3P4K.js} +3 -170
  22. package/dist/chunk-M4US3P4K.js.map +1 -0
  23. package/dist/{chunk-FMPBL2NF.js → chunk-XBVB3AFF.js} +3 -3
  24. package/dist/{chunk-FMPBL2NF.js.map → chunk-XBVB3AFF.js.map} +1 -1
  25. package/dist/{chunk-DWRTSOGR.cjs → chunk-XI5WPVR5.cjs} +25 -3
  26. package/dist/chunk-XI5WPVR5.cjs.map +1 -0
  27. package/dist/{chunk-74L5DOB4.cjs → chunk-XNBTEFRZ.cjs} +7 -7
  28. package/dist/{chunk-74L5DOB4.cjs.map → chunk-XNBTEFRZ.cjs.map} +1 -1
  29. package/dist/chunk-XRBP4RYL.cjs +764 -0
  30. package/dist/chunk-XRBP4RYL.cjs.map +1 -0
  31. package/dist/decorators.cjs +1 -1
  32. package/dist/decorators.js +1 -1
  33. package/dist/functional.cjs +8 -8
  34. package/dist/functional.js +1 -1
  35. package/dist/index.cjs +65 -43
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +1 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.js +8 -6
  40. package/dist/index.js.map +1 -1
  41. package/dist/messaging.cjs +5 -5
  42. package/dist/messaging.js +2 -2
  43. package/dist/semantic-conventions.cjs +30 -0
  44. package/dist/semantic-conventions.cjs.map +1 -0
  45. package/dist/semantic-conventions.d.cts +29 -0
  46. package/dist/semantic-conventions.d.ts +29 -0
  47. package/dist/semantic-conventions.js +5 -0
  48. package/dist/semantic-conventions.js.map +1 -0
  49. package/dist/semantic-helpers.cjs +6 -6
  50. package/dist/semantic-helpers.js +2 -2
  51. package/dist/webhook.cjs +2 -2
  52. package/dist/webhook.js +1 -1
  53. package/dist/workflow-distributed.cjs +3 -3
  54. package/dist/workflow-distributed.js +1 -1
  55. package/dist/workflow.cjs +6 -6
  56. package/dist/workflow.js +2 -2
  57. package/package.json +16 -11
  58. package/src/decorators.test.ts +22 -72
  59. package/src/functional.test.ts +24 -6
  60. package/src/functional.ts +37 -2
  61. package/src/index.ts +9 -0
  62. package/src/init.openllmetry.test.ts +76 -76
  63. package/src/semantic-conventions.ts +15 -0
  64. package/dist/chunk-4HPWUYCV.js.map +0 -1
  65. package/dist/chunk-7F4PDILZ.cjs +0 -931
  66. package/dist/chunk-7F4PDILZ.cjs.map +0 -1
  67. package/dist/chunk-DWRTSOGR.cjs.map +0 -1
@@ -1,931 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkELW34S4C_cjs = require('./chunk-ELW34S4C.cjs');
4
- var resources = require('@opentelemetry/resources');
5
-
6
- // src/attributes/registry.ts
7
- var UserAttributes = {
8
- id: "user.id",
9
- email: "user.email",
10
- name: "user.name",
11
- fullName: "user.full_name",
12
- hash: "user.hash",
13
- roles: "user.roles"
14
- };
15
- var SessionAttributes = {
16
- id: "session.id",
17
- previousId: "session.previous_id"
18
- };
19
- var DeviceAttributes = {
20
- id: "device.id",
21
- manufacturer: "device.manufacturer",
22
- modelIdentifier: "device.model.identifier",
23
- modelName: "device.model.name"
24
- };
25
- var HTTPAttributes = {
26
- connectionState: "http.connection.state",
27
- requestMethod: "http.request.method",
28
- requestMethodOriginal: "http.request.method_original",
29
- requestResendCount: "http.request.resend_count",
30
- requestSize: "http.request.size",
31
- requestBodySize: "http.request.body.size",
32
- responseSize: "http.response.size",
33
- responseBodySize: "http.response.body.size",
34
- responseStatusCode: "http.response.status_code",
35
- route: "http.route"
36
- };
37
- var DBAttributes = {
38
- collectionName: "db.collection.name",
39
- namespace: "db.namespace",
40
- operationName: "db.operation.name",
41
- querySummary: "db.query.summary",
42
- queryText: "db.query.text",
43
- responseReturnedRows: "db.response.returned_rows",
44
- responseStatusCode: "db.response.status_code",
45
- systemName: "db.system.name",
46
- statement: "db.statement"
47
- };
48
- var ServiceAttributes = {
49
- name: "service.name",
50
- instance: "service.instance.id",
51
- version: "service.version"
52
- };
53
- var NetworkAttributes = {
54
- peerAddress: "network.peer.address",
55
- peerPort: "network.peer.port",
56
- transport: "network.transport",
57
- protocolName: "network.protocol.name",
58
- protocolVersion: "network.protocol.version"
59
- };
60
- var ServerAddressAttributes = {
61
- address: "server.address",
62
- port: "server.port",
63
- socketAddress: "server.socket.address"
64
- };
65
- var URLAttributes = {
66
- scheme: "url.scheme",
67
- full: "url.full",
68
- path: "url.path",
69
- query: "url.query",
70
- fragment: "url.fragment"
71
- };
72
- var ErrorAttributes = {
73
- type: "error.type",
74
- message: "error.message",
75
- stackTrace: "error.stack",
76
- code: "error.code"
77
- };
78
- var ExceptionAttributes = {
79
- escaped: "exception.escaped",
80
- message: "exception.message",
81
- stackTrace: "exception.stacktrace",
82
- type: "exception.type",
83
- moduleName: "exception.module"
84
- };
85
- var ProcessAttributes = {
86
- pid: "process.pid",
87
- executablePath: "process.executable.path",
88
- command: "process.command",
89
- owner: "process.owner"};
90
- var ThreadAttributes = {
91
- id: "thread.id",
92
- name: "thread.name"
93
- };
94
- var ContainerAttributes = {
95
- id: "container.id",
96
- name: "container.name",
97
- image: "container.image.name",
98
- tag: "container.image.tag"
99
- };
100
- var K8sAttributes = {
101
- podName: "k8s.pod.name",
102
- namespaceName: "k8s.namespace.name",
103
- deploymentName: "k8s.deployment.name",
104
- state: "k8s.state.name"
105
- };
106
- var CloudAttributes = {
107
- provider: "cloud.provider",
108
- accountId: "cloud.account.id",
109
- region: "cloud.region",
110
- availabilityZone: "cloud.availability_zone",
111
- platform: "cloud.platform"
112
- };
113
- var FaaSAttributes = {
114
- name: "faas.name",
115
- version: "faas.version",
116
- instance: "faas.instance",
117
- execution: "faas.execution",
118
- coldstart: "faas.coldstart"
119
- };
120
- var FeatureFlagAttributes = {
121
- key: "feature.flag.key",
122
- provider: "feature.flag.provider_name",
123
- variant: "feature.flag.variant.name"
124
- };
125
- var MessagingAttributes = {
126
- system: "messaging.system",
127
- destination: "messaging.destination.name",
128
- operation: "messaging.operation",
129
- messageId: "messaging.message.id",
130
- conversationId: "messaging.conversation_id"};
131
- var GenAIAttributes = {
132
- system: "gen.ai.system",
133
- requestModel: "gen.ai.request.model",
134
- responseModel: "gen.ai.response.model",
135
- operationName: "gen.ai.operation.name",
136
- usagePromptTokens: "gen.ai.usage.prompt_tokens",
137
- usageCompletionTokens: "gen.ai.usage.completion_tokens",
138
- provider: "gen.ai.provider"
139
- };
140
- var RPCAttributes = {
141
- system: "rpc.system",
142
- service: "rpc.service",
143
- method: "rpc.method",
144
- grpcStatusCode: "rpc.grpc.status_code"
145
- };
146
- var GraphQLAttributes = {
147
- document: "graphql.document",
148
- operationName: "graphql.operation.name",
149
- operationType: "graphql.operation.type"
150
- };
151
- var OTelAttributes = {
152
- libraryName: "otel.library.name",
153
- libraryVersion: "otel.library.version",
154
- statusCode: "otel.status_code"
155
- };
156
- var CodeAttributes = {
157
- namespace: "code.namespace",
158
- filepath: "code.filepath",
159
- function: "code.function",
160
- class: "code.class",
161
- method: "code.method",
162
- column: "code.column",
163
- lineNumber: "code.lineno",
164
- repository: "code.repository",
165
- revision: "code.revision"
166
- };
167
- var TLSAttributes = {
168
- protocolVersion: "tls.protocol.version",
169
- cipher: "tls.cipher",
170
- curveName: "tls.curve.name",
171
- resumed: "tls.resumed"
172
- };
173
-
174
- // src/attributes/builders.ts
175
- var attrs = {
176
- user: {
177
- id: (value) => ({ [UserAttributes.id]: value }),
178
- email: (value) => ({ [UserAttributes.email]: value }),
179
- name: (value) => ({ [UserAttributes.name]: value }),
180
- fullName: (value) => ({ [UserAttributes.fullName]: value }),
181
- hash: (value) => ({ [UserAttributes.hash]: value }),
182
- roles: (value) => ({ [UserAttributes.roles]: value }),
183
- data: (data) => {
184
- const result = {};
185
- if (data.id !== void 0) result[UserAttributes.id] = data.id;
186
- if (data.email !== void 0) result[UserAttributes.email] = data.email;
187
- if (data.name !== void 0) result[UserAttributes.name] = data.name;
188
- if (data.fullName !== void 0)
189
- result[UserAttributes.fullName] = data.fullName;
190
- if (data.hash !== void 0) result[UserAttributes.hash] = data.hash;
191
- if (data.roles !== void 0) result[UserAttributes.roles] = data.roles;
192
- return result;
193
- }
194
- },
195
- session: {
196
- id: (value) => ({ [SessionAttributes.id]: value }),
197
- previousId: (value) => ({ [SessionAttributes.previousId]: value }),
198
- data: (data) => {
199
- const result = {};
200
- if (data.id !== void 0) result[SessionAttributes.id] = data.id;
201
- if (data.previousId !== void 0)
202
- result[SessionAttributes.previousId] = data.previousId;
203
- return result;
204
- }
205
- },
206
- device: {
207
- id: (value) => ({ [DeviceAttributes.id]: value }),
208
- manufacturer: (value) => ({
209
- [DeviceAttributes.manufacturer]: value
210
- }),
211
- modelIdentifier: (value) => ({
212
- [DeviceAttributes.modelIdentifier]: value
213
- }),
214
- modelName: (value) => ({ [DeviceAttributes.modelName]: value }),
215
- data: (data) => {
216
- const result = {};
217
- if (data.id !== void 0) result[DeviceAttributes.id] = data.id;
218
- if (data.manufacturer !== void 0)
219
- result[DeviceAttributes.manufacturer] = data.manufacturer;
220
- if (data.modelIdentifier !== void 0)
221
- result[DeviceAttributes.modelIdentifier] = data.modelIdentifier;
222
- if (data.modelName !== void 0)
223
- result[DeviceAttributes.modelName] = data.modelName;
224
- return result;
225
- }
226
- },
227
- http: {
228
- request: {
229
- method: (value) => ({ [HTTPAttributes.requestMethod]: value }),
230
- methodOriginal: (value) => ({
231
- [HTTPAttributes.requestMethodOriginal]: value
232
- }),
233
- resendCount: (value) => ({
234
- [HTTPAttributes.requestResendCount]: value
235
- }),
236
- size: (value) => ({ [HTTPAttributes.requestSize]: value }),
237
- bodySize: (value) => ({
238
- [HTTPAttributes.requestBodySize]: value
239
- })
240
- },
241
- response: {
242
- statusCode: (value) => ({
243
- [HTTPAttributes.responseStatusCode]: value
244
- }),
245
- size: (value) => ({ [HTTPAttributes.responseSize]: value }),
246
- bodySize: (value) => ({
247
- [HTTPAttributes.responseBodySize]: value
248
- })
249
- },
250
- route: (value) => ({ [HTTPAttributes.route]: value }),
251
- connectionState: (value) => ({
252
- [HTTPAttributes.connectionState]: value
253
- }),
254
- server: (data) => {
255
- const result = {};
256
- if (data.method !== void 0)
257
- result[HTTPAttributes.requestMethod] = data.method;
258
- if (data.route !== void 0) result[HTTPAttributes.route] = data.route;
259
- if (data.statusCode !== void 0)
260
- result[HTTPAttributes.responseStatusCode] = data.statusCode;
261
- if (data.bodySize !== void 0)
262
- result[HTTPAttributes.requestBodySize] = data.bodySize;
263
- if (data.requestSize !== void 0)
264
- result[HTTPAttributes.requestSize] = data.requestSize;
265
- if (data.responseSize !== void 0)
266
- result[HTTPAttributes.responseSize] = data.responseSize;
267
- if (data.resendCount !== void 0)
268
- result[HTTPAttributes.requestResendCount] = data.resendCount;
269
- return result;
270
- },
271
- client: (data) => {
272
- const result = {};
273
- if (data.method !== void 0)
274
- result[HTTPAttributes.requestMethod] = data.method;
275
- if (data.url !== void 0) result[HTTPAttributes.route] = data.url;
276
- if (data.statusCode !== void 0)
277
- result[HTTPAttributes.responseStatusCode] = data.statusCode;
278
- return result;
279
- }
280
- },
281
- db: {
282
- client: {
283
- system: (value) => ({ [DBAttributes.systemName]: value }),
284
- operation: (value) => ({ [DBAttributes.operationName]: value }),
285
- collectionName: (value) => ({
286
- [DBAttributes.collectionName]: value
287
- }),
288
- namespace: (value) => ({ [DBAttributes.namespace]: value }),
289
- statement: (value) => ({ [DBAttributes.statement]: value }),
290
- querySummary: (value) => ({ [DBAttributes.querySummary]: value }),
291
- queryText: (value) => ({ [DBAttributes.queryText]: value }),
292
- responseStatus: (value) => ({
293
- [DBAttributes.responseStatusCode]: value
294
- }),
295
- rowsReturned: (value) => ({
296
- [DBAttributes.responseReturnedRows]: value
297
- }),
298
- data: (data) => {
299
- const result = {};
300
- if (data.system !== void 0)
301
- result[DBAttributes.systemName] = data.system;
302
- if (data.operation !== void 0)
303
- result[DBAttributes.operationName] = data.operation;
304
- if (data.collectionName !== void 0)
305
- result[DBAttributes.collectionName] = data.collectionName;
306
- if (data.name !== void 0) result[DBAttributes.namespace] = data.name;
307
- if (data.namespace !== void 0)
308
- result[DBAttributes.namespace] = data.namespace;
309
- if (data.statement !== void 0)
310
- result[DBAttributes.statement] = data.statement;
311
- if (data.querySummary !== void 0)
312
- result[DBAttributes.querySummary] = data.querySummary;
313
- if (data.queryText !== void 0)
314
- result[DBAttributes.queryText] = data.queryText;
315
- if (data.responseStatus !== void 0)
316
- result[DBAttributes.responseStatusCode] = data.responseStatus;
317
- if (data.rowsReturned !== void 0)
318
- result[DBAttributes.responseReturnedRows] = data.rowsReturned;
319
- return result;
320
- }
321
- }
322
- },
323
- service: {
324
- name: (value) => ({ [ServiceAttributes.name]: value }),
325
- instance: (value) => ({ [ServiceAttributes.instance]: value }),
326
- version: (value) => ({ [ServiceAttributes.version]: value }),
327
- data: (data) => {
328
- const result = {};
329
- if (data.name !== void 0) result[ServiceAttributes.name] = data.name;
330
- if (data.instance !== void 0)
331
- result[ServiceAttributes.instance] = data.instance;
332
- if (data.version !== void 0)
333
- result[ServiceAttributes.version] = data.version;
334
- return result;
335
- }
336
- },
337
- network: {
338
- peerAddress: (value) => ({
339
- [NetworkAttributes.peerAddress]: value
340
- }),
341
- peerPort: (value) => ({ [NetworkAttributes.peerPort]: value }),
342
- transport: (value) => ({ [NetworkAttributes.transport]: value }),
343
- protocolName: (value) => ({
344
- [NetworkAttributes.protocolName]: value
345
- }),
346
- protocolVersion: (value) => ({
347
- [NetworkAttributes.protocolVersion]: value
348
- }),
349
- data: (data) => {
350
- const result = {};
351
- if (data.peerAddress !== void 0)
352
- result[NetworkAttributes.peerAddress] = data.peerAddress;
353
- if (data.peerPort !== void 0)
354
- result[NetworkAttributes.peerPort] = data.peerPort;
355
- if (data.transport !== void 0)
356
- result[NetworkAttributes.transport] = data.transport;
357
- if (data.protocolName !== void 0)
358
- result[NetworkAttributes.protocolName] = data.protocolName;
359
- if (data.protocolVersion !== void 0)
360
- result[NetworkAttributes.protocolVersion] = data.protocolVersion;
361
- return result;
362
- }
363
- },
364
- server: {
365
- address: (value) => ({ [ServerAddressAttributes.address]: value }),
366
- port: (value) => ({ [ServerAddressAttributes.port]: value }),
367
- socketAddress: (value) => ({
368
- [ServerAddressAttributes.socketAddress]: value
369
- }),
370
- data: (data) => {
371
- const result = {};
372
- if (data.address !== void 0)
373
- result[ServerAddressAttributes.address] = data.address;
374
- if (data.port !== void 0)
375
- result[ServerAddressAttributes.port] = data.port;
376
- if (data.socketAddress !== void 0)
377
- result[ServerAddressAttributes.socketAddress] = data.socketAddress;
378
- return result;
379
- }
380
- },
381
- url: {
382
- scheme: (value) => ({ [URLAttributes.scheme]: value }),
383
- full: (value) => ({ [URLAttributes.full]: value }),
384
- path: (value) => ({ [URLAttributes.path]: value }),
385
- query: (value) => ({ [URLAttributes.query]: value }),
386
- fragment: (value) => ({ [URLAttributes.fragment]: value }),
387
- data: (data) => {
388
- const result = {};
389
- if (data.scheme !== void 0) result[URLAttributes.scheme] = data.scheme;
390
- if (data.full !== void 0) result[URLAttributes.full] = data.full;
391
- if (data.path !== void 0) result[URLAttributes.path] = data.path;
392
- if (data.query !== void 0) result[URLAttributes.query] = data.query;
393
- if (data.fragment !== void 0)
394
- result[URLAttributes.fragment] = data.fragment;
395
- return result;
396
- }
397
- },
398
- error: {
399
- type: (value) => ({ [ErrorAttributes.type]: value }),
400
- message: (value) => ({ [ErrorAttributes.message]: value }),
401
- stackTrace: (value) => ({ [ErrorAttributes.stackTrace]: value }),
402
- code: (value) => ({ [ErrorAttributes.code]: value }),
403
- data: (data) => {
404
- const result = {};
405
- if (data.type !== void 0) result[ErrorAttributes.type] = data.type;
406
- if (data.message !== void 0)
407
- result[ErrorAttributes.message] = data.message;
408
- if (data.stackTrace !== void 0)
409
- result[ErrorAttributes.stackTrace] = data.stackTrace;
410
- if (data.code !== void 0) result[ErrorAttributes.code] = data.code;
411
- return result;
412
- }
413
- },
414
- exception: {
415
- escaped: (value) => ({ [ExceptionAttributes.escaped]: value }),
416
- message: (value) => ({ [ExceptionAttributes.message]: value }),
417
- stackTrace: (value) => ({
418
- [ExceptionAttributes.stackTrace]: value
419
- }),
420
- type: (value) => ({ [ExceptionAttributes.type]: value }),
421
- moduleName: (value) => ({
422
- [ExceptionAttributes.moduleName]: value
423
- }),
424
- data: (data) => {
425
- const result = {};
426
- if (data.escaped !== void 0)
427
- result[ExceptionAttributes.escaped] = data.escaped;
428
- if (data.message !== void 0)
429
- result[ExceptionAttributes.message] = data.message;
430
- if (data.stackTrace !== void 0)
431
- result[ExceptionAttributes.stackTrace] = data.stackTrace;
432
- if (data.type !== void 0) result[ExceptionAttributes.type] = data.type;
433
- if (data.moduleName !== void 0)
434
- result[ExceptionAttributes.moduleName] = data.moduleName;
435
- return result;
436
- }
437
- },
438
- process: {
439
- pid: (value) => ({ [ProcessAttributes.pid]: value }),
440
- executablePath: (value) => ({
441
- [ProcessAttributes.executablePath]: value
442
- }),
443
- command: (value) => ({ [ProcessAttributes.command]: value }),
444
- owner: (value) => ({ [ProcessAttributes.owner]: value }),
445
- data: (data) => {
446
- const result = {};
447
- if (data.pid !== void 0) result[ProcessAttributes.pid] = data.pid;
448
- if (data.executablePath !== void 0)
449
- result[ProcessAttributes.executablePath] = data.executablePath;
450
- if (data.command !== void 0)
451
- result[ProcessAttributes.command] = data.command;
452
- if (data.owner !== void 0)
453
- result[ProcessAttributes.owner] = data.owner;
454
- return result;
455
- }
456
- },
457
- thread: {
458
- id: (value) => ({ [ThreadAttributes.id]: value }),
459
- name: (value) => ({ [ThreadAttributes.name]: value })
460
- },
461
- container: {
462
- id: (value) => ({ [ContainerAttributes.id]: value }),
463
- name: (value) => ({ [ContainerAttributes.name]: value }),
464
- image: (value) => ({ [ContainerAttributes.image]: value }),
465
- tag: (value) => ({ [ContainerAttributes.tag]: value }),
466
- data: (data) => {
467
- const result = {};
468
- if (data.id !== void 0) result[ContainerAttributes.id] = data.id;
469
- if (data.name !== void 0) result[ContainerAttributes.name] = data.name;
470
- if (data.image !== void 0)
471
- result[ContainerAttributes.image] = data.image;
472
- if (data.tag !== void 0) result[ContainerAttributes.tag] = data.tag;
473
- return result;
474
- }
475
- },
476
- k8s: {
477
- podName: (value) => ({ [K8sAttributes.podName]: value }),
478
- namespaceName: (value) => ({
479
- [K8sAttributes.namespaceName]: value
480
- }),
481
- deploymentName: (value) => ({
482
- [K8sAttributes.deploymentName]: value
483
- }),
484
- state: (value) => ({ [K8sAttributes.state]: value })
485
- },
486
- cloud: {
487
- provider: (value) => ({ [CloudAttributes.provider]: value }),
488
- accountId: (value) => ({ [CloudAttributes.accountId]: value }),
489
- region: (value) => ({ [CloudAttributes.region]: value }),
490
- availabilityZone: (value) => ({
491
- [CloudAttributes.availabilityZone]: value
492
- }),
493
- platform: (value) => ({ [CloudAttributes.platform]: value }),
494
- data: (data) => {
495
- const result = {};
496
- if (data.provider !== void 0)
497
- result[CloudAttributes.provider] = data.provider;
498
- if (data.accountId !== void 0)
499
- result[CloudAttributes.accountId] = data.accountId;
500
- if (data.region !== void 0)
501
- result[CloudAttributes.region] = data.region;
502
- if (data.availabilityZone !== void 0)
503
- result[CloudAttributes.availabilityZone] = data.availabilityZone;
504
- if (data.platform !== void 0)
505
- result[CloudAttributes.platform] = data.platform;
506
- return result;
507
- }
508
- },
509
- faas: {
510
- name: (value) => ({ [FaaSAttributes.name]: value }),
511
- version: (value) => ({ [FaaSAttributes.version]: value }),
512
- instance: (value) => ({ [FaaSAttributes.instance]: value }),
513
- execution: (value) => ({ [FaaSAttributes.execution]: value }),
514
- coldstart: (value) => ({ [FaaSAttributes.coldstart]: value })
515
- },
516
- featureFlag: {
517
- key: (value) => ({ [FeatureFlagAttributes.key]: value }),
518
- provider: (value) => ({ [FeatureFlagAttributes.provider]: value }),
519
- variant: (value) => ({ [FeatureFlagAttributes.variant]: value })
520
- },
521
- messaging: {
522
- system: (value) => ({ [MessagingAttributes.system]: value }),
523
- destination: (value) => ({
524
- [MessagingAttributes.destination]: value
525
- }),
526
- operation: (value) => ({
527
- [MessagingAttributes.operation]: value
528
- }),
529
- messageId: (value) => ({ [MessagingAttributes.messageId]: value }),
530
- conversationId: (value) => ({
531
- [MessagingAttributes.conversationId]: value
532
- }),
533
- data: (data) => {
534
- const result = {};
535
- if (data.system !== void 0)
536
- result[MessagingAttributes.system] = data.system;
537
- if (data.destination !== void 0)
538
- result[MessagingAttributes.destination] = data.destination;
539
- if (data.operation !== void 0)
540
- result[MessagingAttributes.operation] = data.operation;
541
- if (data.messageId !== void 0)
542
- result[MessagingAttributes.messageId] = data.messageId;
543
- if (data.conversationId !== void 0)
544
- result[MessagingAttributes.conversationId] = data.conversationId;
545
- return result;
546
- }
547
- },
548
- genAI: {
549
- system: (value) => ({ [GenAIAttributes.system]: value }),
550
- requestModel: (value) => ({
551
- [GenAIAttributes.requestModel]: value
552
- }),
553
- responseModel: (value) => ({
554
- [GenAIAttributes.responseModel]: value
555
- }),
556
- operationName: (value) => ({
557
- [GenAIAttributes.operationName]: value
558
- }),
559
- usagePromptTokens: (value) => ({
560
- [GenAIAttributes.usagePromptTokens]: value
561
- }),
562
- usageCompletionTokens: (value) => ({
563
- [GenAIAttributes.usageCompletionTokens]: value
564
- }),
565
- provider: (value) => ({ [GenAIAttributes.provider]: value })
566
- },
567
- rpc: {
568
- system: (value) => ({ [RPCAttributes.system]: value }),
569
- service: (value) => ({ [RPCAttributes.service]: value }),
570
- method: (value) => ({ [RPCAttributes.method]: value }),
571
- grpcStatusCode: (value) => ({
572
- [RPCAttributes.grpcStatusCode]: value
573
- })
574
- },
575
- graphql: {
576
- document: (value) => ({ [GraphQLAttributes.document]: value }),
577
- operationName: (value) => ({
578
- [GraphQLAttributes.operationName]: value
579
- }),
580
- operationType: (value) => ({
581
- [GraphQLAttributes.operationType]: value
582
- })
583
- },
584
- otel: {
585
- libraryName: (value) => ({ [OTelAttributes.libraryName]: value }),
586
- libraryVersion: (value) => ({
587
- [OTelAttributes.libraryVersion]: value
588
- }),
589
- statusCode: (value) => ({ [OTelAttributes.statusCode]: value })
590
- },
591
- code: {
592
- namespace: (value) => ({ [CodeAttributes.namespace]: value }),
593
- filepath: (value) => ({ [CodeAttributes.filepath]: value }),
594
- function: (value) => ({ [CodeAttributes.function]: value }),
595
- class: (value) => ({ [CodeAttributes.class]: value }),
596
- method: (value) => ({ [CodeAttributes.method]: value }),
597
- column: (value) => ({ [CodeAttributes.column]: value }),
598
- lineNumber: (value) => ({ [CodeAttributes.lineNumber]: value }),
599
- repository: (value) => ({ [CodeAttributes.repository]: value }),
600
- revision: (value) => ({ [CodeAttributes.revision]: value })
601
- },
602
- tls: {
603
- protocolVersion: (value) => ({
604
- [TLSAttributes.protocolVersion]: value
605
- }),
606
- cipher: (value) => ({ [TLSAttributes.cipher]: value }),
607
- curveName: (value) => ({ [TLSAttributes.curveName]: value }),
608
- resumed: (value) => ({ [TLSAttributes.resumed]: value })
609
- }
610
- };
611
-
612
- // src/attributes/validators.ts
613
- var DEPRECATED_ATTRIBUTES = {
614
- "enduser.id": "user.id",
615
- "enduser.role": "user.roles",
616
- "enduser.scope": void 0,
617
- "http.method": "http.request.method",
618
- "http.host": "server.address",
619
- "http.status_code": "http.response.status_code",
620
- "http.target": "url.path",
621
- "http.url": "url.full",
622
- "http.user_agent": "user_agent.original",
623
- "http.flavor": "network.protocol.name",
624
- "http.scheme": "url.scheme",
625
- "http.server_name": "server.address",
626
- "db.name": "db.namespace",
627
- "db.operation": "db.operation.name",
628
- "db.statement": "db.query.text",
629
- "db.system": "db.system.name",
630
- "db.collection": "db.collection.name",
631
- "db.instance.id": void 0,
632
- "db.jdbc.driver_classname": void 0,
633
- "db.mssql.instance_name": "mssql.instance.name",
634
- "db.sql.table": "db.collection.name",
635
- "http.client_ip": "client.address",
636
- "user_agent.original": "user_agent.original"
637
- };
638
- var HTTP_METHODS = /* @__PURE__ */ new Set([
639
- "GET",
640
- "POST",
641
- "PUT",
642
- "DELETE",
643
- "PATCH",
644
- "HEAD",
645
- "OPTIONS",
646
- "TRACE",
647
- "QUERY",
648
- "_OTHER"
649
- ]);
650
- function validateAttribute(key, value, policy = {}) {
651
- const { guardrails = {} } = policy;
652
- if (value === void 0 || value === null) {
653
- return void 0;
654
- }
655
- if (typeof value !== "string") {
656
- return value;
657
- }
658
- const stringValue = value;
659
- if (guardrails.pii) {
660
- const piiResult = applyPIIPolicy(key, stringValue, guardrails.pii);
661
- if (piiResult !== stringValue) {
662
- return piiResult;
663
- }
664
- }
665
- if (guardrails.maxLength && stringValue.length > guardrails.maxLength) {
666
- return truncateValue(key, stringValue, guardrails.maxLength);
667
- }
668
- if (guardrails.validateEnum && HTTP_METHODS.has(stringValue)) {
669
- const normalizedMethod = normalizeHTTPMethod(stringValue);
670
- if (normalizedMethod !== stringValue) {
671
- return normalizedMethod;
672
- }
673
- }
674
- return stringValue;
675
- }
676
- function applyPIIPolicy(key, value, pii) {
677
- if (pii === "allow") {
678
- return value;
679
- }
680
- if (pii === "redact") {
681
- return redactIfPII(key, value);
682
- }
683
- if (pii === "hash") {
684
- return hashIfPII(key, value);
685
- }
686
- if (pii === "block" && isPIIKey(key)) {
687
- throw new Error(
688
- `PII attribute "${key}" is blocked by guardrails. Use pii: "allow" to enable it.`
689
- );
690
- }
691
- return value;
692
- }
693
- function isPIIKey(key) {
694
- const piiKeyPatterns = [
695
- "email",
696
- "phone",
697
- "ssn",
698
- "credit_card",
699
- "password",
700
- "secret",
701
- "token",
702
- "api_key",
703
- "authorization"
704
- ];
705
- const lowerKey = key.toLowerCase();
706
- return piiKeyPatterns.some((pattern) => lowerKey.includes(pattern));
707
- }
708
- function redactIfPII(key, value) {
709
- if (isPIIKey(key)) {
710
- for (const [, pattern] of Object.entries(chunkELW34S4C_cjs.REDACTOR_PATTERNS)) {
711
- if (pattern instanceof RegExp && pattern.test(value)) {
712
- return "[REDACTED]";
713
- }
714
- }
715
- return "[REDACTED]";
716
- }
717
- return value;
718
- }
719
- function hashIfPII(key, value) {
720
- if (!isPIIKey(key)) {
721
- return value;
722
- }
723
- const FNV_PRIME = 16777619;
724
- const FNV_OFFSET = 2166136261;
725
- const hashes = [];
726
- for (let round = 0; round < 4; round++) {
727
- let hash = FNV_OFFSET;
728
- for (let i = 0; i < value.length; i++) {
729
- hash ^= (value.codePointAt(i) ?? 0) + round;
730
- hash = Math.imul(hash, FNV_PRIME);
731
- }
732
- hashes.push(hash >>> 0);
733
- }
734
- return `hash_${hashes.map((h) => h.toString(16).padStart(8, "0")).join("")}`;
735
- }
736
- function truncateValue(key, value, maxLength) {
737
- if (value.length <= maxLength) {
738
- return value;
739
- }
740
- return value.slice(0, maxLength - 3) + "...";
741
- }
742
- function normalizeHTTPMethod(method) {
743
- const upper = method.toUpperCase();
744
- if (HTTP_METHODS.has(upper)) {
745
- return upper;
746
- }
747
- return upper;
748
- }
749
- function checkDeprecatedAttribute(key, policy = {}) {
750
- const { guardrails = {}, deprecatedWarnings = {} } = policy;
751
- const { warnDeprecated = true } = guardrails;
752
- if (!warnDeprecated) {
753
- return null;
754
- }
755
- const isDeprecated = key in DEPRECATED_ATTRIBUTES;
756
- if (isDeprecated) {
757
- const replacement2 = DEPRECATED_ATTRIBUTES[key];
758
- if (replacement2 === void 0) {
759
- console.warn(
760
- `[autotel/attributes] Attribute "${key}" is deprecated and has no replacement. Remove or find a replacement in OpenTelemetry semantic conventions.`
761
- );
762
- } else {
763
- console.warn(
764
- `[autotel/attributes] Attribute "${key}" is deprecated. Use "${replacement2}" instead.`
765
- );
766
- }
767
- }
768
- if (deprecatedWarnings[key]) {
769
- console.warn(`[autotel/attributes] ${deprecatedWarnings[key]}`);
770
- }
771
- const replacement = DEPRECATED_ATTRIBUTES[key];
772
- return replacement ?? null;
773
- }
774
- function autoRedactPII(attributes, policy = {}) {
775
- const { guardrails = { pii: "redact" } } = policy;
776
- const redacted = {};
777
- for (const [key, value] of Object.entries(attributes)) {
778
- redacted[key] = validateAttribute(key, value, { guardrails });
779
- }
780
- return redacted;
781
- }
782
- function defaultGuardrails() {
783
- return {
784
- pii: "redact",
785
- maxLength: 255,
786
- validateEnum: true,
787
- warnDeprecated: true
788
- };
789
- }
790
-
791
- // src/attributes/utils.ts
792
- function mergeAttrs(...attrSets) {
793
- const result = {};
794
- for (const attrSet of attrSets) {
795
- if (attrSet) {
796
- Object.assign(result, attrSet);
797
- }
798
- }
799
- return result;
800
- }
801
- function safeSetAttributes(span, attrs2, policy) {
802
- const mergedGuardrails = {
803
- ...defaultGuardrails(),
804
- ...policy?.guardrails
805
- };
806
- const effectivePolicy = {
807
- ...policy,
808
- guardrails: mergedGuardrails
809
- };
810
- const validated = autoRedactPII(attrs2, effectivePolicy);
811
- const sanitizedAttrs = {};
812
- for (const [key, value] of Object.entries(validated)) {
813
- if (value !== void 0) {
814
- checkDeprecatedAttribute(key, effectivePolicy);
815
- const validatedValue = validateAttribute(key, value, effectivePolicy);
816
- if (validatedValue !== void 0) {
817
- sanitizedAttrs[key] = validatedValue;
818
- }
819
- }
820
- }
821
- span.setAttributes(sanitizedAttrs);
822
- }
823
-
824
- // src/attributes/attachers.ts
825
- function setUser(spanOrContext, data, guardrails) {
826
- const attributes = attrs.user.data(data);
827
- safeSetAttributes(spanOrContext, attributes, guardrails);
828
- }
829
- function setSession(spanOrContext, data, guardrails) {
830
- const attributes = attrs.session.data(data);
831
- safeSetAttributes(spanOrContext, attributes, guardrails);
832
- }
833
- function setDevice(spanOrContext, data, guardrails) {
834
- const attributes = attrs.device.data(data);
835
- safeSetAttributes(spanOrContext, attributes, guardrails);
836
- }
837
- function httpServer(spanOrContext, data, guardrails) {
838
- const attributes = attrs.http.server(data);
839
- if ("updateName" in spanOrContext && data.method && data.route) {
840
- const span = spanOrContext;
841
- span.updateName(`HTTP ${data.method} ${data.route}`);
842
- }
843
- safeSetAttributes(spanOrContext, attributes, guardrails);
844
- }
845
- function httpClient(spanOrContext, data, guardrails) {
846
- const attributes = attrs.http.client(data);
847
- safeSetAttributes(spanOrContext, attributes, guardrails);
848
- }
849
- function dbClient(spanOrContext, data, guardrails) {
850
- const attributes = attrs.db.client.data(data);
851
- safeSetAttributes(spanOrContext, attributes, guardrails);
852
- }
853
- function mergeServiceResource(resource, data) {
854
- const attributes = attrs.service.data(data);
855
- return resource.merge(resources.resourceFromAttributes(attributes));
856
- }
857
- function identify(spanOrContext, data, guardrails) {
858
- const allAttrs = [];
859
- if (data.user) {
860
- allAttrs.push(attrs.user.data(data.user));
861
- }
862
- if (data.session) {
863
- allAttrs.push(attrs.session.data(data.session));
864
- }
865
- if (data.device) {
866
- allAttrs.push(attrs.device.data(data.device));
867
- }
868
- const merged = {};
869
- for (const attrSet of allAttrs) {
870
- Object.assign(merged, attrSet);
871
- }
872
- safeSetAttributes(spanOrContext, merged, guardrails);
873
- }
874
- function request(spanOrContext, data, guardrails) {
875
- const httpAttrs = attrs.http.server(data);
876
- const networkAttrs = attrs.network.peerAddress(data.clientIp || "");
877
- const merged = { ...httpAttrs, ...networkAttrs };
878
- safeSetAttributes(spanOrContext, merged, guardrails);
879
- }
880
- function setError(spanOrContext, data, guardrails) {
881
- const attributes = attrs.error.data(data);
882
- safeSetAttributes(spanOrContext, attributes, guardrails);
883
- }
884
- function setException(spanOrContext, data, guardrails) {
885
- const attributes = attrs.exception.data(data);
886
- safeSetAttributes(spanOrContext, attributes, guardrails);
887
- }
888
-
889
- // src/attributes/domains.ts
890
- function transaction(spanOrContext, config, guardrails) {
891
- const userAttrs = attrs.user.data(config.user || {});
892
- const sessionAttrs = attrs.session.data(config.session || {});
893
- const httpAttrs = attrs.http.server({
894
- method: config.method,
895
- route: config.route,
896
- statusCode: config.statusCode
897
- });
898
- const networkAttrs = attrs.network.peerAddress(config.clientIp || "");
899
- const merged = {
900
- ...userAttrs,
901
- ...sessionAttrs,
902
- ...httpAttrs,
903
- ...networkAttrs
904
- };
905
- if (config.method && config.route && "updateName" in spanOrContext) {
906
- spanOrContext.updateName(`HTTP ${config.method} ${config.route}`);
907
- }
908
- safeSetAttributes(spanOrContext, merged, guardrails);
909
- }
910
-
911
- exports.attrs = attrs;
912
- exports.autoRedactPII = autoRedactPII;
913
- exports.checkDeprecatedAttribute = checkDeprecatedAttribute;
914
- exports.dbClient = dbClient;
915
- exports.defaultGuardrails = defaultGuardrails;
916
- exports.httpClient = httpClient;
917
- exports.httpServer = httpServer;
918
- exports.identify = identify;
919
- exports.mergeAttrs = mergeAttrs;
920
- exports.mergeServiceResource = mergeServiceResource;
921
- exports.request = request;
922
- exports.safeSetAttributes = safeSetAttributes;
923
- exports.setDevice = setDevice;
924
- exports.setError = setError;
925
- exports.setException = setException;
926
- exports.setSession = setSession;
927
- exports.setUser = setUser;
928
- exports.transaction = transaction;
929
- exports.validateAttribute = validateAttribute;
930
- //# sourceMappingURL=chunk-7F4PDILZ.cjs.map
931
- //# sourceMappingURL=chunk-7F4PDILZ.cjs.map