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

Allow for Flask init_app Pattern #160

Merged
merged 2 commits into from
Apr 21, 2018
Merged

Allow for Flask init_app Pattern #160

merged 2 commits into from
Apr 21, 2018

Conversation

jpoehnelt
Copy link
Contributor

@jpoehnelt jpoehnelt commented Apr 19, 2018

See http://flask.pocoo.org/docs/0.12/extensiondev/#initializing-extensions for common usage of this pattern. Also allows for configuration from the flask application.

Copy link
Contributor

@liyanhui1228 liyanhui1228 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor comments. Thank you for implementing this!

@@ -209,6 +209,40 @@ requests will be automatically traced.
# `GoogleCloudFormatPropagator` as propagator.
middleware = FlaskMiddleware(app)

The middleware also supports the factory pattern.
.. code:: python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a blank line before the code block? This part is not parsing by github correctly.

from opencensus.trace.ext.flask.flask_middleware import FlaskMiddleware
middleware = FlaskMiddleware()
app = flask.Flask(__name__)
middleware.init_app(app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the right parenthesis.

@liyanhui1228 liyanhui1228 merged commit 77cd734 into census-instrumentation:master Apr 21, 2018
sonmezonur pushed a commit to sonmezonur/opencensus-python that referenced this pull request Apr 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants