You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/12/15 12:28:00 UTC
[GitHub] [skywalking-python] tom-pytel commented on pull request #102: [Plugin] added pyramid plugin
tom-pytel commented on pull request #102:
URL: https://github.com/apache/skywalking-python/pull/102#issuecomment-745257158
Here is a snippet:
```py
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
from skywalking import agent
from skywalking.decorators import trace
from skywalking.trace.context import get_context
import skywalking.trace.context as context
agent.start()
def index(request):
return Response('Hello World!')
def error(request):
raise Exception('Error!')
if __name__ == '__main__':
with Configurator() as config:
config.add_route('index', '/')
config.add_route('error', '/error')
config.add_view(index, route_name='index')
config.add_view(error, route_name='error')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8000, app)
server.serve_forever()
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org