Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding web.py example #523

Merged
merged 7 commits into from
Jun 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
"""
This library provides a WSGI middleware that can be used on any WSGI framework
(such as Django / Flask) to track requests timing through OpenTelemetry.
(such as Django / Flask / Web.py) to track requests timing through OpenTelemetry.

Usage (Flask)
-------------
Expand Down Expand Up @@ -50,6 +50,35 @@ def hello():
application = get_wsgi_application()
application = OpenTelemetryMiddleware(application)

Usage (Web.py)
--------------

.. code-block:: python

import web
from opentelemetry.instrumentation.wsgi import OpenTelemetryMiddleware
from cheroot import wsgi

urls = ('/', 'index')


class index:

def GET(self):
return "Hello, world!"


if __name__ == "__main__":
app = web.application(urls, globals())
func = app.wsgifunc()

func = OpenTelemetryMiddleware(func)

server = wsgi.WSGIServer(
("localhost", 5100), func, server_name="localhost"
)
server.start()

API
---
"""
Expand Down