File tree 1 file changed +30
-1
lines changed
instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi
1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
"""
15
15
This library provides a WSGI middleware that can be used on any WSGI framework
16
- (such as Django / Flask) to track requests timing through OpenTelemetry.
16
+ (such as Django / Flask / Web.py ) to track requests timing through OpenTelemetry.
17
17
18
18
Usage (Flask)
19
19
-------------
@@ -50,6 +50,35 @@ def hello():
50
50
application = get_wsgi_application()
51
51
application = OpenTelemetryMiddleware(application)
52
52
53
+ Usage (Web.py)
54
+ --------------
55
+
56
+ .. code-block:: python
57
+
58
+ import web
59
+ from opentelemetry.instrumentation.wsgi import OpenTelemetryMiddleware
60
+ from cheroot import wsgi
61
+
62
+ urls = ('/', 'index')
63
+
64
+
65
+ class index:
66
+
67
+ def GET(self):
68
+ return "Hello, world!"
69
+
70
+
71
+ if __name__ == "__main__":
72
+ app = web.application(urls, globals())
73
+ func = app.wsgifunc()
74
+
75
+ func = OpenTelemetryMiddleware(func)
76
+
77
+ server = wsgi.WSGIServer(
78
+ ("localhost", 5100), func, server_name="localhost"
79
+ )
80
+ server.start()
81
+
53
82
API
54
83
---
55
84
"""
You can’t perform that action at this time.
0 commit comments