https://github.com/casualjim/python-opentracing-prometheus
https://github.com/casualjim/python-opentracing-prometheus
Last synced: 2 months 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 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-12T20:55:54.000Z (over 7 years ago)
- Last Synced: 2025-07-09T17:14:03.418Z (4 months 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 TracerMiddleware
import logging
import sys
app = 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 resp
if __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