Skip to content

Commit 7f2df2c

Browse files
QardStephen Belanger
authored andcommitted
Address PR review feedback
1 parent 09ca678 commit 7f2df2c

3 files changed

Lines changed: 41 additions & 29 deletions

File tree

e2e/config/pr-comment-scenarios.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
{ "variantKey": "openai-v6", "label": "v6" }
1010
]
1111
},
12+
{
13+
"scenarioDirName": "openai-agents-instrumentation",
14+
"label": "OpenAI Agents Instrumentation",
15+
"metadataScenario": "openai-agents-instrumentation",
16+
"variants": [
17+
{ "variantKey": "openai-agents-auto-hook", "label": "Auto-hook" }
18+
]
19+
},
1220
{
1321
"scenarioDirName": "anthropic-instrumentation",
1422
"label": "Anthropic Instrumentation",

e2e/scenarios/openai-agents-instrumentation/scenario.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { defineOpenAIAgentsAutoInstrumentationAssertions } from "./assertions";
99
const scenarioDir = await prepareScenarioDir({
1010
scenarioDir: resolveScenarioDir(import.meta.url),
1111
});
12+
const OPENAI_AGENTS_VARIANT_KEY = "openai-agents-auto-hook";
1213
const openAIAgentsVersion = await readInstalledPackageVersion(
1314
scenarioDir,
1415
"@openai/agents",
@@ -25,6 +26,7 @@ describe(`openai agents sdk ${openAIAgentsVersion}`, () => {
2526
NODE_ENV: "development",
2627
},
2728
nodeArgs: ["--import", "braintrust/hook.mjs"],
29+
runContext: { variantKey: OPENAI_AGENTS_VARIANT_KEY },
2830
scenarioDir,
2931
timeoutMs: TIMEOUT_MS,
3032
});

js/src/auto-instrumentations/configs/openai-agents.test.ts

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,37 @@ describe("openAIAgentsCoreConfigs", () => {
1010
["onSpanStart", openAIAgentsCoreChannels.onSpanStart.channelName],
1111
["onSpanEnd", openAIAgentsCoreChannels.onSpanEnd.channelName],
1212
] as const;
13+
const expectedConfigs = [
14+
"dist/tracing/processor.mjs",
15+
"dist/tracing/processor.js",
16+
]
17+
.flatMap((filePath) =>
18+
lifecycleMethods.map(([methodName, channelName]) => ({
19+
channelName,
20+
module: {
21+
name: "@openai/agents-core",
22+
versionRange: ">=0.0.14",
23+
filePath,
24+
},
25+
functionQuery: {
26+
className: "MultiTracingProcessor",
27+
methodName,
28+
kind: "Async",
29+
},
30+
})),
31+
)
32+
.sort((left, right) =>
33+
`${left.module.filePath}:${left.functionQuery.methodName}`.localeCompare(
34+
`${right.module.filePath}:${right.functionQuery.methodName}`,
35+
),
36+
);
1337

14-
for (const [methodName, channelName] of lifecycleMethods) {
15-
expect(openAIAgentsCoreConfigs).toContainEqual({
16-
channelName,
17-
module: {
18-
name: "@openai/agents-core",
19-
versionRange: ">=0.0.14",
20-
filePath: "dist/tracing/processor.mjs",
21-
},
22-
functionQuery: {
23-
className: "MultiTracingProcessor",
24-
methodName,
25-
kind: "Async",
26-
},
27-
});
28-
29-
expect(openAIAgentsCoreConfigs).toContainEqual({
30-
channelName,
31-
module: {
32-
name: "@openai/agents-core",
33-
versionRange: ">=0.0.14",
34-
filePath: "dist/tracing/processor.js",
35-
},
36-
functionQuery: {
37-
className: "MultiTracingProcessor",
38-
methodName,
39-
kind: "Async",
40-
},
41-
});
42-
}
38+
expect(
39+
[...openAIAgentsCoreConfigs].sort((left, right) =>
40+
`${left.module.filePath}:${left.functionQuery.methodName}`.localeCompare(
41+
`${right.module.filePath}:${right.functionQuery.methodName}`,
42+
),
43+
),
44+
).toEqual(expectedConfigs);
4345
});
4446
});

0 commit comments

Comments
 (0)