Skip to content
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

Make translate_span a little faster #132

Merged
merged 2 commits into from
Jun 2, 2023
Merged

Conversation

torarvid
Copy link
Member

@torarvid torarvid commented Jun 2, 2023

Using py-spy, it looks like the previous version spent some time doing

list(default_resource.attributes.keys()) every time it was called.

It seems this can be done once in the OTELWriter constructor instead. Also, I think we can make it a set instead of a list (I believe a in my_set is a bit quicker than a in my_list).

Does this commit include tests to verify the speed increase? Nah... 🤷

Using py-spy, it looks like the previous version spent some time doing

list(default_resource.attributes.keys()) every time it was called.

It seems this can be done once in the OTELWriter constructor instead.
Also, I think we can make it a set instead of a list (I believe `a in
my_set` is a bit quicker than `a in my_list`).

Does this commit include tests to verify the speed increase? Nah... 🤷
Copy link
Member

@eirsyl eirsyl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

@eirsyl eirsyl merged commit 206f25d into troncos/v4 Jun 2, 2023
@eirsyl eirsyl deleted the torarvid/faster-troncos branch June 2, 2023 10:13
eirsyl added a commit that referenced this pull request Jun 13, 2023
* Initial v4 version

* Django logging middleware (#124)

* Initial django logging middleware

* Add django middleware docs

* Bump version

* Celery task log (#125)

* Initial celery signals

* Add celery task logging

* Add docs (#126)

* Bump version

* Add GRPC span exporter (#127)

* Bump version

* Use BoundedAttributes when adding attributes to events

* Bump version

* Change span class

* Bump version

* Use ReadonlySpan, Span uses locks

* Bump version

* Dont use Resource.create, it tries to detect app info we dont need

* Bump version

* Add structlog logfmt renderer

* Add print_loggers helper tool

* Add decorators

* Remove required logger prefix in middleware

* Explicitly log trace_id in ASGI middleware

* Dont log empty events

* Make django profiling view sync

* Bump version

* Make translate_span a little faster (#132)

* Make translate_span a little faster

Using py-spy, it looks like the previous version spent some time doing

list(default_resource.attributes.keys()) every time it was called.

It seems this can be done once in the OTELWriter constructor instead.
Also, I think we can make it a set instead of a list (I believe `a in
my_set` is a bit quicker than `a in my_list`).

Does this commit include tests to verify the speed increase? Nah... 🤷

* isort

* Bump version

* Add some tiny performance improvements

* Drop sampled spans (#135)

* Dont write sampled spans to the otel endpoint

* Add span.sampled check

* Bump version

* Add py-spy profiler support (#137)

* Bump version

* Add basic and token auth support to py-spy profiler (#138)

* Bump version

* Add instance tag to the py-spy profiler

* Use tracer tags, this lets us reuse tags added by tracer.set_tags

---------

Co-authored-by: Guðmundur Björn Birkisson <[email protected]>
Co-authored-by: Tor Arvid Lund <[email protected]>
Co-authored-by: Tor Arvid Lund <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants