Skip to content

Commit fde1ef8

Browse files
authored
Add instrumentation example to aiohttp-server (#3311)
1 parent 9811782 commit fde1ef8

File tree

1 file changed

+25
-0
lines changed
  • instrumentation/opentelemetry-instrumentation-aiohttp-server/src/opentelemetry/instrumentation/aiohttp_server

1 file changed

+25
-0
lines changed

instrumentation/opentelemetry-instrumentation-aiohttp-server/src/opentelemetry/instrumentation/aiohttp_server/__init__.py

+25
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,31 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
"""
16+
The opentelemetry-instrumentation-aiohttp-server package allows tracing HTTP
17+
requests made by the aiohttp server library.
18+
19+
Usage
20+
-----
21+
22+
.. code:: python
23+
24+
from aiohttp import web
25+
from opentelemetry.instrumentation.aiohttp_server import (
26+
AioHttpServerInstrumentor
27+
)
28+
29+
AioHttpServerInstrumentor().instrument()
30+
31+
async def hello(request):
32+
return web.Response(text="Hello, world")
33+
34+
app = web.Application()
35+
app.add_routes([web.get('/', hello)])
36+
37+
web.run_app(app)
38+
"""
39+
1540
import urllib
1641
from timeit import default_timer
1742
from typing import Dict, List, Tuple, Union

0 commit comments

Comments
 (0)