Skip to content

wesdu/django-istio-opentracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django-istio-opentracing

Django opentracing middleware works with k8s and istio

install:

pip install django-istio-opentracing

example:

Add a middleware to your Django middleware.

MIDDLEWARE += [
    'django_istio_opentracing.middleware.Middleware'
]

And if you using requests, jusing using the patch in maybe your __init__.py file. Hint: make sure the patch line before your code.

from django_istio_opentracing import monkey
monkey.patch_requests()

Then use requests whatever you want, every request you make will carry the b3 code in header without extra coding.

Also you can use it directly in view:

from django_istio_opentracing import get_opentracing_span_headers
def index(request):
    print(get_opentracing_span_headers())
    return HttpResponse('ok')

Database tracing

You can add the ability of database tracing by installing patch of mysql and Redis without make any changes

from django_istio_opentracing.client_hooks import mysql_client, redis_client
mysql_client.install_patch()
redis_client.install_patch()

About

Using opentracing for Django with istio in k8s.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages