Skip to content

support openai responses endpoint#46

Merged
Andrew Kent (realark) merged 4 commits intomainfrom
ark/oai-inst-refactor
Mar 5, 2026
Merged

support openai responses endpoint#46
Andrew Kent (realark) merged 4 commits intomainfrom
ark/oai-inst-refactor

Conversation

@realark
Copy link
Collaborator

@realark Andrew Kent (realark) commented Mar 4, 2026

  • refactor openai instrumentation impl
  • support openai responses endpoint
  • refactor anthropic instrumentation impl to pattern-match oai

@realark Andrew Kent (realark) force-pushed the ark/oai-inst-refactor branch 7 times, most recently from 23e13d1 to 00c5a9c Compare March 5, 2026 04:19
clazz = clazz.getSuperclass();
}
}
throw new NoSuchFieldException(fieldName);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the instrumentation impl between the oai and anthropic clients are very similar. I might refactor out some of the internals into common components later (think if this pattern repeats another time I'll do it then).

@realark Andrew Kent (realark) marked this pull request as ready for review March 5, 2026 04:37
@realark Andrew Kent (realark) added the enhancement New feature or request label Mar 5, 2026
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice if we moved some of the constants like braintrust.metadata into string constants that can be shared more widely, but that is just a nit.

}

private static void instrumentHttpClient(OpenTelemetry openTelemetry, AnthropicClient client) {
forAllFields(

Choose a reason for hiding this comment

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

I wonder if we can avoid having to iterate through every field, but I don't know enough about java reflection to suggest a proper improvement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this approach is the most future proof way given how the library is implemented, but I'll keep an eye on this and revisit if my assumption is wrong

@realark Andrew Kent (realark) merged commit b06777a into main Mar 5, 2026
1 check passed
@realark Andrew Kent (realark) deleted the ark/oai-inst-refactor branch March 5, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants