aylei / aliyun-exporter

Prometheus exporter for Alibaba Cloud Monitor
Apache License 2.0
276 stars 152 forks source link

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

Open git2017-jpg opened 5 years ago

git2017-jpg commented 5 years ago

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 metricgenerator 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 metricgenerator logging.error('Error query metrics for {}{}'.format(project, metric_name), e) Message: 'Error query metrics for acs_ecs_dashboard_net_tcpconnection' Arguments: (KeyError('Datapoints'),)

aylei commented 5 years ago

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

aylei commented 5 years ago

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.

jsimanjuntak commented 5 years ago

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

Thanks aylei!

jinxiao commented 5 years ago

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

t1ger commented 5 years ago

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

aylei commented 5 years ago

@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?

cai-personal commented 5 years ago

@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.

aylei commented 5 years ago

@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?