Skip to content

Commit

Permalink
Rename web framework packages from "ext" to "instrumentation" (#961)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzchen authored Aug 3, 2020
1 parent 242d5a7 commit 28d0cdf
Show file tree
Hide file tree
Showing 146 changed files with 352 additions and 301 deletions.
3 changes: 1 addition & 2 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ asyncpg>=0.12.0
ddtrace>=0.34.0
aiohttp~= 3.0
aiopg>=0.13.0
grpcio~=1.27
Deprecated>=1.2.6
django>=2.2
PyMySQL~=0.9.3
Expand All @@ -29,5 +30,3 @@ boto~=2.0
botocore~=1.0
starlette~=0.13
fastapi~=0.58.1
opentelemetry-exporter-cloud-trace==0.10b0
opentelemetry-exporter-cloud-monitoring==0.10b0
10 changes: 9 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@
for f in listdir(ext)
if isdir(join(ext, f))
]
sys.path[:0] = source_dirs + exp_dirs + ext_dirs

instr = "../instrumentation"
instr_dirs = [
os.path.abspath("/".join(["../instrumentation", f, "src"]))
for f in listdir(instr)
if isdir(join(instr, f))
]

sys.path[:0] = source_dirs + exp_dirs + ext_dirs + instr_dirs

# -- Project information -----------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/auto-instrumentation/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Installation
$ pip install opentelemetry-sdk
$ pip install opentelemetry-instrumentation
$ pip install opentelemetry-ext-flask
$ pip install opentelemetry-instrumentation-flask
$ pip install requests
Execution
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/auto-instrumentation/server_instrumented.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from flask import Flask, request

from opentelemetry import propagators, trace
from opentelemetry.ext.wsgi import collect_request_attributes
from opentelemetry.instrumentation.wsgi import collect_request_attributes
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
ConsoleSpanExporter,
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/datadog_exporter/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Distributed Example
pip install opentelemetry-sdk
pip install opentelemetry-exporter-datadog
pip install opentelemetry-instrumentation
pip install opentelemetry-ext-flask
pip install opentelemetry-instrumentation-flask
pip install flask
pip install requests
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/django/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OpenTelemetry Django Instrumentation Example
============================================

This shows how to use ``opentelemetry-ext-django`` to automatically instrument a
This shows how to use ``opentelemetry-instrumentation-django`` to automatically instrument a
Django app.

For more user convenience, a Django app is already provided in this directory.
Expand All @@ -24,7 +24,7 @@ Installation
.. code-block::
$ pip install opentelemetry-sdk
$ pip install opentelemetry-ext-django
$ pip install opentelemetry-instrumentation-django
$ pip install requests
Expand All @@ -40,7 +40,7 @@ Set these environment variables first:
#. ``export DJANGO_SETTINGS_MODULE=instrumentation_example.settings``

The way to achieve OpenTelemetry instrumentation for your Django app is to use
an ``opentelemetry.ext.django.DjangoInstrumentor`` to instrument the app.
an ``opentelemetry.instrumentation.django.DjangoInstrumentor`` to instrument the app.

Clone the ``opentelemetry-python`` repository and go to ``opentelemetry-python/docs/examples/django``.

Expand Down Expand Up @@ -105,4 +105,4 @@ References

* `Django <https://djangoproject.com/>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
* `OpenTelemetry Django extension <https://github.com/open-telemetry/opentelemetry-python/tree/master/ext/opentelemetry-ext-django>`_
* `OpenTelemetry Django extension <https://github.com/open-telemetry/opentelemetry-python/tree/master/instrumentation/opentelemetry-instrumentation-django>`_
2 changes: 1 addition & 1 deletion docs/examples/django/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import os
import sys

from opentelemetry.ext.django import DjangoInstrumentor
from opentelemetry.instrumentation.django import DjangoInstrumentor


def main():
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/opentelemetry-example-app/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ install_requires =
typing; python_version<'3.5'
opentelemetry-api == 0.12.dev0
opentelemetry-sdk == 0.12.dev0
opentelemetry-ext-requests == 0.12.dev0
opentelemetry-ext-flask == 0.12.dev0
opentelemetry-instrumentation-requests == 0.12.dev0
opentelemetry-instrumentation-flask == 0.12.dev0
flask
requests
protobuf~=3.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import flask
import requests

