django opentracing SDK based on logger which focus on ease to use
Project description
0. TODO
django-opentracing-logger is a django opentracing SDK based on logger which focus on ease to use. This project mainly works now, but we need to do a little work to let it works with official opentracing since it was built for a dialect of opentracing schema(90% of the schema were the same).
1. install
# current 0.0.1
pip install django-opentracing-logger
2. config opentracing logger
# settings.py
from django_opentracing_logger.opentracing.tracer import set_log_tracer
# add request middleware
MIDDLEWARE = [
'django_opentracing_logger.opentracing.middleware.DDTracerMiddleware',
]
# add logger
LOGGING = {
'filters': {
'trace_id': {
'()': 'django_opentracing_logger.opentracing.logging.TraceIDFilter',
}
},
'formatters': {
# ...,
'trace': {
'()': 'pythonjsonlogger.jsonlogger.JsonFormatter',
'fmt': '%(message)s',
}
},
'handlers': {
# ...,
'trace': {
'level': 'INFO',
'class': 'django_opentracing_logger.opentracing.logging.TraceHandler',
'filename': '%s/trace.log' % '/data/logs/trace',
'backupCount': 10,
'when': 'D',
'interval': 1,
'formatter': 'trace'
}
},
'loggers': {
'tracer': {'handlers': ['trace'], 'propagate': True, 'level': 'DEBUG'},
}
}
# init tracer
APM_ENABLE = True
if APM_ENABLE:
set_log_tracer("PROJECT_NAME") # TODO replace PROJECT_NAME with your real project name
3. collect
collect logs in /data/logs/trace
4. view
use any viewer which Compatible with opentracing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-opentracing-logger-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 774dc7a90131146e2ad689224cb996acab0e84c05bbff3ac21c53d4c01af01ec |
|
MD5 | 5e7ec4ac435b9a04c72d3e886bc5a26a |
|
BLAKE2b-256 | cb2a5698aa1a72b84ec77c1321ee8c748eba2e69e39e036e28c3a1b8125fcf54 |
Close
Hashes for django_opentracing_logger-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7652a7e407961e13d8b8318ece7c360a829e7970dff359ab7ca96b3ffeb50874 |
|
MD5 | f1803bf393eca6c28a745fc527036e35 |
|
BLAKE2b-256 | 13f98f0d36230024f66012de97e2603ff369f4d5e0a428306cf97ed5b474f58a |