autotel 3.2.0 → 3.3.1

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 (76) hide show
  1. package/dist/auto.cjs +2 -2
  2. package/dist/auto.js +1 -1
  3. package/dist/{chunk-RZI5XXAD.js → chunk-2GWM2CIT.js} +3 -3
  4. package/dist/{chunk-RZI5XXAD.js.map → chunk-2GWM2CIT.js.map} +1 -1
  5. package/dist/{chunk-IS2QJ44P.js → chunk-4EXFRREO.js} +3 -3
  6. package/dist/{chunk-IS2QJ44P.js.map → chunk-4EXFRREO.js.map} +1 -1
  7. package/dist/{chunk-FVA2YDEQ.js → chunk-55ALGIAR.js} +4 -4
  8. package/dist/{chunk-FVA2YDEQ.js.map → chunk-55ALGIAR.js.map} +1 -1
  9. package/dist/{chunk-ZKKJQS6R.js → chunk-B4CGFDZQ.js} +29 -7
  10. package/dist/chunk-B4CGFDZQ.js.map +1 -0
  11. package/dist/{chunk-5RZ3NZ2M.cjs → chunk-C4JCSBFO.cjs} +5 -5
  12. package/dist/{chunk-5RZ3NZ2M.cjs.map → chunk-C4JCSBFO.cjs.map} +1 -1
  13. package/dist/{chunk-NN2GODP4.cjs → chunk-DK6VFPVK.cjs} +7 -7
  14. package/dist/{chunk-NN2GODP4.cjs.map → chunk-DK6VFPVK.cjs.map} +1 -1
  15. package/dist/{chunk-EEQHQKPP.cjs → chunk-FMTNB27Z.cjs} +32 -32
  16. package/dist/{chunk-EEQHQKPP.cjs.map → chunk-FMTNB27Z.cjs.map} +1 -1
  17. package/dist/{chunk-UV64CWMA.cjs → chunk-JAX4LFGG.cjs} +13 -13
  18. package/dist/{chunk-UV64CWMA.cjs.map → chunk-JAX4LFGG.cjs.map} +1 -1
  19. package/dist/{chunk-7EVW3Z37.js → chunk-LCXOOJIP.js} +3 -3
  20. package/dist/{chunk-7EVW3Z37.js.map → chunk-LCXOOJIP.js.map} +1 -1
  21. package/dist/{chunk-QVLMGNQF.js → chunk-LKASEUWE.js} +4 -4
  22. package/dist/{chunk-QVLMGNQF.js.map → chunk-LKASEUWE.js.map} +1 -1
  23. package/dist/{chunk-4UUEGERM.cjs → chunk-PWOECUNT.cjs} +17 -17
  24. package/dist/{chunk-4UUEGERM.cjs.map → chunk-PWOECUNT.cjs.map} +1 -1
  25. package/dist/{chunk-KKIYPZOP.cjs → chunk-RYVFCHSO.cjs} +29 -7
  26. package/dist/chunk-RYVFCHSO.cjs.map +1 -0
  27. package/dist/{chunk-NIDUQZIN.js → chunk-VFU663OM.js} +3 -3
  28. package/dist/{chunk-NIDUQZIN.js.map → chunk-VFU663OM.js.map} +1 -1
  29. package/dist/{chunk-RRTFFAG3.cjs → chunk-VUYLXWCB.cjs} +5 -5
  30. package/dist/{chunk-RRTFFAG3.cjs.map → chunk-VUYLXWCB.cjs.map} +1 -1
  31. package/dist/correlation-id.cjs +10 -10
  32. package/dist/correlation-id.js +2 -2
  33. package/dist/decorators.cjs +4 -4
  34. package/dist/decorators.js +3 -3
  35. package/dist/event.cjs +6 -6
  36. package/dist/event.js +3 -3
  37. package/dist/functional.cjs +11 -11
  38. package/dist/functional.js +3 -3
  39. package/dist/http.cjs +3 -3
  40. package/dist/http.js +2 -2
  41. package/dist/index.cjs +215 -70
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.cts +185 -2
  44. package/dist/index.d.ts +185 -2
  45. package/dist/index.js +149 -12
  46. package/dist/index.js.map +1 -1
  47. package/dist/{init-BSyIyDs5.d.ts → init-DyE43paw.d.ts} +7 -2
  48. package/dist/{init-D9Bxx39e.d.cts → init-gyesUMwz.d.cts} +7 -2
  49. package/dist/instrumentation.cjs +8 -8
  50. package/dist/instrumentation.js +1 -1
  51. package/dist/messaging.cjs +7 -7
  52. package/dist/messaging.js +4 -4
  53. package/dist/semantic-helpers.cjs +8 -8
  54. package/dist/semantic-helpers.js +4 -4
  55. package/dist/webhook.cjs +5 -5
  56. package/dist/webhook.js +3 -3
  57. package/dist/workflow-distributed.cjs +5 -5
  58. package/dist/workflow-distributed.js +3 -3
  59. package/dist/workflow.cjs +8 -8
  60. package/dist/workflow.js +4 -4
  61. package/dist/yaml-config.d.cts +1 -1
  62. package/dist/yaml-config.d.ts +1 -1
  63. package/package.json +9 -9
  64. package/skills/build-audit-trails/SKILL.md +163 -5
  65. package/skills/build-audit-trails/references/audit-queries.md +73 -0
  66. package/skills/build-audit-trails/references/framework-wiring.md +196 -0
  67. package/skills/review-otel-patterns/SKILL.md +44 -0
  68. package/src/error-catalog.test.ts +133 -0
  69. package/src/error-catalog.ts +262 -0
  70. package/src/gen-ai-cost.test.ts +81 -0
  71. package/src/gen-ai-cost.ts +145 -0
  72. package/src/index.ts +29 -0
  73. package/src/init-auto-redactor.test.ts +53 -0
  74. package/src/init.ts +50 -7
  75. package/dist/chunk-KKIYPZOP.cjs.map +0 -1
  76. package/dist/chunk-ZKKJQS6R.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkEEQHQKPP_cjs = require('./chunk-EEQHQKPP.cjs');
3
+ var chunkFMTNB27Z_cjs = require('./chunk-FMTNB27Z.cjs');
4
4
 
5
5
  // src/semantic-helpers.ts
6
6
  function traceLLM(config) {
7
7
  return (fnFactory) => {
8
- return chunkEEQHQKPP_cjs.trace((ctx) => {
8
+ return chunkFMTNB27Z_cjs.trace((ctx) => {
9
9
  ctx.setAttribute("gen.ai.request.model", config.model);
10
10
  ctx.setAttribute("gen.ai.operation.name", config.operation || "chat");
11
11
  if (config.provider) {
@@ -25,7 +25,7 @@ function traceLLM(config) {
25
25
  }
26
26
  function traceDB(config) {
27
27
  return (fnFactory) => {
28
- return chunkEEQHQKPP_cjs.trace((ctx) => {
28
+ return chunkFMTNB27Z_cjs.trace((ctx) => {
29
29
  ctx.setAttribute("db.system", config.system);
30
30
  if (config.operation) {
31
31
  ctx.setAttribute("db.operation", config.operation);
@@ -50,7 +50,7 @@ function traceDB(config) {
50
50
  }
51
51
  function traceHTTP(config) {
52
52
  return (fnFactory) => {
53
- return chunkEEQHQKPP_cjs.trace((ctx) => {
53
+ return chunkFMTNB27Z_cjs.trace((ctx) => {
54
54
  if (config.method) {
55
55
  ctx.setAttribute("http.request.method", config.method);
56
56
  }
@@ -71,7 +71,7 @@ function traceHTTP(config) {
71
71
  }
72
72
  function traceMessaging(config) {
73
73
  return (fnFactory) => {
74
- return chunkEEQHQKPP_cjs.trace((ctx) => {
74
+ return chunkFMTNB27Z_cjs.trace((ctx) => {
75
75
  ctx.setAttribute("messaging.system", config.system);
76
76
  if (config.operation) {
77
77
  ctx.setAttribute("messaging.operation", config.operation);
@@ -96,5 +96,5 @@ exports.traceDB = traceDB;
96
96
  exports.traceHTTP = traceHTTP;
97
97
  exports.traceLLM = traceLLM;
98
98
  exports.traceMessaging = traceMessaging;
99
- //# sourceMappingURL=chunk-NN2GODP4.cjs.map
100
- //# sourceMappingURL=chunk-NN2GODP4.cjs.map
99
+ //# sourceMappingURL=chunk-DK6VFPVK.cjs.map
100
+ //# sourceMappingURL=chunk-DK6VFPVK.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/semantic-helpers.ts"],"names":["trace"],"mappings":";;;;;AAiLO,SAAS,SAA2C,MAAA,EAAmB;AAC5E,EAAA,OAAO,CACL,SAAA,KAC2C;AAC3C,IAAA,OAAOA,uBAAA,CAAsB,CAAC,GAAA,KAAQ;AAEpC,MAAA,GAAA,CAAI,YAAA,CAAa,sBAAA,EAAwB,MAAA,CAAO,KAAK,CAAA;AACrD,MAAA,GAAA,CAAI,YAAA,CAAa,uBAAA,EAAyB,MAAA,CAAO,SAAA,IAAa,MAAM,CAAA;AACpE,MAAA,IAAI,OAAO,QAAA,EAAU;AACnB,QAAA,GAAA,CAAI,YAAA,CAAa,eAAA,EAAiB,MAAA,CAAO,QAAQ,CAAA;AAAA,MACnD;AACA,MAAA,IAAI,OAAO,UAAA,EAAY;AACrB,QAAA,KAAA,MAAW,CAAC,KAAK,KAAK,CAAA,IAAK,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eACd,MAAA,EACA;AACA,EAAA,OAAO,CACL,SAAA,KAC2C;AAC3C,IAAA,OAAOA,uBAAA,CAAsB,CAAC,GAAA,KAAQ;AAEpC,MAAA,GAAA,CAAI,YAAA,CAAa,kBAAA,EAAoB,MAAA,CAAO,MAAM,CAAA;AAClD,MAAA,IAAI,OAAO,SAAA,EAAW;AACpB,QAAA,GAAA,CAAI,YAAA,CAAa,qBAAA,EAAuB,MAAA,CAAO,SAAS,CAAA;AAAA,MAC1D;AACA,MAAA,IAAI,OAAO,WAAA,EAAa;AACtB,QAAA,GAAA,CAAI,YAAA,CAAa,4BAAA,EAA8B,MAAA,CAAO,WAAW,CAAA;AAAA,MACnE;AACA,MAAA,IAAI,OAAO,UAAA,EAAY;AACrB,QAAA,KAAA,MAAW,CAAC,KAAK,KAAK,CAAA,IAAK,OAAO,OAAA,CAAQ,MAAA,CAAO,UAAU,CAAA,EAAG;AAC5D,UAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,IAAA,EAAM;AAGzC,YAAA,MAAM,SAAA,GACJ,OAAO,KAAA,KAAU,QAAA,IACjB,OAAO,KAAA,KAAU,QAAA,IACjB,OAAO,KAAA,KAAU,SAAA,GACb,KAAA,GACA,IAAA,CAAK,UAAU,KAAK,CAAA;AAC1B,YAAA,GAAA,CAAI,YAAA,CAAa,KAAK,SAAS,CAAA;AAAA,UACjC;AAAA,QACF;AAAA,MACF;AAGA,MAAA,OAAO,UAAU,GAAG,CAAA;AAAA,IACtB,CAAC,CAAA;AAAA,EACH,CAAA;AACF","file":"chunk-NN2GODP4.cjs","sourcesContent":["/**\n * Semantic convention helpers for OpenTelemetry\n *\n * Pre-configured trace helpers that follow OpenTelemetry semantic conventions\n * for common operation types. Reduces boilerplate and ensures consistency.\n *\n * Based on: https://opentelemetry.io/docs/specs/semconv/\n */\n\nimport { trace } from './functional';\nimport type { TraceContext } from './trace-context';\nimport type { Attributes } from '@opentelemetry/api';\n\n/**\n * Configuration for LLM (Large Language Model) operations\n *\n * Follows Gen AI semantic conventions:\n * https://opentelemetry.io/docs/specs/semconv/gen-ai/\n */\nexport interface LLMConfig {\n /** Model name (e.g., 'gpt-4', 'claude-3-opus') */\n model: string;\n /** Operation type */\n operation?: 'chat' | 'completion' | 'embedding';\n /** Model provider (e.g., 'openai', 'anthropic', 'cohere') - maps to gen.ai.system */\n provider?: string;\n /** Additional attributes to add to the span */\n attributes?: Attributes;\n}\n\n/**\n * Configuration for database operations\n *\n * Follows DB semantic conventions:\n * https://opentelemetry.io/docs/specs/semconv/database/\n */\nexport interface DBConfig {\n /** Database system (e.g., 'postgresql', 'mongodb', 'redis') */\n system: string;\n /** Operation type (e.g., 'SELECT', 'INSERT', 'find', 'get') */\n operation?: string;\n /** Database name */\n database?: string;\n /** Collection/table name */\n collection?: string;\n /** Additional attributes to add to the span */\n attributes?: Attributes;\n}\n\n/**\n * Configuration for HTTP client operations\n *\n * Follows HTTP semantic conventions:\n * https://opentelemetry.io/docs/specs/semconv/http/\n */\nexport interface HTTPConfig {\n /** HTTP method (e.g., 'GET', 'POST') */\n method?: string;\n /** Target URL or URL template */\n url?: string;\n /** Additional attributes to add to the span */\n attributes?: Attributes;\n}\n\n/**\n * Configuration for messaging operations\n *\n * Follows Messaging semantic conventions:\n * https://opentelemetry.io/docs/specs/semconv/messaging/\n */\nexport interface MessagingConfig {\n /** Messaging system (e.g., 'kafka', 'rabbitmq', 'sqs') */\n system: string;\n /** Operation type */\n operation?: 'publish' | 'receive' | 'process';\n /** Destination name (queue/topic) */\n destination?: string;\n /** Additional attributes to add to the span */\n attributes?: Attributes;\n}\n\n/**\n * Trace LLM operations with Gen AI semantic conventions\n *\n * Automatically adds standard attributes for LLM operations:\n * - gen.ai.request.model\n * - gen.ai.operation.name\n * - gen.ai.system\n *\n * **Use Cases:**\n * - Chat completions\n * - Text generation\n * - Embeddings\n * - Multi-step LLM workflows\n *\n * @param config - LLM operation configuration\n * @returns Traced function factory with Gen AI attributes\n *\n * @example Chat completion with OpenAI\n * ```typescript\n * import { traceLLM } from 'autotel/semantic-helpers'\n * import OpenAI from 'openai'\n *\n * const openai = new OpenAI()\n *\n * export const generateResponse = traceLLM({\n * model: 'gpt-4-turbo',\n * operation: 'chat',\n * provider: 'openai'\n * })(ctx => async (prompt: string) => {\n * const response = await openai.chat.completions.create({\n * model: 'gpt-4-turbo',\n * messages: [{ role: 'user', content: prompt }]\n * })\n *\n * // Add usage metrics to span\n * ctx.setAttribute('gen.ai.usage.completion_tokens', response.usage?.completion_tokens)\n * ctx.setAttribute('gen.ai.usage.prompt_tokens', response.usage?.prompt_tokens)\n *\n * return response.choices[0].message.content\n * })\n * ```\n *\n * @example Anthropic Claude with streaming\n * ```typescript\n * import { traceLLM } from 'autotel/semantic-helpers'\n * import Anthropic from '@anthropic-ai/sdk'\n *\n * const anthropic = new Anthropic()\n *\n * export const streamResponse = traceLLM({\n * model: 'claude-3-opus-20240229',\n * operation: 'chat',\n * provider: 'anthropic'\n * })(ctx => async function* (prompt: string) {\n * const stream = await anthropic.messages.create({\n * model: 'claude-3-opus-20240229',\n * messages: [{ role: 'user', content: prompt }],\n * stream: true,\n * max_tokens: 1024\n * })\n *\n * let totalTokens = 0\n * for await (const event of stream) {\n * if (event.type === 'content_block_delta') {\n * yield event.delta.text\n * }\n * if (event.type === 'message_stop') {\n * ctx.setAttribute('gen.ai.usage.completion_tokens', event.message.usage.output_tokens)\n * totalTokens = event.message.usage.output_tokens\n * }\n * }\n *\n * return totalTokens\n * })\n * ```\n *\n * @example Embeddings\n * ```typescript\n * import { traceLLM } from 'autotel/semantic-helpers'\n * import { OpenAIEmbeddings } from '@langchain/openai'\n *\n * const embeddings = new OpenAIEmbeddings()\n *\n * export const embed = traceLLM({\n * model: 'text-embedding-3-small',\n * operation: 'embedding',\n * provider: 'openai'\n * })(ctx => async (text: string) => {\n * const result = await embeddings.embedQuery(text)\n * ctx.setAttribute('gen.ai.response.embedding_length', result.length)\n * return result\n * })\n * ```\n *\n * @public\n */\nexport function traceLLM<TArgs extends unknown[], TReturn>(config: LLMConfig) {\n return (\n fnFactory: (ctx: TraceContext) => (...args: TArgs) => Promise<TReturn>,\n ): ((...args: TArgs) => Promise<TReturn>) => {\n return trace<TArgs, TReturn>((ctx) => {\n // Set semantic convention attributes\n ctx.setAttribute('gen.ai.request.model', config.model);\n ctx.setAttribute('gen.ai.operation.name', config.operation || 'chat');\n if (config.provider) {\n ctx.setAttribute('gen.ai.system', config.provider);\n }\n if (config.attributes) {\n for (const [key, value] of Object.entries(config.attributes)) {\n if (value !== undefined && value !== null) {\n // setAttribute only accepts primitives (string | number | boolean)\n // Arrays and objects should be serialized\n const attrValue =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ? value\n : JSON.stringify(value);\n ctx.setAttribute(key, attrValue);\n }\n }\n }\n\n // Call the user's factory to get their function and return it\n return fnFactory(ctx);\n });\n };\n}\n\n/**\n * Trace database operations with DB semantic conventions\n *\n * Automatically adds standard attributes for database operations:\n * - db.system\n * - db.operation\n * - db.name\n * - db.collection.name (for NoSQL)\n *\n * **Use Cases:**\n * - SQL queries (PostgreSQL, MySQL, SQLite)\n * - NoSQL operations (MongoDB, DynamoDB, Redis)\n * - ORM queries (Prisma, TypeORM, Drizzle)\n *\n * @param config - Database operation configuration\n * @returns Traced function factory with DB attributes\n *\n * @example PostgreSQL query\n * ```typescript\n * import { traceDB } from 'autotel/semantic-helpers'\n * import { pool } from './db'\n *\n * export const getUser = traceDB({\n * system: 'postgresql',\n * operation: 'SELECT',\n * database: 'app_db',\n * collection: 'users'\n * })(ctx => async (userId: string) => {\n * const query = 'SELECT * FROM users WHERE id = $1'\n * ctx.setAttribute('db.statement', query)\n *\n * const result = await pool.query(query, [userId])\n * ctx.setAttribute('db.rows_affected', result.rowCount)\n *\n * return result.rows[0]\n * })\n * ```\n *\n * @example MongoDB with Mongoose\n * ```typescript\n * import { traceDB } from 'autotel/semantic-helpers'\n * import { User } from './models/User'\n *\n * export const findUsers = traceDB({\n * system: 'mongodb',\n * operation: 'find',\n * database: 'app_db',\n * collection: 'users'\n * })(ctx => async (filter: object) => {\n * ctx.setAttribute('db.mongodb.filter', JSON.stringify(filter))\n *\n * const users = await User.find(filter).limit(100)\n * ctx.setAttribute('db.response.count', users.length)\n *\n * return users\n * })\n * ```\n *\n * @example Redis operations\n * ```typescript\n * import { traceDB } from 'autotel/semantic-helpers'\n * import { redis } from './redis'\n *\n * export const cacheGet = traceDB({\n * system: 'redis',\n * operation: 'GET'\n * })(ctx => async (key: string) => {\n * ctx.setAttribute('db.redis.key', key)\n *\n * const value = await redis.get(key)\n * ctx.setAttribute('db.response.cache_hit', value !== null)\n *\n * return value\n * })\n * ```\n *\n * @example Prisma with detailed query info\n * ```typescript\n * import { traceDB } from 'autotel/semantic-helpers'\n * import { prisma } from './prisma'\n *\n * export const createPost = traceDB({\n * system: 'postgresql',\n * operation: 'INSERT',\n * database: 'app_db',\n * collection: 'posts'\n * })(ctx => async (data: { title: string; content: string; authorId: string }) => {\n * ctx.setAttribute('db.prisma.model', 'Post')\n * ctx.setAttribute('db.prisma.action', 'create')\n *\n * const post = await prisma.post.create({ data })\n *\n * ctx.setAttribute('db.response.id', post.id)\n * return post\n * })\n * ```\n *\n * @public\n */\nexport function traceDB<TArgs extends unknown[], TReturn>(config: DBConfig) {\n return (\n fnFactory: (ctx: TraceContext) => (...args: TArgs) => Promise<TReturn>,\n ): ((...args: TArgs) => Promise<TReturn>) => {\n return trace<TArgs, TReturn>((ctx) => {\n // Set semantic convention attributes\n ctx.setAttribute('db.system', config.system);\n if (config.operation) {\n ctx.setAttribute('db.operation', config.operation);\n }\n if (config.database) {\n ctx.setAttribute('db.name', config.database);\n }\n if (config.collection) {\n ctx.setAttribute('db.collection.name', config.collection);\n }\n if (config.attributes) {\n for (const [key, value] of Object.entries(config.attributes)) {\n if (value !== undefined && value !== null) {\n // setAttribute only accepts primitives (string | number | boolean)\n // Arrays and objects should be serialized\n const attrValue =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ? value\n : JSON.stringify(value);\n ctx.setAttribute(key, attrValue);\n }\n }\n }\n\n // Call the user's factory to get their function and return it\n return fnFactory(ctx);\n });\n };\n}\n\n/**\n * Trace HTTP client operations with HTTP semantic conventions\n *\n * Automatically adds standard attributes for HTTP requests:\n * - http.request.method\n * - url.full\n *\n * **Use Cases:**\n * - External API calls\n * - Microservice communication\n * - Third-party integrations\n *\n * @param config - HTTP operation configuration\n * @returns Traced function factory with HTTP attributes\n *\n * @example Fetch API\n * ```typescript\n * import { traceHTTP } from 'autotel/semantic-helpers'\n *\n * export const fetchUser = traceHTTP({\n * method: 'GET',\n * url: 'https://api.example.com/users/:id'\n * })(ctx => async (userId: string) => {\n * const url = `https://api.example.com/users/${userId}`\n * ctx.setAttribute('url.full', url)\n *\n * const response = await fetch(url)\n * ctx.setAttribute('http.response.status_code', response.status)\n *\n * if (!response.ok) {\n * ctx.setAttribute('error', true)\n * throw new Error(`HTTP ${response.status}: ${response.statusText}`)\n * }\n *\n * return response.json()\n * })\n * ```\n *\n * @example Axios with retry logic\n * ```typescript\n * import { traceHTTP } from 'autotel/semantic-helpers'\n * import axios from 'axios'\n *\n * export const sendWebhook = traceHTTP({\n * method: 'POST',\n * url: 'https://webhook.example.com/events'\n * })(ctx => async (payload: object) => {\n * let attempts = 0\n * const maxAttempts = 3\n *\n * while (attempts < maxAttempts) {\n * try {\n * attempts++\n * ctx.setAttribute('http.request.resend_count', attempts - 1)\n *\n * const response = await axios.post('https://webhook.example.com/events', payload)\n * ctx.setAttribute('http.response.status_code', response.status)\n * return response.data\n * } catch (error) {\n * if (attempts >= maxAttempts) throw error\n * await new Promise(resolve => setTimeout(resolve, 1000 * attempts))\n * }\n * }\n * })\n * ```\n *\n * @public\n */\nexport function traceHTTP<TArgs extends unknown[], TReturn>(\n config: HTTPConfig,\n) {\n return (\n fnFactory: (ctx: TraceContext) => (...args: TArgs) => Promise<TReturn>,\n ): ((...args: TArgs) => Promise<TReturn>) => {\n return trace<TArgs, TReturn>((ctx) => {\n // Set semantic convention attributes\n if (config.method) {\n ctx.setAttribute('http.request.method', config.method);\n }\n if (config.url) {\n ctx.setAttribute('url.full', config.url);\n }\n if (config.attributes) {\n for (const [key, value] of Object.entries(config.attributes)) {\n if (value !== undefined && value !== null) {\n // setAttribute only accepts primitives (string | number | boolean)\n // Arrays and objects should be serialized\n const attrValue =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ? value\n : JSON.stringify(value);\n ctx.setAttribute(key, attrValue);\n }\n }\n }\n\n // Call the user's factory to get their function and return it\n return fnFactory(ctx);\n });\n };\n}\n\n/**\n * Trace messaging operations with Messaging semantic conventions\n *\n * Automatically adds standard attributes for messaging:\n * - messaging.system\n * - messaging.operation\n * - messaging.destination.name\n *\n * **Use Cases:**\n * - Publishing messages to queues/topics\n * - Consuming messages from queues/topics\n * - Event-driven architectures\n *\n * @param config - Messaging operation configuration\n * @returns Traced function factory with Messaging attributes\n *\n * @example Publishing to Kafka\n * ```typescript\n * import { traceMessaging } from 'autotel/semantic-helpers'\n * import { kafka } from './kafka'\n *\n * const producer = kafka.producer()\n *\n * export const publishEvent = traceMessaging({\n * system: 'kafka',\n * operation: 'publish',\n * destination: 'user-events'\n * })(ctx => async (event: { type: string; userId: string; data: object }) => {\n * ctx.setAttribute('messaging.message.type', event.type)\n * ctx.setAttribute('messaging.kafka.partition', 0)\n *\n * await producer.send({\n * topic: 'user-events',\n * messages: [\n * {\n * key: event.userId,\n * value: JSON.stringify(event.data)\n * }\n * ]\n * })\n *\n * ctx.setAttribute('messaging.message.id', event.userId)\n * })\n * ```\n *\n * @example Consuming from RabbitMQ\n * ```typescript\n * import { traceMessaging } from 'autotel/semantic-helpers'\n * import { channel } from './rabbitmq'\n *\n * export const processOrder = traceMessaging({\n * system: 'rabbitmq',\n * operation: 'process',\n * destination: 'orders'\n * })(ctx => async (message: { orderId: string; items: object[] }) => {\n * ctx.setAttribute('messaging.message.id', message.orderId)\n * ctx.setAttribute('messaging.message.body.size', JSON.stringify(message).length)\n *\n * // Process order logic\n * const result = await processOrderInternal(message)\n *\n * ctx.setAttribute('messaging.operation.result', 'success')\n * return result\n * })\n * ```\n *\n * @example AWS SQS with batch processing\n * ```typescript\n * import { traceMessaging } from 'autotel/semantic-helpers'\n * import { SQS } from '@aws-sdk/client-sqs'\n *\n * const sqs = new SQS()\n *\n * export const sendBatch = traceMessaging({\n * system: 'aws_sqs',\n * operation: 'publish',\n * destination: 'notifications-queue'\n * })(ctx => async (messages: Array<{ id: string; body: object }>) => {\n * ctx.setAttribute('messaging.batch.message_count', messages.length)\n *\n * const result = await sqs.sendMessageBatch({\n * QueueUrl: process.env.QUEUE_URL,\n * Entries: messages.map(msg => ({\n * Id: msg.id,\n * MessageBody: JSON.stringify(msg.body)\n * }))\n * })\n *\n * ctx.setAttribute('messaging.operation.success_count', result.Successful?.length || 0)\n * ctx.setAttribute('messaging.operation.failed_count', result.Failed?.length || 0)\n *\n * return result\n * })\n * ```\n *\n * @public\n */\nexport function traceMessaging<TArgs extends unknown[], TReturn>(\n config: MessagingConfig,\n) {\n return (\n fnFactory: (ctx: TraceContext) => (...args: TArgs) => Promise<TReturn>,\n ): ((...args: TArgs) => Promise<TReturn>) => {\n return trace<TArgs, TReturn>((ctx) => {\n // Set semantic convention attributes\n ctx.setAttribute('messaging.system', config.system);\n if (config.operation) {\n ctx.setAttribute('messaging.operation', config.operation);\n }\n if (config.destination) {\n ctx.setAttribute('messaging.destination.name', config.destination);\n }\n if (config.attributes) {\n for (const [key, value] of Object.entries(config.attributes)) {\n if (value !== undefined && value !== null) {\n // setAttribute only accepts primitives (string | number | boolean)\n // Arrays and objects should be serialized\n const attrValue =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ? value\n : JSON.stringify(value);\n ctx.setAttribute(key, attrValue);\n }\n }\n }\n\n // Call the user's factory to get their function and return it\n return fnFactory(ctx);\n });\n };\n}\n"]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A,KAAU,QAAA,IACjB,OAAO,KAAA,KAAU,QAAA,IACjB,OAAO,KAAA,KAAU,SAAA,GACb,KAAA,GACA,IAAA,CAAK,UAAU,KAAK,CAAA;AAC1B,YAAA,GAAA,CAAI,YAAA,CAAa,KAAK,SAAS,CAAA;AAAA,UACjC;AAAA,QACF;AAAA,MACF;AAGA,MAAA,OAAO,UAAU,GAAG,CAAA;AAAA,IACtB,CAAC,CAAA;AAAA,EACH,CAAA;AACF","file":"chunk-DK6VFPVK.cjs","sourcesContent":["/**\n * Semantic convention helpers for OpenTelemetry\n *\n * Pre-configured trace helpers that follow OpenTelemetry semantic conventions\n * for common operation types. Reduces boilerplate and ensures consistency.\n *\n * Based on: https://opentelemetry.io/docs/specs/semconv/\n */\n\nimport { trace } from './functional';\nimport type { TraceContext } from './trace-context';\nimport type { Attributes } from '@opentelemetry/api';\n\n/**\n * Configuration for LLM (Large Language Model) operations\n *\n * Follows Gen AI semantic conventions:\n * https://opentelemetry.io/docs/specs/semconv/gen-ai/\n */\nexport interface LLMConfig {\n /** Model name (e.g., 'gpt-4', 'claude-3-opus') */\n model: string;\n /** Operation type */\n operation?: 'chat' | 'completion' | 'embedding';\n /** Model provider (e.g., 'openai', 'anthropic', 'cohere') - maps to gen.ai.system */\n provider?: string;\n /** Additional attributes to add to the span */\n attributes?: Attributes;\n}\n\n/**\n * Configuration for database operations\n *\n * Follows DB semantic conventions:\n * https://opentelemetry.io/docs/specs/semconv/database/\n */\nexport interface DBConfig {\n /** Database system (e.g., 'postgresql', 'mongodb', 'redis') */\n system: string;\n /** Operation type (e.g., 'SELECT', 'INSERT', 'find', 'get') */\n operation?: string;\n /** Database name */\n database?: string;\n /** Collection/table name */\n collection?: string;\n /** Additional attributes to add to the span */\n attributes?: Attributes;\n}\n\n/**\n * Configuration for HTTP client operations\n *\n * Follows HTTP semantic conventions:\n * https://opentelemetry.io/docs/specs/semconv/http/\n */\nexport interface HTTPConfig {\n /** HTTP method (e.g., 'GET', 'POST') */\n method?: string;\n /** Target URL or URL template */\n url?: string;\n /** Additional attributes to add to the span */\n attributes?: Attributes;\n}\n\n/**\n * Configuration for messaging operations\n *\n * Follows Messaging semantic conventions:\n * https://opentelemetry.io/docs/specs/semconv/messaging/\n */\nexport interface MessagingConfig {\n /** Messaging system (e.g., 'kafka', 'rabbitmq', 'sqs') */\n system: string;\n /** Operation type */\n operation?: 'publish' | 'receive' | 'process';\n /** Destination name (queue/topic) */\n destination?: string;\n /** Additional attributes to add to the span */\n attributes?: Attributes;\n}\n\n/**\n * Trace LLM operations with Gen AI semantic conventions\n *\n * Automatically adds standard attributes for LLM operations:\n * - gen.ai.request.model\n * - gen.ai.operation.name\n * - gen.ai.system\n *\n * **Use Cases:**\n * - Chat completions\n * - Text generation\n * - Embeddings\n * - Multi-step LLM workflows\n *\n * @param config - LLM operation configuration\n * @returns Traced function factory with Gen AI attributes\n *\n * @example Chat completion with OpenAI\n * ```typescript\n * import { traceLLM } from 'autotel/semantic-helpers'\n * import OpenAI from 'openai'\n *\n * const openai = new OpenAI()\n *\n * export const generateResponse = traceLLM({\n * model: 'gpt-4-turbo',\n * operation: 'chat',\n * provider: 'openai'\n * })(ctx => async (prompt: string) => {\n * const response = await openai.chat.completions.create({\n * model: 'gpt-4-turbo',\n * messages: [{ role: 'user', content: prompt }]\n * })\n *\n * // Add usage metrics to span\n * ctx.setAttribute('gen.ai.usage.completion_tokens', response.usage?.completion_tokens)\n * ctx.setAttribute('gen.ai.usage.prompt_tokens', response.usage?.prompt_tokens)\n *\n * return response.choices[0].message.content\n * })\n * ```\n *\n * @example Anthropic Claude with streaming\n * ```typescript\n * import { traceLLM } from 'autotel/semantic-helpers'\n * import Anthropic from '@anthropic-ai/sdk'\n *\n * const anthropic = new Anthropic()\n *\n * export const streamResponse = traceLLM({\n * model: 'claude-3-opus-20240229',\n * operation: 'chat',\n * provider: 'anthropic'\n * })(ctx => async function* (prompt: string) {\n * const stream = await anthropic.messages.create({\n * model: 'claude-3-opus-20240229',\n * messages: [{ role: 'user', content: prompt }],\n * stream: true,\n * max_tokens: 1024\n * })\n *\n * let totalTokens = 0\n * for await (const event of stream) {\n * if (event.type === 'content_block_delta') {\n * yield event.delta.text\n * }\n * if (event.type === 'message_stop') {\n * ctx.setAttribute('gen.ai.usage.completion_tokens', event.message.usage.output_tokens)\n * totalTokens = event.message.usage.output_tokens\n * }\n * }\n *\n * return totalTokens\n * })\n * ```\n *\n * @example Embeddings\n * ```typescript\n * import { traceLLM } from 'autotel/semantic-helpers'\n * import { OpenAIEmbeddings } from '@langchain/openai'\n *\n * const embeddings = new OpenAIEmbeddings()\n *\n * export const embed = traceLLM({\n * model: 'text-embedding-3-small',\n * operation: 'embedding',\n * provider: 'openai'\n * })(ctx => async (text: string) => {\n * const result = await embeddings.embedQuery(text)\n * ctx.setAttribute('gen.ai.response.embedding_length', result.length)\n * return result\n * })\n * ```\n *\n * @public\n */\nexport function traceLLM<TArgs extends unknown[], TReturn>(config: LLMConfig) {\n return (\n fnFactory: (ctx: TraceContext) => (...args: TArgs) => Promise<TReturn>,\n ): ((...args: TArgs) => Promise<TReturn>) => {\n return trace<TArgs, TReturn>((ctx) => {\n // Set semantic convention attributes\n ctx.setAttribute('gen.ai.request.model', config.model);\n ctx.setAttribute('gen.ai.operation.name', config.operation || 'chat');\n if (config.provider) {\n ctx.setAttribute('gen.ai.system', config.provider);\n }\n if (config.attributes) {\n for (const [key, value] of Object.entries(config.attributes)) {\n if (value !== undefined && value !== null) {\n // setAttribute only accepts primitives (string | number | boolean)\n // Arrays and objects should be serialized\n const attrValue =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ? value\n : JSON.stringify(value);\n ctx.setAttribute(key, attrValue);\n }\n }\n }\n\n // Call the user's factory to get their function and return it\n return fnFactory(ctx);\n });\n };\n}\n\n/**\n * Trace database operations with DB semantic conventions\n *\n * Automatically adds standard attributes for database operations:\n * - db.system\n * - db.operation\n * - db.name\n * - db.collection.name (for NoSQL)\n *\n * **Use Cases:**\n * - SQL queries (PostgreSQL, MySQL, SQLite)\n * - NoSQL operations (MongoDB, DynamoDB, Redis)\n * - ORM queries (Prisma, TypeORM, Drizzle)\n *\n * @param config - Database operation configuration\n * @returns Traced function factory with DB attributes\n *\n * @example PostgreSQL query\n * ```typescript\n * import { traceDB } from 'autotel/semantic-helpers'\n * import { pool } from './db'\n *\n * export const getUser = traceDB({\n * system: 'postgresql',\n * operation: 'SELECT',\n * database: 'app_db',\n * collection: 'users'\n * })(ctx => async (userId: string) => {\n * const query = 'SELECT * FROM users WHERE id = $1'\n * ctx.setAttribute('db.statement', query)\n *\n * const result = await pool.query(query, [userId])\n * ctx.setAttribute('db.rows_affected', result.rowCount)\n *\n * return result.rows[0]\n * })\n * ```\n *\n * @example MongoDB with Mongoose\n * ```typescript\n * import { traceDB } from 'autotel/semantic-helpers'\n * import { User } from './models/User'\n *\n * export const findUsers = traceDB({\n * system: 'mongodb',\n * operation: 'find',\n * database: 'app_db',\n * collection: 'users'\n * })(ctx => async (filter: object) => {\n * ctx.setAttribute('db.mongodb.filter', JSON.stringify(filter))\n *\n * const users = await User.find(filter).limit(100)\n * ctx.setAttribute('db.response.count', users.length)\n *\n * return users\n * })\n * ```\n *\n * @example Redis operations\n * ```typescript\n * import { traceDB } from 'autotel/semantic-helpers'\n * import { redis } from './redis'\n *\n * export const cacheGet = traceDB({\n * system: 'redis',\n * operation: 'GET'\n * })(ctx => async (key: string) => {\n * ctx.setAttribute('db.redis.key', key)\n *\n * const value = await redis.get(key)\n * ctx.setAttribute('db.response.cache_hit', value !== null)\n *\n * return value\n * })\n * ```\n *\n * @example Prisma with detailed query info\n * ```typescript\n * import { traceDB } from 'autotel/semantic-helpers'\n * import { prisma } from './prisma'\n *\n * export const createPost = traceDB({\n * system: 'postgresql',\n * operation: 'INSERT',\n * database: 'app_db',\n * collection: 'posts'\n * })(ctx => async (data: { title: string; content: string; authorId: string }) => {\n * ctx.setAttribute('db.prisma.model', 'Post')\n * ctx.setAttribute('db.prisma.action', 'create')\n *\n * const post = await prisma.post.create({ data })\n *\n * ctx.setAttribute('db.response.id', post.id)\n * return post\n * })\n * ```\n *\n * @public\n */\nexport function traceDB<TArgs extends unknown[], TReturn>(config: DBConfig) {\n return (\n fnFactory: (ctx: TraceContext) => (...args: TArgs) => Promise<TReturn>,\n ): ((...args: TArgs) => Promise<TReturn>) => {\n return trace<TArgs, TReturn>((ctx) => {\n // Set semantic convention attributes\n ctx.setAttribute('db.system', config.system);\n if (config.operation) {\n ctx.setAttribute('db.operation', config.operation);\n }\n if (config.database) {\n ctx.setAttribute('db.name', config.database);\n }\n if (config.collection) {\n ctx.setAttribute('db.collection.name', config.collection);\n }\n if (config.attributes) {\n for (const [key, value] of Object.entries(config.attributes)) {\n if (value !== undefined && value !== null) {\n // setAttribute only accepts primitives (string | number | boolean)\n // Arrays and objects should be serialized\n const attrValue =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ? value\n : JSON.stringify(value);\n ctx.setAttribute(key, attrValue);\n }\n }\n }\n\n // Call the user's factory to get their function and return it\n return fnFactory(ctx);\n });\n };\n}\n\n/**\n * Trace HTTP client operations with HTTP semantic conventions\n *\n * Automatically adds standard attributes for HTTP requests:\n * - http.request.method\n * - url.full\n *\n * **Use Cases:**\n * - External API calls\n * - Microservice communication\n * - Third-party integrations\n *\n * @param config - HTTP operation configuration\n * @returns Traced function factory with HTTP attributes\n *\n * @example Fetch API\n * ```typescript\n * import { traceHTTP } from 'autotel/semantic-helpers'\n *\n * export const fetchUser = traceHTTP({\n * method: 'GET',\n * url: 'https://api.example.com/users/:id'\n * })(ctx => async (userId: string) => {\n * const url = `https://api.example.com/users/${userId}`\n * ctx.setAttribute('url.full', url)\n *\n * const response = await fetch(url)\n * ctx.setAttribute('http.response.status_code', response.status)\n *\n * if (!response.ok) {\n * ctx.setAttribute('error', true)\n * throw new Error(`HTTP ${response.status}: ${response.statusText}`)\n * }\n *\n * return response.json()\n * })\n * ```\n *\n * @example Axios with retry logic\n * ```typescript\n * import { traceHTTP } from 'autotel/semantic-helpers'\n * import axios from 'axios'\n *\n * export const sendWebhook = traceHTTP({\n * method: 'POST',\n * url: 'https://webhook.example.com/events'\n * })(ctx => async (payload: object) => {\n * let attempts = 0\n * const maxAttempts = 3\n *\n * while (attempts < maxAttempts) {\n * try {\n * attempts++\n * ctx.setAttribute('http.request.resend_count', attempts - 1)\n *\n * const response = await axios.post('https://webhook.example.com/events', payload)\n * ctx.setAttribute('http.response.status_code', response.status)\n * return response.data\n * } catch (error) {\n * if (attempts >= maxAttempts) throw error\n * await new Promise(resolve => setTimeout(resolve, 1000 * attempts))\n * }\n * }\n * })\n * ```\n *\n * @public\n */\nexport function traceHTTP<TArgs extends unknown[], TReturn>(\n config: HTTPConfig,\n) {\n return (\n fnFactory: (ctx: TraceContext) => (...args: TArgs) => Promise<TReturn>,\n ): ((...args: TArgs) => Promise<TReturn>) => {\n return trace<TArgs, TReturn>((ctx) => {\n // Set semantic convention attributes\n if (config.method) {\n ctx.setAttribute('http.request.method', config.method);\n }\n if (config.url) {\n ctx.setAttribute('url.full', config.url);\n }\n if (config.attributes) {\n for (const [key, value] of Object.entries(config.attributes)) {\n if (value !== undefined && value !== null) {\n // setAttribute only accepts primitives (string | number | boolean)\n // Arrays and objects should be serialized\n const attrValue =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ? value\n : JSON.stringify(value);\n ctx.setAttribute(key, attrValue);\n }\n }\n }\n\n // Call the user's factory to get their function and return it\n return fnFactory(ctx);\n });\n };\n}\n\n/**\n * Trace messaging operations with Messaging semantic conventions\n *\n * Automatically adds standard attributes for messaging:\n * - messaging.system\n * - messaging.operation\n * - messaging.destination.name\n *\n * **Use Cases:**\n * - Publishing messages to queues/topics\n * - Consuming messages from queues/topics\n * - Event-driven architectures\n *\n * @param config - Messaging operation configuration\n * @returns Traced function factory with Messaging attributes\n *\n * @example Publishing to Kafka\n * ```typescript\n * import { traceMessaging } from 'autotel/semantic-helpers'\n * import { kafka } from './kafka'\n *\n * const producer = kafka.producer()\n *\n * export const publishEvent = traceMessaging({\n * system: 'kafka',\n * operation: 'publish',\n * destination: 'user-events'\n * })(ctx => async (event: { type: string; userId: string; data: object }) => {\n * ctx.setAttribute('messaging.message.type', event.type)\n * ctx.setAttribute('messaging.kafka.partition', 0)\n *\n * await producer.send({\n * topic: 'user-events',\n * messages: [\n * {\n * key: event.userId,\n * value: JSON.stringify(event.data)\n * }\n * ]\n * })\n *\n * ctx.setAttribute('messaging.message.id', event.userId)\n * })\n * ```\n *\n * @example Consuming from RabbitMQ\n * ```typescript\n * import { traceMessaging } from 'autotel/semantic-helpers'\n * import { channel } from './rabbitmq'\n *\n * export const processOrder = traceMessaging({\n * system: 'rabbitmq',\n * operation: 'process',\n * destination: 'orders'\n * })(ctx => async (message: { orderId: string; items: object[] }) => {\n * ctx.setAttribute('messaging.message.id', message.orderId)\n * ctx.setAttribute('messaging.message.body.size', JSON.stringify(message).length)\n *\n * // Process order logic\n * const result = await processOrderInternal(message)\n *\n * ctx.setAttribute('messaging.operation.result', 'success')\n * return result\n * })\n * ```\n *\n * @example AWS SQS with batch processing\n * ```typescript\n * import { traceMessaging } from 'autotel/semantic-helpers'\n * import { SQS } from '@aws-sdk/client-sqs'\n *\n * const sqs = new SQS()\n *\n * export const sendBatch = traceMessaging({\n * system: 'aws_sqs',\n * operation: 'publish',\n * destination: 'notifications-queue'\n * })(ctx => async (messages: Array<{ id: string; body: object }>) => {\n * ctx.setAttribute('messaging.batch.message_count', messages.length)\n *\n * const result = await sqs.sendMessageBatch({\n * QueueUrl: process.env.QUEUE_URL,\n * Entries: messages.map(msg => ({\n * Id: msg.id,\n * MessageBody: JSON.stringify(msg.body)\n * }))\n * })\n *\n * ctx.setAttribute('messaging.operation.success_count', result.Successful?.length || 0)\n * ctx.setAttribute('messaging.operation.failed_count', result.Failed?.length || 0)\n *\n * return result\n * })\n * ```\n *\n * @public\n */\nexport function traceMessaging<TArgs extends unknown[], TReturn>(\n config: MessagingConfig,\n) {\n return (\n fnFactory: (ctx: TraceContext) => (...args: TArgs) => Promise<TReturn>,\n ): ((...args: TArgs) => Promise<TReturn>) => {\n return trace<TArgs, TReturn>((ctx) => {\n // Set semantic convention attributes\n ctx.setAttribute('messaging.system', config.system);\n if (config.operation) {\n ctx.setAttribute('messaging.operation', config.operation);\n }\n if (config.destination) {\n ctx.setAttribute('messaging.destination.name', config.destination);\n }\n if (config.attributes) {\n for (const [key, value] of Object.entries(config.attributes)) {\n if (value !== undefined && value !== null) {\n // setAttribute only accepts primitives (string | number | boolean)\n // Arrays and objects should be serialized\n const attrValue =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ? value\n : JSON.stringify(value);\n ctx.setAttribute(key, attrValue);\n }\n }\n }\n\n // Call the user's factory to get their function and return it\n return fnFactory(ctx);\n });\n };\n}\n"]}
@@ -2,8 +2,8 @@
2
2
 
3
3
  var chunk2GIBANLB_cjs = require('./chunk-2GIBANLB.cjs');
4
4
  var chunkVQTCQKHQ_cjs = require('./chunk-VQTCQKHQ.cjs');
5
- var chunkUV64CWMA_cjs = require('./chunk-UV64CWMA.cjs');
6
- var chunkKKIYPZOP_cjs = require('./chunk-KKIYPZOP.cjs');
5
+ var chunkJAX4LFGG_cjs = require('./chunk-JAX4LFGG.cjs');
6
+ var chunkRYVFCHSO_cjs = require('./chunk-RYVFCHSO.cjs');
7
7
  var chunkVH77IPJN_cjs = require('./chunk-VH77IPJN.cjs');
8
8
  var chunkESLWRGAG_cjs = require('./chunk-ESLWRGAG.cjs');
9
9
  var api = require('@opentelemetry/api');
@@ -355,7 +355,7 @@ function shouldSkip(key, fn, skip) {
355
355
  function getCtxValue() {
356
356
  const activeSpan = api.trace.getActiveSpan();
357
357
  if (!activeSpan) return null;
358
- return chunkUV64CWMA_cjs.createTraceContext(activeSpan);
358
+ return chunkJAX4LFGG_cjs.createTraceContext(activeSpan);
359
359
  }
360
360
  var ctx = new Proxy(
361
361
  {},
@@ -420,17 +420,17 @@ function wrapWithTracing(fnFactory, options, variableName) {
420
420
  }
421
421
  const startTime = performance.now();
422
422
  const isRootSpan = options.startNewRoot || api.trace.getActiveSpan() === void 0;
423
- const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkKKIYPZOP_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
424
- const shouldAutoFlushSpans = chunkKKIYPZOP_cjs.getConfig()?.forceFlushOnShutdown ?? false;
423
+ const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkRYVFCHSO_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
424
+ const shouldAutoFlushSpans = chunkRYVFCHSO_cjs.getConfig()?.forceFlushOnShutdown ?? false;
425
425
  const flushIfNeeded = async () => {
426
426
  if (!shouldAutoFlush || !isRootSpan) return;
427
427
  try {
428
- const queue = chunkUV64CWMA_cjs.getEventQueue();
428
+ const queue = chunkJAX4LFGG_cjs.getEventQueue();
429
429
  if (queue && queue.size() > 0) {
430
430
  await queue.flush();
431
431
  }
432
432
  if (shouldAutoFlushSpans) {
433
- const sdk = chunkKKIYPZOP_cjs.getSdk();
433
+ const sdk = chunkRYVFCHSO_cjs.getSdk();
434
434
  if (sdk) {
435
435
  try {
436
436
  const sdkAny = sdk;
@@ -445,7 +445,7 @@ function wrapWithTracing(fnFactory, options, variableName) {
445
445
  }
446
446
  }
447
447
  } catch (error) {
448
- const initConfig = chunkKKIYPZOP_cjs.getConfig();
448
+ const initConfig = chunkRYVFCHSO_cjs.getConfig();
449
449
  const logger = initConfig?.logger;
450
450
  if (logger?.error) {
451
451
  logger.error(
@@ -464,7 +464,7 @@ function wrapWithTracing(fnFactory, options, variableName) {
464
464
  if (options.spanKind !== void 0) {
465
465
  spanOptions.kind = options.spanKind;
466
466
  }
467
- const parentContext = chunkUV64CWMA_cjs.getActiveContextWithBaggage();
467
+ const parentContext = chunkJAX4LFGG_cjs.getActiveContextWithBaggage();
468
468
  return tracer.startActiveSpan(
469
469
  spanName,
470
470
  spanOptions,
@@ -474,11 +474,11 @@ function wrapWithTracing(fnFactory, options, variableName) {
474
474
  let shouldKeepSpan = true;
475
475
  chunk2GIBANLB_cjs.setSpanName(span2, spanName);
476
476
  const initialContext = api.context.active();
477
- const contextStorage = chunkUV64CWMA_cjs.getContextStorage();
477
+ const contextStorage = chunkJAX4LFGG_cjs.getContextStorage();
478
478
  if (!contextStorage.getStore()) {
479
- chunkUV64CWMA_cjs.enterOrRun(contextStorage, initialContext);
479
+ chunkJAX4LFGG_cjs.enterOrRun(contextStorage, initialContext);
480
480
  }
481
- const ctxValue = chunkUV64CWMA_cjs.createTraceContext(span2);
481
+ const ctxValue = chunkJAX4LFGG_cjs.createTraceContext(span2);
482
482
  const fn = fnFactory(ctxValue);
483
483
  const argsAttributes = options.attributesFromArgs ? options.attributesFromArgs(args) : {};
484
484
  const handleTailSampling = (success, duration, error) => {
@@ -563,7 +563,7 @@ function wrapWithTracing(fnFactory, options, variableName) {
563
563
  status: "started"
564
564
  });
565
565
  const executeWithContext = async () => {
566
- const currentContext = chunkUV64CWMA_cjs.getActiveContextWithBaggage();
566
+ const currentContext = chunkJAX4LFGG_cjs.getActiveContextWithBaggage();
567
567
  return api.context.with(currentContext, async () => {
568
568
  return fn.call(this, ...args);
569
569
  });
@@ -615,14 +615,14 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
615
615
  }
616
616
  const startTime = performance.now();
617
617
  const isRootSpan = options.startNewRoot || api.trace.getActiveSpan() === void 0;
618
- const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkKKIYPZOP_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
619
- const shouldAutoFlushSpans = chunkKKIYPZOP_cjs.getConfig()?.forceFlushOnShutdown ?? false;
618
+ const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkRYVFCHSO_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
619
+ const shouldAutoFlushSpans = chunkRYVFCHSO_cjs.getConfig()?.forceFlushOnShutdown ?? false;
620
620
  const flushIfNeeded = () => {
621
621
  if (!shouldAutoFlush || !isRootSpan) return;
622
- const queue = chunkUV64CWMA_cjs.getEventQueue();
622
+ const queue = chunkJAX4LFGG_cjs.getEventQueue();
623
623
  if (queue && queue.size() > 0) {
624
624
  void queue.flush().catch((error) => {
625
- const initConfig = chunkKKIYPZOP_cjs.getConfig();
625
+ const initConfig = chunkRYVFCHSO_cjs.getConfig();
626
626
  const logger = initConfig?.logger;
627
627
  if (logger?.error) {
628
628
  logger.error(
@@ -635,7 +635,7 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
635
635
  });
636
636
  }
637
637
  if (shouldAutoFlushSpans) {
638
- const sdk = chunkKKIYPZOP_cjs.getSdk();
638
+ const sdk = chunkRYVFCHSO_cjs.getSdk();
639
639
  if (sdk) {
640
640
  try {
641
641
  const sdkAny = sdk;
@@ -643,7 +643,7 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
643
643
  const tracerProvider = sdkAny.getTracerProvider();
644
644
  if (tracerProvider && typeof tracerProvider.forceFlush === "function") {
645
645
  void tracerProvider.forceFlush().catch((error) => {
646
- const initConfig = chunkKKIYPZOP_cjs.getConfig();
646
+ const initConfig = chunkRYVFCHSO_cjs.getConfig();
647
647
  const logger = initConfig?.logger;
648
648
  if (logger?.error) {
649
649
  logger.error(
@@ -668,7 +668,7 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
668
668
  if (options.spanKind !== void 0) {
669
669
  spanOptions.kind = options.spanKind;
670
670
  }
671
- const parentContext = chunkUV64CWMA_cjs.getActiveContextWithBaggage();
671
+ const parentContext = chunkJAX4LFGG_cjs.getActiveContextWithBaggage();
672
672
  return tracer.startActiveSpan(
673
673
  spanName,
674
674
  spanOptions,
@@ -677,7 +677,7 @@ function wrapWithTracingSync(fnFactory, options, variableName) {
677
677
  return chunkVQTCQKHQ_cjs.runInOperationContext(spanName, () => {
678
678
  let shouldKeepSpan = true;
679
679
  chunk2GIBANLB_cjs.setSpanName(span2, spanName);
680
- const ctxValue = chunkUV64CWMA_cjs.createTraceContext(span2);
680
+ const ctxValue = chunkJAX4LFGG_cjs.createTraceContext(span2);
681
681
  const fn = fnFactory(ctxValue);
682
682
  const argsAttributes = options.attributesFromArgs ? options.attributesFromArgs(args) : {};
683
683
  const handleTailSampling = (success, duration, error) => {
@@ -792,8 +792,8 @@ function executeImmediately(fn, options) {
792
792
  }
793
793
  const startTime = performance.now();
794
794
  const isRootSpan = options.startNewRoot || api.trace.getActiveSpan() === void 0;
795
- const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkKKIYPZOP_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
796
- const shouldAutoFlushSpans = chunkKKIYPZOP_cjs.getConfig()?.forceFlushOnShutdown ?? false;
795
+ const shouldAutoFlush = options.flushOnRootSpanEnd ?? chunkRYVFCHSO_cjs.getConfig()?.flushOnRootSpanEnd ?? true;
796
+ const shouldAutoFlushSpans = chunkRYVFCHSO_cjs.getConfig()?.forceFlushOnShutdown ?? false;
797
797
  const callCounter = options.withMetrics ? meter.createCounter(`${spanName}.calls`, {
798
798
  description: `Call count for ${spanName}`,
799
799
  unit: "1"
@@ -805,12 +805,12 @@ function executeImmediately(fn, options) {
805
805
  const flushIfNeeded = async () => {
806
806
  if (!shouldAutoFlush || !isRootSpan) return;
807
807
  try {
808
- const queue = chunkUV64CWMA_cjs.getEventQueue();
808
+ const queue = chunkJAX4LFGG_cjs.getEventQueue();
809
809
  if (queue && queue.size() > 0) {
810
810
  await queue.flush();
811
811
  }
812
812
  if (shouldAutoFlushSpans) {
813
- const sdk = chunkKKIYPZOP_cjs.getSdk();
813
+ const sdk = chunkRYVFCHSO_cjs.getSdk();
814
814
  if (sdk) {
815
815
  try {
816
816
  const sdkAny = sdk;
@@ -825,7 +825,7 @@ function executeImmediately(fn, options) {
825
825
  }
826
826
  }
827
827
  } catch (error) {
828
- const initConfig = chunkKKIYPZOP_cjs.getConfig();
828
+ const initConfig = chunkRYVFCHSO_cjs.getConfig();
829
829
  const logger = initConfig?.logger;
830
830
  if (logger?.error) {
831
831
  logger.error(
@@ -844,7 +844,7 @@ function executeImmediately(fn, options) {
844
844
  if (options.spanKind !== void 0) {
845
845
  spanOptions.kind = options.spanKind;
846
846
  }
847
- const parentContext = chunkUV64CWMA_cjs.getActiveContextWithBaggage();
847
+ const parentContext = chunkJAX4LFGG_cjs.getActiveContextWithBaggage();
848
848
  return tracer.startActiveSpan(
849
849
  spanName,
850
850
  spanOptions,
@@ -853,7 +853,7 @@ function executeImmediately(fn, options) {
853
853
  return chunkVQTCQKHQ_cjs.runInOperationContext(spanName, () => {
854
854
  let shouldKeepSpan = true;
855
855
  chunk2GIBANLB_cjs.setSpanName(span2, spanName);
856
- const ctxValue = chunkUV64CWMA_cjs.createTraceContext(span2);
856
+ const ctxValue = chunkJAX4LFGG_cjs.createTraceContext(span2);
857
857
  const handleTailSampling = (success, duration, error) => {
858
858
  if (needsTailSampling && "shouldKeepTrace" in sampler && typeof sampler.shouldKeepTrace === "function") {
859
859
  shouldKeepSpan = sampler.shouldKeepTrace(samplingContext, {
@@ -1135,7 +1135,7 @@ function span(nameOrOptions, fn) {
1135
1135
  }
1136
1136
  });
1137
1137
  };
1138
- const parentContext = chunkUV64CWMA_cjs.getActiveContextWithBaggage();
1138
+ const parentContext = chunkJAX4LFGG_cjs.getActiveContextWithBaggage();
1139
1139
  const result = tracer.startActiveSpan(name, {}, parentContext, executeSpan);
1140
1140
  if (result instanceof Promise) {
1141
1141
  return result;
@@ -1170,7 +1170,7 @@ function withBaggage(options) {
1170
1170
  updatedBaggage = updatedBaggage.setEntry(key, { value });
1171
1171
  }
1172
1172
  const newContext = api.propagation.setBaggage(currentContext, updatedBaggage);
1173
- const ctxStorage = chunkUV64CWMA_cjs.getContextStorage();
1173
+ const ctxStorage = chunkJAX4LFGG_cjs.getContextStorage();
1174
1174
  const previousStored = ctxStorage.getStore();
1175
1175
  const baggageEnrichedStored = previousStored ? { value: api.propagation.setBaggage(previousStored.value, updatedBaggage) } : { value: newContext };
1176
1176
  const result = previousStored ? ctxStorage.run(baggageEnrichedStored, () => api.context.with(newContext, fn)) : api.context.with(newContext, fn);
@@ -1203,5 +1203,5 @@ exports.trace = trace;
1203
1203
  exports.withBaggage = withBaggage;
1204
1204
  exports.withNewContext = withNewContext;
1205
1205
  exports.withTracing = withTracing;
1206
- //# sourceMappingURL=chunk-EEQHQKPP.cjs.map
1207
- //# sourceMappingURL=chunk-EEQHQKPP.cjs.map
1206
+ //# sourceMappingURL=chunk-FMTNB27Z.cjs.map
1207
+ //# sourceMappingURL=chunk-FMTNB27Z.cjs.map