aliyun-exporter icon indicating copy to clipboard operation
aliyun-exporter copied to clipboard

请问启动后一直狂刷这个报错是什么导致的。

Open git2017-jpg opened this issue 5 years ago • 8 comments

Traceback (most recent call last): File "/usr/local/python3/lib/python3.7/logging/init.py", line 983, in emit msg = self.format(record) File "/usr/local/python3/lib/python3.7/logging/init.py", line 829, in format return fmt.format(record) File "/usr/local/python3/lib/python3.7/logging/init.py", line 569, in format record.message = record.getMessage() File "/usr/local/python3/lib/python3.7/logging/init.py", line 331, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "/usr/local/python3/bin/aliyun-exporter", line 11, in sys.exit(main()) File "/usr/local/python3/lib/python3.7/site-packages/aliyun_exporter/init.py", line 45, in main httpd.serve_forever() File "/usr/local/python3/lib/python3.7/socketserver.py", line 234, in serve_forever self._handle_request_noblock() File "/usr/local/python3/lib/python3.7/socketserver.py", line 313, in handle_request_noblock self.process_request(request, client_address) File "/usr/local/python3/lib/python3.7/socketserver.py", line 344, in process_request self.finish_request(request, client_address) File "/usr/local/python3/lib/python3.7/socketserver.py", line 357, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/python3/lib/python3.7/socketserver.py", line 717, in init self.handle() File "/usr/local/python3/lib/python3.7/wsgiref/simple_server.py", line 133, in handle handler.run(self.server.get_app()) File "/usr/local/python3/lib/python3.7/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/wsgi.py", line 826, in call return app(environ, start_response) File "/usr/local/python3/lib/python3.7/site-packages/prometheus_client/exposition.py", line 45, in prometheus_app output = encoder(r) File "/usr/local/python3/lib/python3.7/site-packages/prometheus_client/openmetrics/exposition.py", line 14, in generate_latest for metric in registry.collect(): File "/usr/local/python3/lib/python3.7/site-packages/prometheus_client/registry.py", line 75, in collect for metric in collector.collect(): File "/usr/local/python3/lib/python3.7/site-packages/aliyun_exporter/collector.py", line 133, in collect yield from self.metric_generator(project, metric) File "/usr/local/python3/lib/python3.7/site-packages/aliyun_exporter/collector.py", line 115, in metric_generator logging.error('Error query metrics for {}{}'.format(project, metric_name), e) Message: 'Error query metrics for acs_ecs_dashboard_memory_usedutilization' Arguments: (KeyError('Datapoints'),) --- Logging error --- Traceback (most recent call last): File "/usr/local/python3/lib/python3.7/site-packages/aliyun_exporter/collector.py", line 113, in metric_generator points = self.query_metric(project, metric_name, period) File "/usr/local/python3/lib/python3.7/site-packages/aliyun_exporter/collector.py", line 89, in query_metric points = json.loads(data['Datapoints']) KeyError: 'Datapoints'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/python3/lib/python3.7/logging/init.py", line 983, in emit msg = self.format(record) File "/usr/local/python3/lib/python3.7/logging/init.py", line 829, in format return fmt.format(record) File "/usr/local/python3/lib/python3.7/logging/init.py", line 569, in format record.message = record.getMessage() File "/usr/local/python3/lib/python3.7/logging/init.py", line 331, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "/usr/local/python3/bin/aliyun-exporter", line 11, in sys.exit(main()) File "/usr/local/python3/lib/python3.7/site-packages/aliyun_exporter/init.py", line 45, in main httpd.serve_forever() File "/usr/local/python3/lib/python3.7/socketserver.py", line 234, in serve_forever self._handle_request_noblock() File "/usr/local/python3/lib/python3.7/socketserver.py", line 313, in handle_request_noblock self.process_request(request, client_address) File "/usr/local/python3/lib/python3.7/socketserver.py", line 344, in process_request self.finish_request(request, client_address) File "/usr/local/python3/lib/python3.7/socketserver.py", line 357, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/python3/lib/python3.7/socketserver.py", line 717, in init self.handle() File "/usr/local/python3/lib/python3.7/wsgiref/simple_server.py", line 133, in handle handler.run(self.server.get_app()) File "/usr/local/python3/lib/python3.7/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/wsgi.py", line 826, in call return app(environ, start_response) File "/usr/local/python3/lib/python3.7/site-packages/prometheus_client/exposition.py", line 45, in prometheus_app output = encoder(r) File "/usr/local/python3/lib/python3.7/site-packages/prometheus_client/openmetrics/exposition.py", line 14, in generate_latest for metric in registry.collect(): File "/usr/local/python3/lib/python3.7/site-packages/prometheus_client/registry.py", line 75, in collect for metric in collector.collect(): File "/usr/local/python3/lib/python3.7/site-packages/aliyun_exporter/collector.py", line 133, in collect yield from self.metric_generator(project, metric) File "/usr/local/python3/lib/python3.7/site-packages/aliyun_exporter/collector.py", line 115, in metric_generator logging.error('Error query metrics for {}{}'.format(project, metric_name), e) Message: 'Error query metrics for acs_ecs_dashboard_net_tcpconnection' Arguments: (KeyError('Datapoints'),)

git2017-jpg avatar Feb 28 '19 11:02 git2017-jpg

抱歉这么晚才注意到 问题在于响应体的 json 中没有 Datapoints 字段, 推断是阿里云那边因为限流或其他原因返回了非正常的返回体😅 下一个版本会修复这个问题, 正确打印出阿里云返回异常结果的原因

aylei avatar Mar 13 '19 14:03 aylei

For anyone who encountered the same issue: This is a bad error handling for bad responses from the Cloud Monitor API, and this will be addressed in next release hopefully.

aylei avatar Mar 13 '19 14:03 aylei

I'm facing the same issue, looking forward to the next release.

Thanks aylei!

jsimanjuntak avatar Mar 22 '19 03:03 jsimanjuntak

i have tried the newest 0.3.1 ,this problem is still there.

jinxiao avatar Apr 16 '19 08:04 jinxiao

facing the same issue,because my accesskeys no privileges to access, After I add priveleges ,everything is ok

t1ger avatar Jun 11 '19 03:06 t1ger

@t1ger Thanks for you help!

@jinxiao @jsimanjuntak @gitzh2017 I’ve addressed this issue in aylei/aliyun-exporter:0.3.2-rc, now the error handling is much more friendly. Unfortunately, I don't have aliyun resources to test my fix recently, could you please try this image again?

aylei avatar Jun 11 '19 15:06 aylei

@t1ger Thanks for you help!

@jinxiao @jsimanjuntak @gitzh2017 I’ve addressed this issue in aylei/aliyun-exporter:0.3.2-rc, now the error handling is much more friendly. Unfortunately, I don't have aliyun resources to test my fix recently, could you please try this image again?

i do it.

cai-personal avatar Jun 24 '19 07:06 cai-personal

@t1ger Thanks for you help! @jinxiao @jsimanjuntak @gitzh2017 I’ve addressed this issue in aylei/aliyun-exporter:0.3.2-rc, now the error handling is much more friendly. Unfortunately, I don't have aliyun resources to test my fix recently, could you please try this image again?

i do it.

Thanks! Could you please confirm whether the problem has been solved?

aylei avatar Jun 24 '19 09:06 aylei