Add an autoinstrumentation mechanism and an instrumentor for Flask (#327)
Add an autoinstrumentation mechanism and an instrumentor for Flask (#327)

Adding an autoinstrumentation mechanism and a Flask instrumentor (an instrumentor is a class that implements the _instrument and _uninstrument methods).

It works like this:

A console command is defined. This makes it possible to run a command named opentelemetry-auto-instrumentation that will execute this function.

When the opentelemetry-auto-instrumentation command is executed, then the instrument method of the different instrumentors is called, which are made available via an entry-point.

2.In the case of the Flask instrumentor, the original flask.Flask gets replaced with _InstrumentedFlask (in this case, the Flask instrumentor uses monkey patching to perform the instrumentation, nevertheless, monkey patching is not always the method used to do this, so the name instrumentor is preferred over patcher).

Once all instrumentation is enabled, the app is executed.

Co-Authored-By: Mauricio Vásquez <95f407c1ffa7689a0a3f2f21b1bf582fe8359351@kinvolk.io>
Co-authored-by: Chris Kleinknecht <cb9c5e2d56e129ddbf7d7f021e9ecdcc26174648@google.com>
open-telemetry/opentelemetry-python-contrib,open-telemetry/opentelemetry-python-contrib,open-telemetry/opentelemetry-python-contrib