Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[bot] AWS Bedrock InvokeModel for embeddings not instrumented

Đang mở
#134 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
aws, java
Lĩnh vực
cloud, observability

Hướng nghiên cứu

Bắt đầu với BraintrustBedrockInterceptor.java và BraintrustAWSBedrock.java để theo dõi cách các thao tác Converse được chọn, sau đó đọc InstrumentationSemConv.java để xem xét việc gắn thẻ hiện có cho request và response của Bedrock. Xem lại BraintrustAWSBedrockTest.java và bổ sung coverage cho InvokeModelRequest bằng cách sử dụng các payload có cấu trúc của Titan và Cohere. Công việc được hoàn tất khi các lệnh gọi embedding tạo ra các span có metadata của model/provider, input được thu thập, loại embedding và các chỉ số token được chỉ định.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

The AWS Bedrock instrumentation in BraintrustBedrockInterceptor explicitly skips all operations other than Converse and ConverseStream. This means embedding model calls — which use the InvokeModel API, not Converse — produce no spans, no input capture, and no token metrics.

All embedding models on AWS Bedrock require InvokeModel:

  • Amazon Titan Text Embeddings v2 (amazon.titan-embed-text-v2:0)
  • Amazon Titan Text Embeddings v1 (amazon.titan-embed-text-v1)
  • Amazon Titan Multimodal Embeddings (amazon.titan-embed-image-v1)
  • Cohere Embed English v3 (cohere.embed-english-v3)
  • Cohere Embed Multilingual v3 (cohere.embed-multilingual-v3)

None of these models support the Converse API — InvokeModel is the only invocation path for Bedrock embeddings.

What is missing

BraintrustBedrockInterceptor.beforeExecution() (lines 60–71) explicitly limits instrumentation to two operations:

private static final Set<String> INSTRUMENTED_OPERATIONS = Set.of("Converse", "ConverseStream");

// Only instrument Converse and ConverseStream — other Bedrock operations
// (InvokeModel, ApplyGuardrail, etc.) are not LLM calls we know how to tag.
if (!INSTRUMENTED_OPERATIONS.contains(operationName)) {
    return;
}

When a user calls client.invokeModel(...) with an embedding model (e.g. amazon.titan-embed-text-v2:0), the interceptor returns immediately without creating a span. No span is created, no input text is captured, and no embedding output or token metrics are recorded.

The BraintrustAWSBedrock.wrap() Javadoc on the sync builder explicitly states it traces "every converse call" and the async builder traces "every converseStream call" — embedding calls via InvokeModel are not in scope at all today.

A minimal InvokeModel embedding span should capture:

  • braintrust.metadata: model ID (from the request URI path /model/{modelId}/invoke), provider
  • braintrust.input_json: the inputText (or equivalent input field) from the request body
  • braintrust.metrics: prompt_tokens from the response inputTextTokenCount (Titan) or meta.inputTokenCount (Cohere)
  • braintrust.span_attributes: {"type": "embedding"}

Braintrust docs status

  • AWS Bedrock listed as a supported cloud provider at https://www.braintrust.dev/docs/integrations/ai-providers: supported (for generative use)
  • No mention of Bedrock embeddings or InvokeModel instrumentation in any Braintrust docs page: not_found
  • For comparison, OpenAI and Google GenAI embedding instrumentation exists in this repo (though with detail gaps tracked in #66 and #65)

Upstream sources

Local files inspected

  • braintrust-sdk/instrumentation/aws_bedrock_2_30_0/src/main/java/dev/braintrust/instrumentation/awsbedrock/v2_30_0/BraintrustBedrockInterceptor.java — line 60: Set.of("Converse", "ConverseStream"); lines 63–71: beforeExecution returns without span for any other operation name including InvokeModel
  • braintrust-sdk/instrumentation/aws_bedrock_2_30_0/src/main/java/dev/braintrust/instrumentation/awsbedrock/v2_30_0/BraintrustAWSBedrock.java — Javadoc on both wrap() overloads confirms only Converse/ConverseStream are traced; no invokeModel wrapping exists
  • braintrust-sdk/instrumentation/aws_bedrock_2_30_0/src/test/java/dev/braintrust/instrumentation/awsbedrock/v2_30_0/BraintrustAWSBedrockTest.java — all tests use ConverseRequest and ConverseStreamRequest; no InvokeModelRequest test exists
  • braintrust-sdk/src/main/java/dev/braintrust/instrumentation/InstrumentationSemConv.javatagBedrockRequest() and tagBedrockResponse() only handle Converse-shaped JSON (messages, output.message, usage.inputTokens); InvokeModel request/response bodies have entirely different schemas
Ngôn ngữ chính
Java
Star
21
Fork
5
Merge trung bình
2 ngày 7 giờ
Pull request đã merge (30 ngày)
8

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của braintrustdata/braintrust-sdk-java

Tất cả issue của braintrustdata/braintrust-sdk-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.