-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(SageMaker): Add SageMaker instrumentation #2028
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much @bobbywlindsey! Looking good :)
Left a couple of small comments
@@ -0,0 +1,33 @@ | |||
# OpenTelemetry Bedrock Instrumentation | |||
|
|||
<a href="https://pypi.org/project/opentelemetry-instrumentation-bedrock/"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
<a href="https://pypi.org/project/opentelemetry-instrumentation-bedrock/"> | |
<a href="https://pypi.org/project/opentelemetry-instrumentation-sagemaker/"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah totally missed this file, thanks for the catch. Will update.
from opentelemetry.instrumentation.sagemaker.streaming_wrapper import StreamingWrapper | ||
from opentelemetry.instrumentation.sagemaker.utils import dont_throw | ||
from wrapt import wrap_function_wrapper | ||
import anthropic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nope, I'll remove it 👍🏻
|
||
_set_span_attribute(span, SpanAttributes.LLM_REQUEST_MODEL, endpoint_name) | ||
_set_span_attribute( | ||
span, SpanAttributes.LLM_SAGEMAKER_REQUEST, json.dumps(request_body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I might use our "input" and "output" attributes instead:
openllmetry/packages/opentelemetry-semantic-conventions-ai/opentelemetry/semconv_ai/__init__.py
Line 103 in 6944daf
TRACELOOP_ENTITY_INPUT = "traceloop.entity.input" |
(these will anyway be refactored to be logs in the near future as per decisions we're making at the otel semantic conventions WG)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM, will make the updates.
opentelemetry-instrumentation = "^0.48b0" | ||
opentelemetry-semantic-conventions = "^0.48b0" | ||
opentelemetry-semantic-conventions-ai = "0.4.1" | ||
anthropic = ">=0.17.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't be a dependency of the package
@bobbywlindsey looks like you need to run |
@bobbywlindsey seems like tests are failing - I think you'll need to amend the cassettes or the mock API URL you're using |
@nirga Thanks for the help :) I think I've resolved the build issues now. Let me know if there's anything else I can do to improve the PR. Once this one is merged, I'll begin working on Bedrock Knowledge Bases and Agents issues 👍🏻 |
feat(instrumentation): ...
orfix(instrumentation): ...
.Summary of changes (closes #1660):
llm.sagemaker.request
which captures the request body of the endpoint invocationllm.sagemaker.response
which captures the response body of the endpoint invocation