Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

indexing status server #18

Merged
merged 4 commits into from
Aug 3, 2023
Merged

indexing status server #18

merged 4 commits into from
Aug 3, 2023

Conversation

hopeyen
Copy link
Owner

@hopeyen hopeyen commented Jul 31, 2023

  • Routes indexing status queries to graph node status endpoint without additional processing
  • Fixes query parsing for indexing subgraph and network subgraph queries (remove double parsing of the request)
  • Utilizes .toml file parsing for configurations, added example template.toml file
  • Adds graceful shutdown
  • Adds supported request examples in readme
  • Cleans unused dependencies

Resolves #7

Follow up issue #17 to complete the feature


I will try to split these up into smaller PRs in the future, kinda got carried away just doing things this time

@hopeyen hopeyen force-pushed the hope/indexing-status-server branch 2 times, most recently from df825d2 to 9a12b9f Compare July 31, 2023 12:34
@github-actions
Copy link

github-actions bot commented Jul 31, 2023

Pull Request Test Coverage Report for Build 5739883496

  • 0 of 184 (0.0%) changed or added relevant lines in 8 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage remained the same at 0.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
service/src/config.rs 0 8 0.0%
service/src/main.rs 0 8 0.0%
service/src/server/routes/network.rs 0 11 0.0%
service/src/util.rs 0 18 0.0%
service/src/server/routes/status.rs 0 19 0.0%
service/src/server/routes/subgraphs.rs 0 22 0.0%
service/src/server/routes/mod.rs 0 25 0.0%
service/src/common/indexer_error.rs 0 73 0.0%
Files with Coverage Reduction New Missed Lines %
service/src/server/routes/subgraphs.rs 1 0%
Totals Coverage Status
Change from base Build 5647904549: 0.0%
Covered Lines: 0
Relevant Lines: 1163

💛 - Coveralls

@hopeyen hopeyen force-pushed the hope/indexing-status-server branch from 9a12b9f to 8bbbfd6 Compare July 31, 2023 12:40
@hopeyen hopeyen force-pushed the hope/indexing-status-server branch from 8bbbfd6 to 40120df Compare July 31, 2023 12:41
@hopeyen hopeyen force-pushed the hope/indexing-status-server branch from 40120df to 9007d62 Compare July 31, 2023 12:48
@hopeyen hopeyen requested a review from aasseman July 31, 2023 13:16
service/src/main.rs Outdated Show resolved Hide resolved
service/src/server/routes/network.rs Outdated Show resolved Hide resolved
Comment on lines 55 to 69
let query: Bytes = hyper::body::to_bytes(req.into_body())
.await
.map_err(|e| {
(
StatusCode::BAD_REQUEST,
axum::response::AppendHeaders([
(axum::http::header::CONTENT_TYPE, "application/json"),
(HeaderName::from_static("graph-attestable"), "false"),
]),
Json(e),
)
})
.unwrap();
let query_string = String::from_utf8_lossy(&query);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't you want to actually respond with the error, instead of panicking and printing the HTTP response?

Copy link
Collaborator

Choose a reason for hiding this comment

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

.unwrap()s are still there, and will halt the program instead or returning an error HTTP response, or is there something I am misunderstanding?

Copy link
Owner Author

Choose a reason for hiding this comment

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

You are right that the program will not return an HTTP response, it will just return curl: (52) Empty reply from server if I do a simple curl with malformed query.
I was trying to avoid the long match/combinator statements, but now I've refactored so that program will return an error HTTP response, think it is much better:)
like this

"Indexer error: IE075, explanation: Failed to parse response body to query string, cause: IndexerErrorCause(FromUtf8Error { bytes: [240, 159, 144], error: Utf8Error { valid_up_to: 0, error_len: None } })

Note: this now outdated iteration of resolver function will indeed lead to a panick thread, but the program will not halt. The server would log something like below and continue serving future requests

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: (400, Json(FromUtf8Error { bytes: [240, 159, 144], error: Utf8Error { valid_up_to: 0, error_len: None } }))', service/src/server/routes/subgraphs.rs:71:10

service/src/config.rs Outdated Show resolved Hide resolved
@hopeyen hopeyen requested a review from aasseman August 1, 2023 21:29
@hopeyen hopeyen self-assigned this Aug 1, 2023
@hopeyen hopeyen added the enhancement New feature or request label Aug 1, 2023
@hopeyen hopeyen force-pushed the hope/indexing-status-server branch from 73170f5 to 5af7190 Compare August 2, 2023 14:08
@hopeyen hopeyen merged commit c604c7a into main Aug 3, 2023
3 checks passed
@hopeyen hopeyen deleted the hope/indexing-status-server branch August 3, 2023 12:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: Indexing Status server
2 participants