import opentelemetry.ext.requests
import opentelemetry.instrumentation.requests
from opentelemetry import trace
from opentelemetry.ext.flask import FlaskInstrumentor
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
ConsoleSpanExporter,
Expand All @@ -33,7 +33,7 @@
# It must be done before instrumenting any library
trace.set_tracer_provider(TracerProvider())

opentelemetry.ext.requests.RequestsInstrumentor().instrument()
opentelemetry.instrumentation.requests.RequestsInstrumentor().instrument()

trace.get_tracer_provider().add_span_processor(
SimpleExportSpanProcessor(ConsoleSpanExporter())
Expand Down
7 changes: 0 additions & 7 deletions docs/ext/aiohttp_client/aiohttp_client.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/ext/asgi/asgi.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/ext/flask/flask.rst

This file was deleted.

4 changes: 2 additions & 2 deletions docs/ext/grpc/grpc.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OpenTelemetry gRPC Integration
==============================
OpenTelemetry gRPC Instrumentation
==================================

Module contents
---------------
Expand Down
7 changes: 0 additions & 7 deletions docs/ext/pyramid/pyramid.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/ext/wsgi/wsgi.rst

This file was deleted.

4 changes: 2 additions & 2 deletions docs/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ We will now instrument a basic Flask application that uses the requests library

.. code-block:: sh
pip install opentelemetry-ext-flask
pip install opentelemetry-ext-requests
pip install opentelemetry-instrumentation-flask
pip install opentelemetry-instrumentation-requests
And let's write a small Flask application that sends an HTTP request, activating each instrumentation during the initialization:
Expand Down
4 changes: 2 additions & 2 deletions docs/getting_started/flask_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import requests

from opentelemetry import trace
from opentelemetry.ext.flask import FlaskInstrumentor
from opentelemetry.ext.requests import RequestsInstrumentor
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
ConsoleSpanExporter,
Expand Down
8 changes: 8 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ install <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>
:name: Instrumentations
:glob:

instrumentation/**

.. toctree::
:maxdepth: 2
:caption: OpenTelemetry Integrations
:name: integrations
:glob:

ext/**

.. toctree::
Expand Down
7 changes: 7 additions & 0 deletions docs/instrumentation/aiohttp_client/aiohttp_client.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OpenTelemetry aiohttp client Instrumentation
============================================

.. automodule:: opentelemetry.instrumentation.aiohttp_client
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OpenTelemetry aiopg instrumentation
OpenTelemetry aiopg Instrumentation
===================================

.. automodule:: opentelemetry.instrumentation.aiopg
Expand Down
10 changes: 10 additions & 0 deletions docs/instrumentation/asgi/asgi.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
OpenTelemetry asgi Instrumentation
===================================

Module contents
---------------

.. automodule:: opentelemetry.instrumentation.asgi
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OpenTelemetry Django Instrumentation
====================================

.. automodule:: opentelemetry.ext.django
.. automodule:: opentelemetry.instrumentation.django
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. include:: ../../../ext/opentelemetry-instrumentation-fastapi/README.rst
.. include:: ../../../instrumentation/opentelemetry-instrumentation-fastapi/README.rst

API
---
Expand Down
7 changes: 7 additions & 0 deletions docs/instrumentation/flask/flask.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OpenTelemetry Flask Instrumentation
===================================

.. automodule:: opentelemetry.instrumentation.flask
:members:
:undoc-members:
:show-inheritance:
4 changes: 2 additions & 2 deletions docs/instrumentation/instrumentation.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OpenTelemetry Python Instrumentation
====================================
OpenTelemetry Python Instrumentor
=================================

.. automodule:: opentelemetry.instrumentation
:members:
Expand Down
7 changes: 7 additions & 0 deletions docs/instrumentation/pyramid/pyramid.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OpenTelemetry Pyramid Instrumentation
=====================================

.. automodule:: opentelemetry.instrumentation.pyramid
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/instrumentation/requests/requests.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OpenTelemetry requests Instrumentation
======================================

.. automodule:: opentelemetry.instrumentation.requests
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. include:: ../../../ext/opentelemetry-instrumentation-starlette/README.rst
.. include:: ../../../instrumentation/opentelemetry-instrumentation-starlette/README.rst

API
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OpenTelemetry requests Integration
OpenTelemetry WSGI Instrumentation
==================================

.. automodule:: opentelemetry.ext.requests
.. automodule:: opentelemetry.instrumentation.wsgi
:members:
:undoc-members:
:show-inheritance:
7 changes: 4 additions & 3 deletions eachdist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ sortfirst=
opentelemetry-instrumentation
opentelemetry-proto
tests/util
exporter/*
ext/opentelemetry-ext-wsgi
instrumentation/opentelemetry-instrumentation-wsgi
ext/opentelemetry-ext-dbapi
ext/opentelemetry-ext-asgi
instrumentation/opentelemetry-instrumentation-asgi
ext/opentelemetry-ext-botocore
instrumentation/*
exporter/*
ext/*

[lintroots]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@

DEFAULT_AGENT_URL = "http://localhost:8126"
_INSTRUMENTATION_SPAN_TYPES = {
"opentelemetry.ext.aiohttp-client": DatadogSpanTypes.HTTP,
"opentelemetry.ext.asgi": DatadogSpanTypes.WEB,
"opentelemetry.instrumentation.aiohttp-client": DatadogSpanTypes.HTTP,
"opentelemetry.instrumentation.asgi": DatadogSpanTypes.WEB,
"opentelemetry.ext.dbapi": DatadogSpanTypes.SQL,
"opentelemetry.ext.django": DatadogSpanTypes.WEB,
"opentelemetry.ext.flask": DatadogSpanTypes.WEB,
"opentelemetry.instrumentation.django": DatadogSpanTypes.WEB,
"opentelemetry.instrumentation.flask": DatadogSpanTypes.WEB,
"opentelemetry.ext.grpc": DatadogSpanTypes.GRPC,
"opentelemetry.ext.jinja2": DatadogSpanTypes.TEMPLATE,
"opentelemetry.ext.mysql": DatadogSpanTypes.SQL,
Expand All @@ -45,9 +45,9 @@
"opentelemetry.ext.pymongo": DatadogSpanTypes.MONGODB,
"opentelemetry.ext.pymysql": DatadogSpanTypes.SQL,
"opentelemetry.ext.redis": DatadogSpanTypes.REDIS,
"opentelemetry.ext.requests": DatadogSpanTypes.HTTP,
"opentelemetry.instrumentation.requests": DatadogSpanTypes.HTTP,
"opentelemetry.ext.sqlalchemy": DatadogSpanTypes.SQL,
"opentelemetry.ext.wsgi": DatadogSpanTypes.WEB,
"opentelemetry.instrumentation.wsgi": DatadogSpanTypes.WEB,
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,20 @@ def test_resources(self):

def test_span_types(self):
test_instrumentations = [
"opentelemetry.ext.aiohttp-client",
"opentelemetry.instrumentation.aiohttp-client",
"opentelemetry.ext.dbapi",
"opentelemetry.ext.django",
"opentelemetry.ext.flask",
"opentelemetry.instrumentation.django",
"opentelemetry.instrumentation.flask",
"opentelemetry.ext.grpc",
"opentelemetry.ext.jinja2",
"opentelemetry.ext.mysql",
"opentelemetry.ext.psycopg2",
"opentelemetry.ext.pymongo",
"opentelemetry.ext.pymysql",
"opentelemetry.ext.redis",
"opentelemetry.ext.requests",
"opentelemetry.instrumentation.requests",
"opentelemetry.ext.sqlalchemy",
"opentelemetry.ext.wsgi",
"opentelemetry.instrumentation.wsgi",
]

for index, instrumentation in enumerate(test_instrumentations):
Expand Down
9 changes: 0 additions & 9 deletions ext/opentelemetry-ext-aiohttp-client/CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion ext/opentelemetry-ext-grpc/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

[metadata]
name = opentelemetry-ext-grpc
description = OpenTelemetry gRPC Integration
description = OpenTelemetry gRPC instrumentation
long_description = file: README.rst
long_description_content_type = text/x-rst
author = OpenTelemetry Authors
Expand Down
Loading

0 comments on commit 28d0cdf

Please sign in to comment.