Skip to content

Commit 71ea5ba

Browse files
committed
Add runtime only hook & instrumentation
1 parent cafb615 commit 71ea5ba

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

instana/runtime.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import opentracing as ot
2+
from instana import tracer, options
3+
import logging
4+
import os
5+
6+
7+
def hook(module):
8+
""" Hook method to install the Instana middleware into Flask """
9+
if "INSTANA_DEV" in os.environ:
10+
level = logging.DEBUG
11+
else:
12+
level = logging.WARN
13+
opts = options.Options(log_level=level)
14+
ot.global_tracer = tracer.InstanaTracer(opts)

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
'basictracer>=2.2.0',
1919
'psutil>=5.1.3'],
2020
entry_points={'django': ['django.core.handlers.base = instana.django:hook'],
21-
'flask': ['flask.cli = instana.flaskana:hook']},
21+
'flask': ['flask.cli = instana.flaskana:hook'],
22+
'runtime': ['string = instana.runtime:hook']},
2223
test_suite='nose.collector',
2324
keywords=['performance', 'opentracing', 'metrics', 'monitoring'],
2425
classifiers=[

0 commit comments

Comments
 (0)