Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adding additional logs to get original request in case of failure #198

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
return this.requestBuilder
.buildRequest(request)
.subscribeOn(this.boundedIoScheduler)
.flatMap(serverRequest -> this.fetchAndMapEntities(context, request, serverRequest));
.flatMap(serverRequest -> this.fetchAndMapEntities(context, request, serverRequest))
.doOnError(error -> log.error("Error while handling entities request {}", request, error));

Check warning on line 88 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java#L87-L88

Added lines #L87 - L88 were not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

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

Have GW handle this (if it throws, it should include the details of what failed as well as logging it locally). At this layer, the only relevant logging would be a debug log on a successful received response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GW logs the request. However I am looking for original request received by the graphql.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense to log, but this isn't it - this is already an intermediate state, the result of the gql request processing. Ideally we should have the global gql error handler do such logging (we may need to do a bit of work to get to the initial request there).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Best to have a global error handler that logs original request on failure.

}

private Single<EntityResultSet> fetchAndMapEntities(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.reactivex.rxjava3.core.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import org.hypertrace.core.graphql.context.GraphQlRequestContext;
import org.hypertrace.core.graphql.request.transformation.RequestTransformer;
import org.hypertrace.core.graphql.rx.BoundedIoScheduler;
Expand All @@ -19,6 +20,7 @@
import org.hypertrace.graphql.explorer.request.ExploreRequest;
import org.hypertrace.graphql.explorer.schema.ExploreResultSet;

@Slf4j

Check warning on line 23 in hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/dao/GatewayServiceExplorerDao.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/dao/GatewayServiceExplorerDao.java#L23

Added line #L23 was not covered by tests
@Singleton
class GatewayServiceExplorerDao implements ExplorerDao {
private final GatewayServiceFutureStub gatewayServiceStub;
Expand Down Expand Up @@ -60,7 +62,8 @@
.flatMap(this.requestBuilder::buildRequest)
.subscribeOn(this.boundedIoScheduler)
.flatMap(serverRequest -> this.makeRequest(request.context(), serverRequest))
.flatMap(serverResponse -> this.responseConverter.convert(request, serverResponse));
.flatMap(serverResponse -> this.responseConverter.convert(request, serverResponse))
.doOnError(error -> log.error("Error while handling explore request {}", request, error));

Check warning on line 66 in hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/dao/GatewayServiceExplorerDao.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/dao/GatewayServiceExplorerDao.java#L65-L66

Added lines #L65 - L66 were not covered by tests
}

private Single<ExploreResponse> makeRequest(
Expand Down