|
| 1 | +from __future__ import absolute_import |
| 2 | +import opentracing |
| 3 | +from .sensor import Sensor |
| 4 | +from .tracer import InstanaTracer |
| 5 | +from .options import Options |
| 6 | + |
1 | 7 | """
|
2 |
| -Instana sensor and tracer. It consists of two modules that can be used as entry points: |
| 8 | +The Instana package has two core components: the sensor and the tracer. |
| 9 | +
|
| 10 | +The sensor is individual to each python process and handles process metric |
| 11 | +collection and reporting. |
3 | 12 |
|
4 |
| -- sensor: activates the meter to collect and transmit all kind of built-in metrics |
5 |
| -- tracer: OpenTracing tracer implementation. It implicitly activates the meter |
| 13 | +The tracer upholds the OpenTracing API and is responsible for reporting |
| 14 | +span data to Instana. |
6 | 15 | """
|
7 | 16 |
|
8 | 17 | __author__ = 'Instana Inc.'
|
|
13 | 22 | __maintainer__ = 'Peter Giacomo Lombardo'
|
14 | 23 | __email__ = 'peter.lombardo@instana.com'
|
15 | 24 |
|
16 |
| -__all__ = ['sensor', 'tracer'] |
| 25 | +# For any given Python process, we only want one sensor as multiple would |
| 26 | +# collect/report metrics in duplicate, triplicate etc.. |
| 27 | +# |
| 28 | +# Usage example: |
| 29 | +# |
| 30 | +# import instana |
| 31 | +# instana.global_sensor |
| 32 | +# |
| 33 | +global_sensor = Sensor(Options()) |
| 34 | + |
| 35 | +# The global OpenTracing compatible tracer used internally by |
| 36 | +# this package. |
| 37 | +# |
| 38 | +# Usage example: |
| 39 | +# |
| 40 | +# import instana |
| 41 | +# instana.internal_tracer.start_span(...) |
| 42 | +# |
| 43 | +internal_tracer = InstanaTracer() |
| 44 | + |
| 45 | +# Set ourselves as the tracer. |
| 46 | +opentracing.tracer = internal_tracer |
| 47 | + |
| 48 | + |
| 49 | +def load_instrumentation(): |
| 50 | + # Import & initialize instrumentation |
| 51 | + from .instrumentation import urllib3 |
0 commit comments