监控中心所有有关范围查询的接口报“500”错误

Bug #1999839 reported by honglianghan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
skyline apiserver
Fix Released
Undecided
Unassigned

Bug Description

Environment
===========
version of openstack:“ussuri”
version of skyline apiserver:
                "skyline.build_commit": "a3cb40460e59279c646b65890690d90e88daa357"
                "skyline.build_console_commit": "43a001f5d85800d727e23e0f3ab09c0317a164dc"

version of OS:ubuntu18.04

Configs
=======
skyline.yaml中prometheus的配置如下
default:
  prometheus_basic_auth_password: ''
  prometheus_basic_auth_user: ''
  prometheus_enable_basic_auth: false
  prometheus_endpoint: http://127.0.0.1:9090

Steps to reproduce
==================
1.管理员登录webUI
2.切换到admin项目,进入管理平台
3.点击监控中心的监控概述和物理节点
4.发现部分监控项没有数据
5.F12打开,发现所有/api/openstack/skyline/api/v1/query_range的接口报“500”错误
6.复制黏贴查询语句到Prometheus的查询页面,正常返回OK
7.查看nginx错误日志

Logs
====
[2022-12-15 10:04:59 +0000].473 108 ERROR [-] Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 366, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 171, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 102, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 550, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 196, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 147, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/local/lib/python3.8/dist-packages/skyline_apiserver/api/v1/prometheus.py", line 189, in prometheus_query_range
    return get_prometheus_query_range_response(resp.json(), profile)
  File "/usr/local/lib/python3.8/dist-packages/skyline_apiserver/api/v1/prometheus.py", line 75, in get_prometheus_query_range_response
    result = [
  File "/usr/local/lib/python3.8/dist-packages/skyline_apiserver/api/v1/prometheus.py", line 76, in <listcomp>
    schemas.PrometheusQueryRangeResult(metric=i["metric"], values=i["values"])
  File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for PrometheusQueryRangeResult
value
  field required (type=value_error.missing)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to skyline-apiserver (master)
Changed in skyline-apiserver:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to skyline-apiserver (master)

Reviewed: https://review.opendev.org/c/openstack/skyline-apiserver/+/868152
Committed: https://opendev.org/openstack/skyline-apiserver/commit/7f363390c86fc3f4acb464c1d2d3ce74013b5148
Submitter: "Zuul (22348)"
Branch: master

commit 7f363390c86fc3f4acb464c1d2d3ce74013b5148
Author: yangshaoxue <yang.shaoxue@99cloud.net>
Date: Tue Dec 20 11:46:10 2022 +0800

    fix: prometheus response 500

    API /query_range always report 500 error

    Bug: 1999839
    Change-Id: I66a152c2c76d4984cc2fbf085e8c2d1da3701ece

Changed in skyline-apiserver:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.