-
Notifications
You must be signed in to change notification settings - Fork 4
feat: adding consumer support for new traces/spans api #140
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
Changes from 1 commit
310b0c6
ff3363a
a4cab36
8c60115
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,27 +15,40 @@ | |
| import org.hypertrace.core.graphql.common.request.ResultSetRequest; | ||
| import org.hypertrace.core.graphql.common.request.ResultSetRequestBuilder; | ||
| import org.hypertrace.core.graphql.common.schema.attributes.arguments.AttributeExpression; | ||
| import org.hypertrace.core.graphql.common.schema.results.ResultSet; | ||
| import org.hypertrace.core.graphql.common.schema.results.arguments.order.OrderArgument; | ||
| import org.hypertrace.core.graphql.context.GraphQlRequestContext; | ||
| import org.hypertrace.core.graphql.utils.schema.GraphQlSelectionFinder; | ||
| import org.hypertrace.core.graphql.utils.schema.SelectionQuery; | ||
|
|
||
| class DefaultSpanRequestBuilder implements SpanRequestBuilder { | ||
|
|
||
| private final ResultSetRequestBuilder resultSetRequestBuilder; | ||
| private final LogEventAttributeRequestBuilder logEventAttributeRequestBuilder; | ||
| private final GraphQlSelectionFinder selectionFinder; | ||
|
|
||
| @Inject | ||
| public DefaultSpanRequestBuilder( | ||
| ResultSetRequestBuilder resultSetRequestBuilder, | ||
| LogEventAttributeRequestBuilder logEventAttributeRequestBuilder) { | ||
| LogEventAttributeRequestBuilder logEventAttributeRequestBuilder, | ||
| GraphQlSelectionFinder selectionFinder) { | ||
| this.resultSetRequestBuilder = resultSetRequestBuilder; | ||
| this.logEventAttributeRequestBuilder = logEventAttributeRequestBuilder; | ||
| this.selectionFinder = selectionFinder; | ||
| } | ||
|
|
||
| @Override | ||
| public Single<SpanRequest> build( | ||
| GraphQlRequestContext context, | ||
| Map<String, Object> arguments, | ||
| DataFetchingFieldSelectionSet selectionSet) { | ||
| boolean fetchTotal = | ||
| this.selectionFinder | ||
| .findSelections( | ||
| selectionSet, SelectionQuery.namedChild(ResultSet.RESULT_SET_TOTAL_NAME)) | ||
| .count() | ||
| > 0; | ||
|
|
||
| return zip( | ||
| resultSetRequestBuilder.build( | ||
| context, | ||
|
|
@@ -45,7 +58,8 @@ public Single<SpanRequest> build( | |
| OrderArgument.class), | ||
| logEventAttributeRequestBuilder.buildAttributeRequest(context, selectionSet), | ||
| (resultSetRequest, logEventAttributeRequest) -> | ||
| new DefaultSpanRequest(context, resultSetRequest, logEventAttributeRequest)); | ||
| new DefaultSpanRequest( | ||
| context, resultSetRequest, logEventAttributeRequest, fetchTotal)); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -54,12 +68,13 @@ public Single<SpanRequest> build( | |
| Map<String, Object> arguments, | ||
| List<AttributeExpression> spanAttributeExpressions, | ||
| List<AttributeExpression> logAttributeExpressions) { | ||
|
|
||
| return zip( | ||
| resultSetRequestBuilder.build( | ||
| context, HypertraceCoreAttributeScopeString.SPAN, arguments, spanAttributeExpressions), | ||
| logEventAttributeRequestBuilder.buildAttributeRequest(context, logAttributeExpressions), | ||
| (resultSetRequest, logEventAttributeRequest) -> | ||
| new DefaultSpanRequest(context, resultSetRequest, logEventAttributeRequest)); | ||
| new DefaultSpanRequest(context, resultSetRequest, logEventAttributeRequest, false)); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is used via ExportSpans API, and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We can add it as a comment to explain why fetchTotal is set to false here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| } | ||
|
|
||
| @Value | ||
|
|
@@ -68,5 +83,6 @@ private static class DefaultSpanRequest implements SpanRequest { | |
| GraphQlRequestContext context; | ||
| ResultSetRequest<OrderArgument> spanEventsRequest; | ||
| Collection<AttributeRequest> logEventAttributes; | ||
| boolean fetchTotal; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once I merged the gateway-service PR and cut the release, will update the appropriate version here.