zalando-zmon / opentracing-utils Goto Github PK
View Code? Open in Web Editor NEWConvenient utilities for adding OpenTracing support in your python projects
License: MIT License
Convenient utilities for adding OpenTracing support in your python projects
License: MIT License
Add examples for how opentracing-utils
can be used, for instance with multiple libraries.
The libraries of the specific vendors (lightstep, instant, jaeger) are not part of dependencies.txt
of opentracing-utils
and have to be added to the dependencies of the application which is using opentracing-utils
(otherwise it will fail, e.g. here https://app.eu.scalyr.com/y/7pqX2nx43k2). It would be nice to mention it in the README in the Usage part.
Hello,
First of all, thank you for maintaining this project. We are using it and it is very helpful.
Second, I would like to know if it is possible, and is it a good practice, to log the parameters of a SQL query along the query itself (in the trace_sqlalchemy()
function in _sqlalchemy.py . It might be very useful for debugging purposes.
The main downside I could think of is the possibility of logging private information of user's input.
I would like to know what do you think about it.
Thanks,
Avi
opentracing==2.0
introduced scope manager API. The tracer is responsible for scope_manager
implementation.
The order for detecting parent spans needs to be updated. I suggest one of the following two orders:
opentracing.tracer.active_span
managed by the tracer context manager. The new span will be using thespan_extractor
.span_extractor
.opentracing.tracer.active_span
managed by the tracer context manager. The new span will be using theas span_extractor
and passing spans in kwargs
is more explicit.
Can be added to OpenTracingHttpMiddleware
and using Database instrumentation support in Django>=2.0
Lots of bits are missing
Example:
Tests that combines Flaks, requests and SqlAlchemy tracing.
Python2 EOL is coming soon, and we should support Python3-only and move on!
Does this library support spans across multiple libraries?
Like using flask and sqlalchemy within the same trace?
def test_nested_libs(self):
engine = create_engine('sqlite://')
User.metadata.create_all(engine)
session = sessionmaker(bind=engine)()
app = Flask('test_app')
@app.route('/')
def root():
user = User(name='Tracer', is_active=True)
session.add(user)
session.commit()
return user
trace_flask(app)
trace_sqlalchemy()
with app.app_context():
print app.test_client().get('/').data
With 1 flask trace with a child sql span
In certain cases an opentracing-utils user might need to skip @trace
spans based on custom logic.
Suggested usage example:
def skip_span_logic(*args, **kwargs):
if 'something' in kwargs:
# @trace should not add a new span
return True
# @trace should add a new span
return False
@trace(skip_span=skip_span_logic)
def trace_me(*args, **kwargs):
# do stuff
This could be helpful in the case of trace_requests(ignore_url_patterns=[...])
, since the skip_span
func could inform @trace
whether to add a span or not.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.