Skip to content

Add WSGI helper methods#78

Merged
brian-brazil merged 1 commit intoprometheus:masterfrom
rmohr:master
Apr 26, 2016
Merged

Add WSGI helper methods#78
brian-brazil merged 1 commit intoprometheus:masterfrom
rmohr:master

Conversation

@rmohr
Copy link
Copy Markdown
Contributor

@rmohr rmohr commented Apr 26, 2016

Hi,

I tried to integrate the library with flask. It's easy but I had to go through the source code to find out what to do.
With this helper classes I hope to make it even easier for others. Someone can then just create a flask WSGI app and a Prometheus WSGI app and can do the routing in a third app.

Maybe another helper method for that might be nice too?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why the str?

We're using single quotes in this file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why the str?
Because of the future import for unicode_literals, WSGI needs a str object. It does not make any difference for the BasicHTTPServer.
We're using single quotes in this file.
Done

@rmohr rmohr force-pushed the master branch 2 times, most recently from b2e4c33 to ab436cc Compare April 26, 2016 13:41
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This sorts after contextlib

@brian-brazil
Copy link
Copy Markdown
Contributor

Could you add a short example to the README?

@rmohr rmohr force-pushed the master branch 2 times, most recently from af15138 to b532313 Compare April 26, 2016 14:09
@rmohr
Copy link
Copy Markdown
Contributor Author

rmohr commented Apr 26, 2016

Added an example to the README

README.md Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You're not using this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Add helper methods to make it easy to start a prometheus server as WSGI
app. This makes it easier to integrate with other WSGI applications like
flask or to start exposing metrics in your WSGI server of choice.
@brian-brazil brian-brazil merged commit 9a188ac into prometheus:master Apr 26, 2016
@brian-brazil
Copy link
Copy Markdown
Contributor

Thanks!

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.

2 participants