I hereby claim:
- I am spacez320 on github.
- I am spacez320 (https://keybase.io/spacez320) on keybase.
- I have a public key whose fingerprint is 0A1E EC57 77EE 6014 3C87 87C0 2163 6158 A09C CF45
To claim this, I am signing this object:
#!/bin/bash | |
# | |
# This demonstrates how to remove all records within a hosted zone in order to delete it. This is tricky because hosted zones | |
# must be empty (minus their standard SOA and NS records) and the removal of a record requires some non-trivial payload | |
# construction. | |
# | |
# Requires jq. | |
# | |
# Be careful deleting things! |
def insecure_ssl_pushgateway_handler(url, method, timeout, headers, data): | |
"""Defines a handler which manages unverified SSL connections. | |
NOTE: This is used because client Python code will be addressing HTTPS endpoints that use TLS originating from | |
PathAI's CA, which is not normally verifiable. | |
Arguments are required by the handler interface in prometheus_client.push_to_gateway. | |
See: https://github.com/prometheus/client_py |
from my_metrics_lib import generate_push_metric, summary_timer | |
TRAINING_SUMMARY = generate_push_metric( | |
"Summary", "training_summary", "Time spent on training." ) | |
@summary_timer(TRAINING_SUMMARY) | |
def do_training_make_models(): | |
… money-making model training goes here … |
def summary_timer(summary): | |
"""Decorator for timing functions using Pushgateway. | |
Args: | |
summary (prometheus_client.Summary): Summary to update and push. | |
Returns: | |
func: Summary timer decorator. | |
Example: |
from my_metrics_lib import generate_push_metric | |
TRAINING_SUMMARY = generate_push_metric( | |
"Summary", "training_summary", "Time spent on training." | |
) |
def generate_push_metric(metric_type, name, description, labels=None): | |
"""Creates a Prometheus metric for Pushgateway. | |
Args: | |
metric_type: Supported prometheus_client metric. Counter, Gauge, Summary, Histogram, Info, Enum. | |
name: Metric name. | |
description: Metric description. | |
labels: Metric labels. Default is None. | |
""" | |
# Figure out labels. |
import prometheus_client | |
# Pushgateway endpoint, defaults to production Prometheus. | |
PUSHGATEWAY_URL = os.getenv('PROMETHEUS_PUSHGATEWAY_URL', 'https://production-pushgateway.our.services.com') | |
# Set up a registry for pushed metrics. | |
registry = prometheus_client.CollectorRegistry() |
I hereby claim:
To claim this, I am signing this object: