【问题标题】:How to send locust metrics to prometheus using locust exporter?如何使用蝗虫出口商将蝗虫指标发送到普罗米修斯?
【发布时间】:2020-07-01 15:05:29
【问题描述】:

我遇到了locust exporter。所以我安装了它并按照步骤操作,如文档中所述,我运行了命令 locust_exporter.py 1234 localhost:8089,其中 1234 是一个端口。但它抛出了一些错误。

处理来自 ('127.0.0.1', 11950)回溯(最近一次通话最后):文件 “E:\Python\lib\socketserver.py”,第 650 行,在 process_request_thread 中 self.finish_request(request, client_address) 文件“E:\Python\lib\socketserver.py”,第 360 行,在 finish_request self.RequestHandlerClass(request, client_address, self) 文件“E:\Python\lib\socketserver.py”,第 720 行,在 init self.handle() 文件“E:\Python\lib\http\server.py”,第 426 行,在句柄中 self.handle_one_request() 文件“E:\Python\lib\http\server.py”,第 414 行,在 handle_one_request 方法()文件“E:\Python\lib\site-packages\prometheus_client\exposition.py”,行 152,在 do_GET 输出 = 编码器(注册表)文件“E:\Python\lib\site-packages\prometheus_client\exposition.py”,行 121,在 generate_latest output.append(sample_line(s)) 文件“E:\Python\lib\site-packages\prometheus_client\exposition.py”,行 77,在 sample_line ['{0}="{1}"'.format( 文件 "E:\Python\lib\site-packages\prometheus_client\exposition.py", 行 78,在 k, v.replace('\', r'\').replace('\n', r'\n').replace('"', r'\"')) AttributeError: ("'NoneType'对象没有属性 'replace'", Metric(locust_requests_avg_content_length, Locust 请求 avg_content_length, gauge, , [样本(名称='locust_requests_avg_content_lengt h',标签={'路径': '/charts.html', 'method': 'GET'}, value=19561.0, timestamp=None, 示例=无),样本(名称='locust_requests_avg_content_length', 标签={'path': '/index.html', 'method': 'GET'}, value=31333.0, 时间戳=无,示例=无), 示例(名称='locust_requests_avg_content_length',lab els={'path': '聚合','方法':无},值= 25447.0,时间戳=无, 示例=无)]))

处理来自 ('127.0.0.1', 11951)回溯(最近一次通话最后):文件 “E:\Python\lib\socketserver.py”,第 650 行,在 process_request_thread 中 self.finish_request(request, client_address) 文件“E:\Python\lib\socketserver.py”,第 360 行,在 finish_request self.RequestHandlerClass(request, client_address, self) 文件“E:\Python\lib\socketserver.py”,第 720 行,在 init self.handle() 文件“E:\Python\lib\http\server.py”,第 426 行,在句柄中 self.handle_one_request() 文件“E:\Python\lib\http\server.py”,第 414 行,在 handle_one_request 方法()文件“E:\Python\lib\site-packages\prometheus_client\exposition.py”,行 152,在 do_GET 输出 = 编码器(注册表)文件“E:\Python\lib\site-packages\prometheus_client\exposition.py”,行 121,在 generate_latest output.append(sample_line(s)) 文件“E:\Python\lib\site-packages\prometheus_client\exposition.py”,行 77,在 sample_line ['{0}="{1}"'.format( 文件 "E:\Python\lib\site-packages\prometheus_client\exposition.py", 行 78,在 k, v.replace('\', r'\').replace('\n', r'\n').replace('"', r'\"')) AttributeError: ("'NoneType'对象没有属性 'replace'", Metric(locust_requests_avg_content_length, Locust 请求 avg_content_length, gauge, , [样本(名称='locust_requests_avg_content_lengt h',标签={'路径': '/charts.html', 'method': 'GET'}, value=19561.0, timestamp=None, 示例=无),样本(名称='locust_requests_avg_content_length', 标签={'path': '/index.html', 'method': 'GET'}, value=31333.0, 时间戳=无,示例=无), 示例(名称='locust_requests_avg_content_length',lab els={'path': '聚合','方法':无},值= 25447.0,时间戳=无, 示例=无)])

不确定是什么错误。如何解决?

【问题讨论】:

    标签: python prometheus locust


    【解决方案1】:

    您可以尝试使用这个导出器:ContainerSolutions/locust_exporter

    docker run --net=host containersol/locust_exporter
    

    默认情况下,它会尝试连接到 http://localhost:8089 上的 locust 并且指标将在 http://localhost:9646/metrics 上公开

    我写了一篇关于How to Move Metrics from Locust.io to Grafana via Prometheus的博文。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-13
      • 1970-01-01
      • 1970-01-01
      • 2020-01-16
      • 2020-01-10
      • 2020-11-12
      • 2019-01-31
      • 1970-01-01
      相关资源
      最近更新 更多