``` import prometheus_client as prom, Guage import random import time
pool={'pool_name': 'testing-prom-tool','member_name': 'promtest', 'mem_port': '443', 'mem_address': 'xx.xx.xx.xx', 'mem_state': 'down'} # Create a metric to track time spent and requests made. REQUEST_TIME = prom.Summary('request_processing_seconds', 'Time spent processing request') # Decorate function with metric. @REQUEST_TIME.time() def process_request(): time.sleep(1) if __name__ == '__main__': # name documentation label names ### I was able to populate all the keys from the dictionary using the pool. keys()) f5_prom_test = prom.Guage('f5_test','f5_node_status',('pool_name','member_name','mem_port','mem_address','mem_state')) prom.start_http_server(1234) While True: process_request() f5_prom_test.labels(pool.get('pool_name'),pool.get('member_name'),pool.get('mem_port'),pool.get('mem_address'),pool.get('mem_state')) #f5_prom.labels(**pool), this works as well ``` I can see metrics are registered when I curl -K http://localhost:1234. Somehow the metrics are not saved in the Prometheus. I can't view the data whenever I stop the python script in grafana, and there is no historical data held in the Prometheus tsdb to view on the Prometheus web URL ``` curl -K http://localhost:1234 f5_test{mem_address="xx.xx.xx.xxx",mem_name="test-server",pool_name"=testpool",mem_port="5443",mem_state="down"} ``` Here is my `prometheus.yml` for custom python Prometheus collector for pool data ``` - job_name: 'python-exporter scrape_interval: 5s static_configs: - targets: ['hostname:1234'] ``` I can view the data only when I use the python script; later, that data is not saved in Prometheus. I'm not using any custom registry , How to save registered data in /metrics to Prometheus using prometheus_client? I already changed my retention period of Prometheus tsdb -- You received this message because you are subscribed to the Google Groups "Prometheus Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/deafc9e8-a2d3-4ad3-96a9-5897bebbb8b5n%40googlegroups.com.