feat: Instrument OpenAI agents api (openai.beta.agents) - #2471
Open
Luca Forstner (lforst) wants to merge 2 commits into
Open
feat: Instrument OpenAI agents api (openai.beta.agents)#2471Luca Forstner (lforst) wants to merge 2 commits into
openai.beta.agents)#2471Luca Forstner (lforst) wants to merge 2 commits into
Conversation
| } | ||
|
|
||
| /** @internal */ | ||
| export function _internalExportParentSynchronously( |
There was a problem hiding this comment.
this seems like it has a lot more slop (reflect calls?) then exportSpanSynchronously had
Comment on lines
+20
to
+22
| function isRecord(value: unknown): value is Record<string, unknown> { | ||
| return typeof value === "object" && value !== null && !Array.isArray(value); | ||
| } |
There was a problem hiding this comment.
it returns
| value.root.length > 0 && | ||
| typeof value.rootKey === "string" && | ||
| value.rootKey.length > 0 && | ||
| typeof value.rootParent === "string" && |
There was a problem hiding this comment.
we should clean these conditionals up
| try { | ||
| decoded = JSON.parse(token.slice(TOKEN_PREFIX.length)); | ||
| } catch { | ||
| throw new TypeError("Invalid OpenAI Agents trace token"); |
There was a problem hiding this comment.
i dont think we need to be this defensive, also json parsing feels wrong
Comment on lines
+188
to
+199
| const parent = _internalExportParentSynchronously(getSpanParentObject()); | ||
| if (!parent) { | ||
| return encodeToken(null); | ||
| } | ||
| const parentComponents = SpanComponentsV4.fromStr(parent); | ||
| const rowId = newId(); | ||
| const useLegacyIds = resolveUseLegacyUuidIds(); | ||
| const spanId = useLegacyIds | ||
| ? newId() | ||
| : newId().replaceAll("-", "").slice(0, 16); | ||
| const rootSpanId = useLegacyIds ? spanId : newId().replaceAll("-", ""); | ||
| const root = new SpanComponentsV4({ |
There was a problem hiding this comment.
feel like all of this should be a helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.