File tree Expand file tree Collapse file tree 3 files changed +22
-23
lines changed Expand file tree Collapse file tree 3 files changed +22
-23
lines changed Original file line number Diff line number Diff line change 1+ HTTP/2 200
2+ content-type: text/html
3+ etag: "84238dfc8092e5d9c0dac8ef93371a07:1736799080.121134"
4+ last-modified: Mon, 13 Jan 2025 20:11:20 GMT
5+ cache-control: max-age=702
6+ date: Fri, 20 Jun 2025 18:37:37 GMT
7+ alt-svc: h3=":443"; ma=93600,h3-29=":443"; ma=93600,quic=":443"; ma=93600; v="43"
8+ content-length: 1256
9+
Original file line number Diff line number Diff line change @@ -283,28 +283,6 @@ async def wrapper() -> None:
283283 reactor .callWhenRunning (lambda : defer .ensureDeferred (wrapper ()))
284284
285285
286- def _set_prometheus_client_use_created_metrics (new_value : bool ) -> None :
287- """
288- Sets whether prometheus_client should expose `_created`-suffixed metrics for
289- all gauges, histograms and summaries.
290- There is no programmatic way to disable this without poking at internals;
291- the proper way is to use an environment variable which prometheus_client
292- loads at import time.
293-
294- The motivation for disabling these `_created` metrics is that they're
295- a waste of space as they're not useful but they take up space in Prometheus.
296- """
297-
298- import prometheus_client .metrics
299-
300- if hasattr (prometheus_client .metrics , "_use_created" ):
301- prometheus_client .metrics ._use_created = new_value
302- else :
303- logger .error (
304- "Can't disable `_created` metrics in prometheus_client (brittle hack broken?)"
305- )
306-
307-
308286def listen_manhole (
309287 bind_addresses : StrCollection ,
310288 port : int ,
Original file line number Diff line number Diff line change 2020#
2121#
2222
23- from prometheus_client import REGISTRY , CollectorRegistry , generate_latest
23+ from prometheus_client import (
24+ REGISTRY ,
25+ CollectorRegistry ,
26+ generate_latest ,
27+ disable_created_metrics ,
28+ )
2429
2530from twisted .web .resource import Resource
2631from twisted .web .server import Request
2732
2833CONTENT_TYPE_LATEST = "text/plain; version=0.0.4; charset=utf-8"
2934
35+ # Sets whether `prometheus_client` should expose `_created`-suffixed metrics for all
36+ # gauges, histograms and summaries.
37+ #
38+ # The motivation for disabling these `_created` metrics is that they're a waste of space
39+ # as they're not useful but they take up space in Prometheus.
40+ disable_created_metrics ()
41+
3042
3143class MetricsResource (Resource ):
3244 """
You can’t perform that action at this time.
0 commit comments