openrca / orca-ui

Web UI for OpenRCA
https://openrca.io
Apache License 2.0
33 stars 4 forks source link

Invalid integer for time point in graph query #181

Closed bzurkowski closed 3 years ago

bzurkowski commented 3 years ago

The UI performs the following request to obtain the graph from API:

http://localhost:8080/apiv1/graph/?time_point=1627941651.925

The request results with 500 Internal Server Error due to invalid time_point format:

21:59:40 api.1   | Traceback (most recent call last):
21:59:40 api.1   |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
21:59:40 api.1   |     rv = self.dispatch_request()
21:59:40 api.1   |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
21:59:40 api.1   |     return self.view_functions[rule.endpoint](**req.view_args)
21:59:40 api.1   |   File "/usr/local/lib/python3.7/site-packages/flask_restx/api.py", line 375, in wrapper
21:59:40 api.1   |     resp = resource(*args, **kwargs)
21:59:40 api.1   |   File "/usr/local/lib/python3.7/site-packages/flask/views.py", line 89, in view
21:59:40 api.1   |     return self.dispatch_request(*args, **kwargs)
21:59:40 api.1   |   File "/usr/local/lib/python3.7/site-packages/flask_restx/resource.py", line 44, in dispatch_request
21:59:40 api.1   |     resp = meth(*args, **kwargs)
21:59:40 api.1   |   File "/usr/local/lib/python3.7/site-packages/orca/api/apis/v1/graph.py", line 29, in get
21:59:40 api.1   |     query = query_schema.load(request.args)
21:59:40 api.1   |   File "/usr/local/lib/python3.7/site-packages/marshmallow/schema.py", line 724, in load
21:59:40 api.1   |     data, many=many, partial=partial, unknown=unknown, postprocess=True
21:59:40 api.1   |   File "/usr/local/lib/python3.7/site-packages/marshmallow/schema.py", line 905, in _do_load
21:59:40 api.1   |     raise exc
21:59:40 api.1   | marshmallow.exceptions.ValidationError: {'time_point': ['Not a valid integer.']}

The candidate root cause is this line:

export class Graph extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      ...
      timestamp: new Date().getTime()/1000
    };