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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-opentracing-logger-0.0.2.tar.gz.
File metadata
- Download URL: django-opentracing-logger-0.0.2.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.31.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f72e1ef7beed49c2fd45f14652de07b3a0e37a4113f80f9656a137d06ffd5bd
|
|
| MD5 |
e4984b003e2308f12b4f1cf7881654e2
|
|
| BLAKE2b-256 |
56899cf8d1e92469d9d2318b7f23ce631f913417a07b85a9bc7617f180aae429
|
File details
Details for the file django_opentracing_logger-0.0.2-py3-none-any.whl.
File metadata
- Download URL: django_opentracing_logger-0.0.2-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.31.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e049258db1105d0cb6847ac2be4c96c3a33246107da5ba533f3cb877378a8c8f
|
|
| MD5 |
d08e1337cd2790224cf4c0c000275c05
|
|
| BLAKE2b-256 |
d4a8294415353ad72081148c2845544e1f13246607edfe34dd9a3c8ac4999080
|