TL;DR Application Insights, which can be called New Relic for Azure, doesn't have much information, so I'll write it.
GitHub Microsoft/ApplicationInsights-Python: Application Insights SDK for Python https://github.com/Microsoft/ApplicationInsights-Python
You can find out how to use it by reading GitHub. .. .. .. It's lonely just to say that, so it's easy to use below.
You only need to install pip
.
$ pip install applicationinsights
In GitHub's README, client telemetry and server-side processing are combined, which is difficult to understand, but it is possible to monitor in two categories: monitoring when sending a request from a client and monitoring on the server side receiving a request. is.
INSTRUMENTATION KEY No matter how you use it, you will need the INSTRUMENTATION KEY. The INSTRUMENTATION KEY is located in a property inside the Azure Application Insights blade.
Basically, any WSGI application can be easily incorporated. Of course, it was possible in the environment of Python's lightweight framework bottle + uWSG.
from applicationinsights.requests import WSGIApplication
from bottle import route, run, default_app, get, post, request, static_file
~ Abbreviation ~
if __name__ == '__main__':
#From the command"python index.py"When started with
run(host='0.0.0.0', port=8080, debug=True)
else:
#When started from uWSGI
application = WSGIApplication('<INSTRUMENTATION KEY>', default_app())
It will be displayed like this.
I will try it from now on
I will try it from now on
I will try it from now on
Recommended Posts