Skip to content

Conversation

@mikeldking
Copy link
Collaborator

@mikeldking mikeldking commented Oct 23, 2025

resolves #2228

Added tracing capabilities with decorators and function

  • Function Wrapping: withSpan(), traceAgent(), traceTool() ....
  • Decorators: @observe() for class methods

Examples

Function Wrapping:

const tracedLLM = withAgentSpan(callOpenAI, {
  attributes: { 'llm.model': 'gpt-4' }
});

Decorators:

class Agent {
  @observe({ kind: "AGENT" })
  async makeDecision(context) { /* ... */ }
}

Custom Processing:

const traced = traceChain(fn, {
  attributes: { 'service.name': 'my-service' },
  processInput: (...args) => ({ 'input.count': args.length })
});
  • mime type inference
  • async function support
  • error propagation
  • chain
  • agent
  • tool

@mikeldking mikeldking requested a review from a team as a code owner October 23, 2025 21:03
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 23, 2025
@mikeldking mikeldking marked this pull request as draft October 23, 2025 21:03
cursor[bot]

This comment was marked as outdated.

@mikeldking mikeldking force-pushed the feat/2228-js-decorators branch 2 times, most recently from 43591e8 to 5b5e856 Compare October 24, 2025 19:51
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 24, 2025

Open in StackBlitz

@arizeai/openinference-core

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-core@2344

@arizeai/openinference-genai

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-genai@2344

@arizeai/openinference-instrumentation-anthropic

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-anthropic@2344

@arizeai/openinference-instrumentation-bedrock

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-bedrock@2344

@arizeai/openinference-instrumentation-bedrock-agent-runtime

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-bedrock-agent-runtime@2344

@arizeai/openinference-instrumentation-beeai

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-beeai@2344

@arizeai/openinference-instrumentation-langchain

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-langchain@2344

@arizeai/openinference-instrumentation-mcp

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-mcp@2344

@arizeai/openinference-instrumentation-openai

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-instrumentation-openai@2344

@arizeai/openinference-mastra

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-mastra@2344

@arizeai/openinference-semantic-conventions

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-semantic-conventions@2344

@arizeai/openinference-vercel

npm i https://pkg.pr.new/Arize-ai/openinference/@arizeai/openinference-vercel@2344

commit: 7afa9bb

@mikeldking mikeldking force-pushed the feat/2228-js-decorators branch from 6b49a48 to 7cf2cd2 Compare October 27, 2025 17:13
@mikeldking mikeldking marked this pull request as ready for review October 27, 2025 20:07
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 27, 2025
cursor[bot]

This comment was marked as outdated.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Oct 27, 2025
constructor(name: string) {
this.name = name;
}
@observe()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to avoid collision with otel's trace api

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@mikeldking mikeldking force-pushed the feat/2228-js-decorators branch 2 times, most recently from 17bafa5 to 78f3bbf Compare October 28, 2025 16:39
cursor[bot]

This comment was marked as outdated.

@mikeldking mikeldking force-pushed the feat/2228-js-decorators branch 2 times, most recently from f15297b to 11192af Compare October 30, 2025 22:02
codify input and output parsing

minimum working example

minimum working example

add is promise utility

add promise type guard

refactor to helpers

cleanup

change signature

make function wrapping work

refactor

support promises

make decorators re-use withSpan

add more helpers

lock file

cleanup type guards

add tests

cleanup

make it match python

cleanup utils

cleanup

cleanup

cleanup

update more

add tests

fix importg

cleanup

cleanup

cleanup

make types flexible

add type inference

rename wrappers

update example

cleanup

update test

add test
@mikeldking mikeldking force-pushed the feat/2228-js-decorators branch from 11192af to 7afa9bb Compare October 30, 2025 22:26
Copy link
Contributor

@cephalization cephalization left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome

@mikeldking mikeldking merged commit aa22aff into main Nov 4, 2025
8 checks passed
@mikeldking mikeldking deleted the feat/2228-js-decorators branch November 4, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[js] decorator support for openinference-core

3 participants