-
Notifications
You must be signed in to change notification settings - Fork 677
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
fix(instrumentation): replace api base url hardcoded value from watsonx #2173
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
from opentelemetry.trace.status import Status, StatusCode | ||
from opentelemetry.metrics import get_meter | ||
from opentelemetry.metrics import Counter, Histogram | ||
from sample-app.sample_app.watsonx-langchain import watsonx_llm_init | ||
|
||
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor | ||
from opentelemetry.instrumentation.utils import ( | ||
|
@@ -101,10 +102,15 @@ def _set_span_attribute(span, name, value): | |
|
||
|
||
def _set_api_attributes(span): | ||
watsonx_llm = watsonx_llm_init() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do you need this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How can i extract There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the comment here I shared an example of how we've done it elsewhere - #2165 (review) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should i check the attribute 'url' of the instance and then set that to api_base_url variable. if hasattr(instance, "url"):
api_base_url = instance.url There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you checked that the instance can actually have this attribute? I'd run one of the sample apps and see |
||
if hasattr(watsonx_llm, "url"): | ||
api_base_url = watsonx_llm.url | ||
else: | ||
api_base_url = "https://us-south.ml.cloud.ibm.com" | ||
_set_span_attribute( | ||
span, | ||
WatsonxSpanAttributes.WATSONX_API_BASE, | ||
"https://us-south.ml.cloud.ibm.com", | ||
api_base_url, | ||
) | ||
_set_span_attribute(span, WatsonxSpanAttributes.WATSONX_API_TYPE, "watsonx.ai") | ||
_set_span_attribute(span, WatsonxSpanAttributes.WATSONX_API_VERSION, "1.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.
remove?