-
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
Prototype @instrument with OTEL #1693
base: main
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 |
ef84d3b
to
f592243
Compare
911ab4a
to
977c291
Compare
fdfab9e
to
c9e1f3a
Compare
c9e1f3a
to
72d5f10
Compare
dfdbe47
to
db4b011
Compare
72d5f10
to
f447264
Compare
ea93e37
to
9ab5db6
Compare
f447264
to
62f5df2
Compare
9ab5db6
to
049b404
Compare
) | ||
|
||
def _validate_attributes(final_attributes: dict[str, Any]): | ||
_validate_selector_name(final_attributes) |
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.
also should validate that span types are a string too. Unless you plan on folding it into the TODO on L35.
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.
yeah I was thinking of folding it into the TODO - basically:
- If the span type is provided, it must match one of the provided span types in the semcov package.
- Otherwise it's unknown.
_validate_attributes(attributes_to_add) | ||
|
||
for key, value in attributes_to_add.items(): | ||
span.set_attribute(key, value) |
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.
this won't prepend any namespaces but maybe it's just okay to get the user to say the full attribute name (i.e. with the scopes) themselves. If that's your idea, I'm good with that (so long as later when we validate spans with a given span type follow the semantic convention of that span type and throw an error I'm good).
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.
updated to prepend namespace
62f5df2
to
f35f2b0
Compare
27bcac5
to
e1b685c
Compare
tests/unit/test_otel_instrument.py
Outdated
with custom_app as recording: | ||
test_app.respond_to_query("throw") | ||
|
||
print(recording) |
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.
Add assertions to verify the expected behavior instead of just printing recording
. This will ensure the test checks if spans are correctly emitted and stored.
Description
Create an @Instrument decorator that emits the OTEL spans to the created
Event
tableOther details good to know for developers
N/A
Type of change
not work as expected)
Important
Adds
@instrument
decorator for OpenTelemetry tracing, enhances Snowflake support in SQLAlchemy, and includes tests for new functionality.@instrument
decorator ininstrument.py
for OpenTelemetry tracing, emitting OTEL spans.TRULENS_SELECTOR_NAME
fromsemantic.py
.STATUS_CODE_ERROR
.patch_insert
function insqlalchemy.py
to support Snowflake OBJECT in SQLAlchemy ORM.get_db_dialect()
method inSQLAlchemyDB
class insqlalchemy.py
.export()
inexporter.py
to correctly handleparent_id
for spans.event_id
to_construct_event()
inexporter.py
.test_otel_instrument.py
to test@instrument
decorator functionality.test_otel_instrument__test_deterministic_app_id.csv
for expected results.WithJSONTestCase
intest.py
to handle.csv
and.parquet
formats.This description was created by for a1c461c. It will automatically update as commits are pushed.