-
Notifications
You must be signed in to change notification settings - Fork 197
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
Change recording to create a span of type "record_root" #1703
base: garett/SNOW-1854278
Are you sure you want to change the base?
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
9ab5db6
to
049b404
Compare
712f97b
to
c9db9a1
Compare
@@ -67,6 +87,7 @@ | |||
"dotenv.load_dotenv()\n", | |||
"\n", | |||
"session = TruSession()\n", | |||
"session.experimental_enable_feature(\"otel_tracing\")\n", |
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.
note that this will enable some other stuff Piotr put in.
@@ -34,6 +34,12 @@ class SpanAttributes: | |||
In some cases below, we also include span name or span name prefix. | |||
""" | |||
|
|||
SPAN_TYPE = "trulens.span_type" |
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.
probably can remove L43 unless there's an argument to be made for multiple span types.
tracer = trace.get_tracer_provider().get_tracer(TRULENS_SERVICE_NAME) | ||
|
||
# Calling set_baggage does not actually add the baggage to the current context, but returns a new one | ||
# To avoid issues with remembering to add/remove the baggage, we attach it to the runtime context. |
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.
s/To/to
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 also don't really get this token business, can you enlighten me?
root_span.set_attribute(SpanAttributes.RECORD_ROOT.APP_ID, self.app_id) | ||
root_span.set_attribute( | ||
SpanAttributes.RECORD_ROOT.RECORD_ID, otel_record_id | ||
) |
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.
the semantic convention that Piotr laid out also has the MAIN_INPUT
/MAIN_OUTPUT
/MAIN_ERROR
, but I don't see how we can get that even during __exit__
, so I'm inclined to say we can remove them. Though that raises the question of, how will the UI know what the input and output are to display. It's too close to the finish line of 2024 that I don't want to investigate how this is determined currently but can next year haha.
There's also TOTAL_COST
but I'm not as worried about that.
@@ -51,6 +58,10 @@ def wrapper(*args, **kwargs): | |||
span.set_attribute( | |||
"parent_span_id", parent_span.get_span_context().span_id | |||
) | |||
span.set_attribute( |
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.
we want app/run id in the baggage as well I guess, but given that it's not totally clear yet no point in doing it now I suppose.
27bcac5
to
e1b685c
Compare
6e3c22f
to
6b063f5
Compare
Description
Updated the app context manager to be able to create a span of type "record_root"
Other details good to know for developers
For reference, this is the current set of spans as produced in the notebook:
Type of change
not work as expected)
Important
Add
record_root
span type to app context manager for enhanced tracing with OpenTelemetry.record_root
to app context manager inapp.py
.App
class ininstrument.py
to managerecord_root
spans with OpenTelemetry.SPAN_TYPE
andRECORD_ID
attributes intrace.py
for span identification.trulens.experimental.otel_tracing.core.app
totrulens.experimental.otel_tracing.core.instrument
inapp.py
.This description was created by for 6b063f5. It will automatically update as commits are pushed.