Skip to content

Safiefy protobuf#2477

Merged
purew merged 6 commits intomasterfrom
safiefy-protobuf
Jul 20, 2020
Merged

Safiefy protobuf#2477
purew merged 6 commits intomasterfrom
safiefy-protobuf

Conversation

@purew
Copy link
Copy Markdown
Contributor

@purew purew commented Jul 17, 2020

PR adds checks on protobuf serializing and de-serializing in the worker, and logs request-id of failing requests.

Produces log:

2020/07/17 18:31:10.483608 [INFO] Got Loki Request 0
2020/07/17 18:31:10.486783 [ANALYTICS] locations_count::2
2020/07/17 18:31:10.486822 [ANALYTICS] costing_type::auto
2020/07/17 18:31:10.486859 [ANALYTICS] total_location_distance::7.487539km
2020/07/17 18:31:10.622645 [INFO] Got Thor Request 0
2020/07/17 18:31:10.622708 [ERROR] Failed parsing pbf in Thor::Worker
2020/07/17 18:31:10.622739 [ANALYTICS] 400::Failed parsing pbf in Thor::Worker request_id=0
0 2020/07/17 18:31:10.622851 400 239

@purew purew requested review from danpaz and gknisely July 17, 2020 18:34
Comment thread src/thor/worker.cc Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's likely a bit unoptimized to allocate the string every time but it should still be very little work in comparison to actually running pathfinding or mapmatching or similar.

Comment thread src/thor/worker.cc Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is valhalla_exception_t appropriate here instead of std::runtime_error?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at other exceptions thrown here, seems like valhalla_exception_t is the right choice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye, removed the runtime error for valhalla_exception_t

purew added 3 commits July 17, 2020 14:40
Example log:

```
2020/07/17 18:31:10.483608 [INFO] Got Loki Request 0
2020/07/17 18:31:10.486783 [ANALYTICS] locations_count::2
2020/07/17 18:31:10.486822 [ANALYTICS] costing_type::auto
2020/07/17 18:31:10.486859 [ANALYTICS] total_location_distance::7.487539km
2020/07/17 18:31:10.622645 [INFO] Got Thor Request 0
2020/07/17 18:31:10.622708 [ERROR] Failed parsing pbf in Thor::Worker
2020/07/17 18:31:10.622739 [ANALYTICS] 400::Failed parsing pbf in Thor::Worker request_id=0
0 2020/07/17 18:31:10.622851 400 239
```
@purew purew force-pushed the safiefy-protobuf branch from 78613b7 to d4317ca Compare July 17, 2020 18:40
Comment thread src/thor/worker.cc
std::string serialize_to_pbf(Api& request) {
std::string buf;
if (!request.SerializeToString(&buf)) {
LOG_ERROR("Failed serializing to pbf in Thor::Worker - trace_route");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're calling this helper from optimized_route, route & trace_route. So maybe we can be remove the trace_route part of the error message since it could be generated for other options.

mandeepsandhu
mandeepsandhu previously approved these changes Jul 17, 2020
Copy link
Copy Markdown
Contributor

@mandeepsandhu mandeepsandhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 1 minor comment. Otherwise looks good to me 👍

@purew purew force-pushed the safiefy-protobuf branch from 3d54dab to 13c5a9c Compare July 17, 2020 19:38
@danpaz
Copy link
Copy Markdown
Collaborator

danpaz commented Jul 20, 2020

Pushed an update to the osrm error message for the 401 valhalla exception 6037949

@purew purew merged commit ff06cdb into master Jul 20, 2020
@purew purew deleted the safiefy-protobuf branch July 20, 2020 16:26
@purew purew added this to the Sprint 14 - Left Turn milestone Jul 20, 2020
yuzheyan added a commit that referenced this pull request Jul 28, 2020
* 'master' of github.com:valhalla/valhalla:
  Make tile building reproducible (#2480)
  Fix install-script for ubuntu 18.04 (#2306) (#2486)
  nit(git): Configures changelog to resolve conflicts with union strategy (#2489)
  feat(traffictile.h): Adds versioning checks (#2484)
  Fix dereferencing of end for std::lower_bound and possible UB (#2488)
  Minor fixes to tests (#2483)
  nit: Missing changelog entry (#2478)
  Safiefy protobuf (#2477)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants