@telemetry-dev/sdk 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/span.ts CHANGED
@@ -41,6 +41,7 @@ import {
41
41
  import { prepareCaptureValue } from "./capture.ts";
42
42
  import { type ClientCore, currentClient } from "./client.ts";
43
43
  import { NOOP_SPAN_HANDLE } from "./noop.ts";
44
+ import { promptAttributes } from "./prompts.ts";
44
45
 
45
46
  export type ParentRef = string /* W3C traceparent */ | SpanHandle | SpanContext | Context;
46
47
 
@@ -229,6 +230,7 @@ export function createSpanHandle(
229
230
 
230
231
  const parentCtx = withSessionParent(sessionContext, sessionId, core.config.apiKey);
231
232
  const attrs = fieldsToAttributes(options, meta.type, meta.capture);
233
+ const operation = attrs["gen_ai.operation.name"] ?? SPAN_TYPE_OPERATIONS[meta.type];
232
234
 
233
235
  const span = core.tracer.startSpan(
234
236
  name,
@@ -239,6 +241,7 @@ export function createSpanHandle(
239
241
  attributes: {
240
242
  "gen_ai.operation.name": SPAN_TYPE_OPERATIONS[meta.type],
241
243
  ...propagatedFromContext(parentCtx),
244
+ ...promptAttributes(parentCtx, operation, meta.capture),
242
245
  ...attrs,
243
246
  },
244
247
  },