-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add prometheus metrics to server * <bot> update requirements-docs.txt * <bot> update requirements-tests.txt * <bot> update requirements.txt * fix tests * fix async vs non * <bot> update requirements-docs.txt * <bot> update requirements-tests.txt * <bot> update requirements.txt * fix async generator * make condor history a generator to attempt to increase speed * add async task groups to better parallelize calls * <bot> update requirements-docs.txt * <bot> update requirements-tests.txt * <bot> update requirements.txt * better histogram buckets * <bot> update requirements-docs.txt * <bot> update requirements-tests.txt * <bot> update requirements.txt * fix flake8 * fix negative times and bad bucket sizes * add prometheus to rest server * fix flake8 * expand to materialization and credentials servers * remove another statsd reference * fix label format * add prometheus to website * put prom api metric into a mixin * convert dataset monitor to prometheus * remove statsd from pip install * fix metric names * <bot> update setup.cfg * <bot> update requirements-docs.txt * <bot> update requirements-tests.txt * <bot> update requirements.txt * still not ready for python 3.13, because of htcondor * <bot> update setup.cfg * try harder for labels * drop two old tests * reset on gridftp issues --------- Co-authored-by: github-actions <[email protected]>
- Loading branch information
Showing
25 changed files
with
511 additions
and
590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
Some Prometheus utilities. | ||
""" | ||
|
||
import time | ||
|
||
from prometheus_client import Histogram | ||
|
||
|
||
class HistogramBuckets: | ||
"""Prometheus histogram buckets""" | ||
|
||
# DEFAULT = [.005, .01, .025, .05, .075, .1, .25, .5, .75, 1, 2.5, 5, 7.5, 10] | ||
|
||
#: Database bucket centered around 5ms, with outliers up to 10s | ||
DB = [.001, .002, .003, .004, .005, .006, .007, .008, .009, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10] | ||
|
||
#: API bucket centered around 50ms, up to 10s | ||
API = [.005, .01, .02, .03, .04, .05, .06, .07, .08, .09, .1, .25, .5, .75, 1, 2.5, 5, 7.5, 10] | ||
|
||
#: Timer bucket up to 1 second | ||
SECOND = [.0001, .0005, .001, .0025, .005, .0075, .01, .025, .05, .075, .1, .25, .5, .75, 1] | ||
|
||
#: Timer bucket up to 10 seconds | ||
TENSECOND = [.001, .0025, .005, .0075, .01, .025, .05, .075, .1, .25, .5, .75, 1, 2.5, 5, 10] | ||
|
||
#: Timer bucket up to 1 minute | ||
MINUTE = [.1, .5, 1, 2.5, 5, 7.5, 10, 15, 20, 25, 30, 45, 60] | ||
|
||
#: Timer bucket up to 10 minutes | ||
TENMINUTE = [1, 5, 10, 15, 20, 25, 30, 45, 60, 90, 120, 150, 180, 240, 300, 360, 420, 480, 540, 600] | ||
|
||
#: Timer bucket up to 1 hour | ||
HOUR = [10, 60, 120, 300, 600, 1200, 1800, 2400, 3000, 3600] | ||
|
||
|
||
class PromRequestMixin: | ||
PromHTTPHistogram = Histogram('http_request_duration_seconds', 'HTTP request duration in seconds', labelnames=('verb', 'path', 'status'), buckets=HistogramBuckets.API) | ||
|
||
def prepare(self): | ||
super().prepare() | ||
self._prom_start_time = time.monotonic() | ||
|
||
def on_finish(self): | ||
super().on_finish() | ||
end_time = time.monotonic() | ||
self.PromHTTPHistogram.labels( | ||
verb=self.request.method, | ||
path=self.request.path, | ||
status=self.get_status(), | ||
).observe(end_time - self._prom_start_time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.