Skip to content

Commit

Permalink
feat: collect input and output from entities (workflows, tasks, etc.)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirga committed Jan 17, 2024
1 parent 1ed3a6a commit 276340f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/ai-semantic-conventions/src/SemanticAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export const SpanAttributes = {
TRACELOOP_WORKFLOW_NAME: "traceloop.workflow.name",
TRACELOOP_ENTITY_NAME: "traceloop.entity.name",
TRACELOOP_ASSOCIATION_PROPERTIES: "traceloop.association.properties",
TRACELOOP_ENTITY_INPUT: "traceloop.entity.input",
TRACELOOP_ENTITY_OUTPUT: "traceloop.entity.output",
};

export enum LLMRequestTypeValues {
Expand Down
7 changes: 7 additions & 0 deletions packages/traceloop-sdk/src/lib/tracing/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ function withEntity<
}
span.setAttribute(SpanAttributes.TRACELOOP_SPAN_KIND, type);
span.setAttribute(SpanAttributes.TRACELOOP_ENTITY_NAME, name);

const res = await fn.apply(thisArg, args);

span.setAttribute(
SpanAttributes.TRACELOOP_ENTITY_OUTPUT,
JSON.stringify(res),
);
span.end();

return res;
},
),
Expand Down

0 comments on commit 276340f

Please sign in to comment.