MCPcopy Index your code
hub / github.com/prometheus/client_python / push_to_gateway

Function push_to_gateway

prometheus_client/exposition.py:602–651  ·  view source on GitHub ↗

Push metrics to the given pushgateway. `gateway` the url for your push gateway. Either of the form 'http://pushgateway.local', or 'pushgateway.local'. Scheme defaults to 'http' if none is provided `job` is the job label to be attached to all pushed metrics `r

(
        gateway: str,
        job: str,
        registry: Collector,
        grouping_key: Optional[Dict[str, Any]] = None,
        timeout: Optional[float] = 30,
        handler: Callable = default_handler,
        compression: CompressionType = None,
)

Source from the content-addressed store, hash-verified

600
601
602def push_to_gateway(
603 gateway: str,
604 job: str,
605 registry: Collector,
606 grouping_key: Optional[Dict[str, Any]] = None,
607 timeout: Optional[float] = 30,
608 handler: Callable = default_handler,
609 compression: CompressionType = None,
610) -> None:
611 """Push metrics to the given pushgateway.
612
613 `gateway` the url for your push gateway. Either of the form
614 'http://pushgateway.local', or 'pushgateway.local'.
615 Scheme defaults to 'http' if none is provided
616 `job` is the job label to be attached to all pushed metrics
617 `registry` is a Collector, normally an instance of CollectorRegistry
618 `grouping_key` please see the pushgateway documentation for details.
619 Defaults to None
620 `timeout` is how long push will attempt to connect before giving up.
621 Defaults to 30s, can be set to None for no timeout.
622 `handler` is an optional function which can be provided to perform
623 requests to the 'gateway'.
624 Defaults to None, in which case an http or https request
625 will be carried out by a default handler.
626 If not None, the argument must be a function which accepts
627 the following arguments:
628 url, method, timeout, headers, and content
629 May be used to implement additional functionality not
630 supported by the built-in default handler (such as SSL
631 client certicates, and HTTP authentication mechanisms).
632 'url' is the URL for the request, the 'gateway' argument
633 described earlier will form the basis of this URL.
634 'method' is the HTTP method which should be used when
635 carrying out the request.
636 'timeout' requests not successfully completed after this
637 many seconds should be aborted. If timeout is None, then
638 the handler should not set a timeout.
639 'headers' is a list of ("header-name","header-value") tuples
640 which must be passed to the pushgateway in the form of HTTP
641 request headers.
642 The function should raise an exception (e.g. IOError) on
643 failure.
644 'content' is the data which should be used to form the HTTP
645 Message Body.
646 `compression` selects the payload compression. Supported values are 'gzip'
647 and 'snappy'. Defaults to None (no compression).
648
649 This overwrites all metrics with the same job and grouping_key.
650 This uses the PUT HTTP method."""
651 _use_gateway('PUT', gateway, job, registry, grouping_key, timeout, handler, compression)
652
653
654def pushadd_to_gateway(

Calls 1

_use_gatewayFunction · 0.85