Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 向普罗米修斯发送自定义数据_Python_Prometheus - Fatal编程技术网

Python 向普罗米修斯发送自定义数据

Python 向普罗米修斯发送自定义数据,python,prometheus,Python,Prometheus,我是普罗米修斯的新手,我想向普罗米修斯发送一些自定义指标。我正在用这个 我已经开始为普罗米修斯服务了 我现在如何启动/custom端点 我怎样才能把我的行李送到那里 自定义数据 在注册表自定义收集器类中注册: class CustomCollector(object): def collect(self): yield GaugeMetricFamily('my_gauge', 'Help text', value=7) c = CounterMetric

我是普罗米修斯的新手,我想向普罗米修斯发送一些自定义指标。我正在用这个

我已经开始为普罗米修斯服务了

  • 我现在如何启动
    /custom
    端点
  • 我怎样才能把我的行李送到那里 自定义数据

  • 在注册表自定义收集器类中注册:

    class CustomCollector(object):
        def collect(self):
            yield GaugeMetricFamily('my_gauge', 'Help text', value=7)
            c = CounterMetricFamily('my_counter_total', 'Help text', labels=['foo'])
            c.add_metric(['bar'], 1.7)
            c.add_metric(['baz'], 3.8)
            yield c
    
    REGISTRY.register(CustomCollector())
    
    然后在启动服务器时使用此注册表:

    app = make_wsgi_app(REGISTRY)
    httpd = make_server('', 1618, app)
    
    app = make_wsgi_app(REGISTRY)
    httpd = make_server('', 1618, app)