Comments (10)
Yes you can definitely do that with a PR. That doesn't conflict with any of our internal work. Please stay tuned. Thanks.
from aws-xray-sdk-python.
if I have any free time I'll try working on a PR, however guidance and recommendations are welcome
from aws-xray-sdk-python.
We have some improvement plan on this matter internally but right now we cannot provide more details. I will leave this open to gather feedback from broader audience. But a PR is always welcome for a quick improvement.
Also keep in mind that it doesn't matter whether you disable tracing or not if the application is not the starting point on your microserivces, as any X-Ray integrated service (apps instrumented with X-Ray SDK, AWS Lambda etc) respects the sampling decision passed from upstream. So if you have a full call path all integrated you will just need to change your frontend sampling to rate=0
and fixed_target=0
to completely disable X-Ray tracing.
from aws-xray-sdk-python.
ah, perhaps if enabled=False
it just does that?
from aws-xray-sdk-python.
Hey there, this feature is quite important especially if you are running tests as TargetPoller and RulePoller's threads will never die if there is no agent running.
The dirty fix i made was a fixture to kill those threads after pytest finishes testing.
@pytest.yield_fixture('session', autouse=True)
def fix_xray_threads():
# TODO: This should be removed after https://github.com/aws/aws-xray-sdk-python/issues/26 is solved
yield
import ctypes
import threading
main_thread = threading.main_thread()
for thread in threading.enumerate():
if thread.daemon or thread == main_thread:
continue
ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(thread.ident), ctypes.py_object(SystemExit))
from aws-xray-sdk-python.
Thank you for your feedback. We will prioritize this work.
To better understand your use case, are you talking about testing your own application where it triggers the sampling code path of the SDK? For unit test you can turn off the sampling on SDK so it doesn't make outbound calls while still go through all the code path on segments generation so you can make sure the instrumentation is working. Having said that, an extra option to completely shut off the code path on SDK is definitely valuable.
from aws-xray-sdk-python.
i forget why we didn't merge my "enabled" param support.
from aws-xray-sdk-python.
Hi @haotianw465 our app initializes xray in our root module __init__.py
which would be the first thing imported by the tests and it already starts the two threads. I saw the option to disable the sampling but that would still spin up the threads, no?
from aws-xray-sdk-python.
Never mind @haotianw465 checking the code again I saw that the threads are initialized when the first segment is sent. If I call configure before the first segment is sent they will never start.
Thank you!
from aws-xray-sdk-python.
PR merged into main branch
from aws-xray-sdk-python.
Related Issues (20)
- Bug: nested subsegments don't work across threads HOT 4
- IndexError when using AWS X-Ray SDK with SQLAlchemy HOT 1
- EKSPlugin HOT 1
- Very rare ReferenceError HOT 2
- Support for psycopg3 HOT 2
- Link a Textract async operation with downstream process HOT 1
- Current tox versions do not like how testenv.passenv is set
- aws_xray_sdk.core.exceptions.exceptions.SegmentNameMissingException: Segment name is required. HOT 1
- Using psycopg2 connection_factory throws exceptions HOT 4
- Documentation for patch_all HOT 2
- Sampling configuration should discuss DefaultSampler vs. LocalSampler HOT 1
- Flask middleware errors when an earlier Flask extension throws an exception in a before_request method HOT 1
- Patched DB cursor and template may record outside of XRayMiddleware HOT 2
- Segment not propgated when subsegment metadata is sufficiently long HOT 4
- sqlalchemy_core patch errors for unencoded special characters in db url HOT 1
- Error when using AsyncContext in python 3.11.5 HOT 3
- MongoDB AttributeError: 'NoneType' object has no attribute 'put_annotation'
- aws-xray-sdk-python compatibility with Python 3.12 HOT 9
- Fix docstring in Entity.close() HOT 1
- No supported for fastAPI, need to add middleware for fastapi HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-xray-sdk-python.