diff --git a/docs-requirements.txt b/docs-requirements.txt index b045ed589ba..17d71b91aff 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -16,6 +16,7 @@ prometheus_client>=0.5.0,<1.0.0 psycopg2-binary>=2.7.3.1 pymemcache~=1.3 pymongo~=3.1 +pyramid>=1.7 redis>=2.6 sqlalchemy>=1.0 thrift>=0.10.0 diff --git a/docs/ext/pyramid/pyramid.rst b/docs/ext/pyramid/pyramid.rst new file mode 100644 index 00000000000..b46718c387a --- /dev/null +++ b/docs/ext/pyramid/pyramid.rst @@ -0,0 +1,7 @@ +OpenTelemetry Pyramid Integration +================================= + +.. automodule:: opentelemetry.ext.pyramid + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/ext/sqlite3/sqlite3.rst b/docs/ext/sqlite3/sqlite3.rst new file mode 100644 index 00000000000..9537ff58bfe --- /dev/null +++ b/docs/ext/sqlite3/sqlite3.rst @@ -0,0 +1,7 @@ +OpenTelemetry SQLite3 Integration +================================= + +.. automodule:: opentelemetry.ext.sqlite3 + :members: + :undoc-members: + :show-inheritance: diff --git a/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py b/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py index 6f63634bc7a..c3db25ee7cb 100644 --- a/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py +++ b/ext/opentelemetry-ext-pyramid/src/opentelemetry/ext/pyramid/__init__.py @@ -20,16 +20,17 @@ Usage ----- - There are two methods to instrument Pyramid: +There are two methods to instrument Pyramid: Method 1 (Instrument all Configurators): ---------------------------------------- + .. code:: python from pyramid.config import Configurator from opentelemetry.ext.pyramid import PyramidInstrumentor - PyramidInstrumentor.instrument() + PyramidInstrumentor().instrument() config = Configurator() @@ -38,6 +39,7 @@ Method 2 (Instrument one Configurator): --------------------------------------- + .. code:: python from pyramid.config import Configurator @@ -49,22 +51,30 @@ # use your config as normal config.add_route('index', '/') -Using ``pyramid.tweens`` settings: ----------------------------------- - If you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting, - you need to add ``opentelemetry.ext.pyramid.trace_tween_factory`` explicity to the list, - *as well as* instrumenting the config with `PyramidInstrumentor().instrument_config(config)`. +Using ``pyramid.tweens`` setting: +--------------------------------- + +If you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting, +you need to add ``opentelemetry.ext.pyramid.trace_tween_factory`` explicity to the list, +*as well as* instrumenting the config as shown above. + +For example: - For example: .. code:: python + + from pyramid.config import Configurator + from opentelemetry.ext.pyramid import PyramidInstrumentor + settings = { 'pyramid.tweens', 'opentelemetry.ext.pyramid.trace_tween_factory\\nyour_tween_no_1\\nyour_tween_no_2', } config = Configurator(settings=settings) - PyramidInstrumentor.instrument_config(config) + PyramidInstrumentor().instrument_config(config) # use your config as normal. config.add_route('index', '/') + +API --- """ @@ -87,7 +97,7 @@ from opentelemetry.trace import TracerProvider, get_tracer -def traced_init(wrapped, instance, args, kwargs): +def _traced_init(wrapped, instance, args, kwargs): settings = kwargs.get("settings", {}) tweens = aslist(settings.get("pyramid.tweens", [])) @@ -119,7 +129,7 @@ def _instrument(self, **kwargs): """Integrate with Pyramid Python library. https://docs.pylonsproject.org/projects/pyramid/en/latest/ """ - _wrap("pyramid.config", "Configurator.__init__", traced_init) + _wrap("pyramid.config", "Configurator.__init__", _traced_init) def _uninstrument(self, **kwargs): """"Disable Pyramid instrumentation""" @@ -131,9 +141,6 @@ def instrument_config(self, config): Args: config: The Configurator to instrument. - - Returns: - An instrumented Configurator. """ config.include("opentelemetry.ext.pyramid.callbacks")