Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/casualjim/python-opentracing-prometheus
https://github.com/casualjim/python-opentracing-prometheus
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/casualjim/python-opentracing-prometheus
- Owner: casualjim
- License: mit
- Created: 2018-03-05T03:14:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-12T20:55:54.000Z (over 6 years ago)
- Last Synced: 2024-10-06T05:02:54.719Z (about 1 month ago)
- Language: Python
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenTracing Prometheus
An integration for opentracing and prometheus.
It exposes the same metrics as jaeger and prometheus for golang.This package contains a PrometheusReporter and PrometheusMetricsFactory
The reporter is used to report on metrics based on span contents
The factory is used to report on metrics from jaeger itself.There is also a wsgi middleware that combines all the options.
## Middleware
```python
from flask import Flask, make_response
from opentracing_prometheus import TracerMiddlewareimport logging
import sysapp = Flask('prometheus-tracing')
logging.basicConfig(stream=sys.stderr)
log_level = logging.DEBUG
logging.getLogger('').handlers = []
logging.basicConfig(format='%(asctime)s %(message)s', level=log_level)app.wsgi_app = TracerMiddleware(app)
log = logging.getLogger()@app.route('/')
def fetch_hello_world():
resp = make_response('Hello, World!')
resp.headers['Content-Type'] = 'text/plain'
return respif __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)```
You can then make a few requests to localhost:5000 and check the metrics at: http://localhost:5000/metrics