Skip to content

Commit 4393b60

Browse files
committed
feat(instrumentation-bedrock): align GenAI semconv with OTel 1.40 and migrate Bedrock instrumentation
1 parent 0b94cce commit 4393b60

File tree

15 files changed

+2342
-163
lines changed

15 files changed

+2342
-163
lines changed

packages/instrumentation-anthropic/test/content-block-mapper.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ describe("formatOutputMessage", () => {
516516
assert.strictEqual(result[0].finish_reason, "some_unknown_reason");
517517
});
518518

519-
it("omits finish_reason when stopReason is null", () => {
519+
it("sets finish_reason to empty string when stopReason is null", () => {
520520
const result = JSON.parse(
521521
formatOutputMessage(
522522
fixtures.outputMessages.text_only,
@@ -526,7 +526,7 @@ describe("formatOutputMessage", () => {
526526
mapAnthropicContentBlock,
527527
),
528528
);
529-
assert.strictEqual(result[0].finish_reason, undefined);
529+
assert.strictEqual(result[0].finish_reason, "");
530530
});
531531

532532
it("formats tool_use output as ToolCallRequestPart", () => {

packages/instrumentation-bedrock/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"build": "rollup -c",
1111
"lint": "eslint .",
1212
"lint:fix": "eslint . --fix",
13-
"test": "ts-mocha -p tsconfig.test.json 'tests/**/*.test.ts' --timeout 20000"
13+
"test": "ts-mocha -p tsconfig.test.json 'tests/**/*.test.ts' --timeout 20000",
14+
"test:unit": "ts-mocha -p tsconfig.test.json 'tests/semconv.test.ts' 'tests/finish_reasons.test.ts' 'tests/content_parts.test.ts' --timeout 20000"
1415
},
1516
"keywords": [
1617
"opentelemetry",
@@ -41,8 +42,9 @@
4142
"@opentelemetry/api": "^1.9.0",
4243
"@opentelemetry/core": "^2.0.1",
4344
"@opentelemetry/instrumentation": "^0.203.0",
44-
"@opentelemetry/semantic-conventions": "^1.38.0",
45+
"@opentelemetry/semantic-conventions": "^1.40.0",
4546
"@traceloop/ai-semantic-conventions": "workspace:*",
47+
"@traceloop/instrumentation-utils": "workspace:*",
4648
"tslib": "^2.8.1"
4749
},
4850
"devDependencies": {
@@ -56,6 +58,6 @@
5658
"@types/mocha": "^10.0.10",
5759
"ts-mocha": "^11.1.0"
5860
},
59-
"homepage": "https://github.com/traceloop/openllmetry-js/tree/main/packages/instrumentation-openai",
61+
"homepage": "https://github.com/traceloop/openllmetry-js/tree/main/packages/instrumentation-bedrock",
6062
"gitHead": "ef1e70d6037f7b5c061056ef2be16e3f55f02ed5"
6163
}

0 commit comments

Comments
 (0)