Skip to content

Attribute expressions #128

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

Merged
merged 9 commits into from
Jan 10, 2022
Merged

Attribute expressions #128

merged 9 commits into from
Jan 10, 2022

Conversation

aaron-steinfeld
Copy link
Contributor

@aaron-steinfeld aaron-steinfeld commented Jan 7, 2022

Description

Add support to GQL for receiving and writing attribute Expressions. Part of hypertrace/hypertrace-ui#1099

Dependent on hypertrace/hypertrace-core-graphql#91 (done)

Testing

Updated UTs and manual E2E verification

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@aaron-steinfeld aaron-steinfeld requested a review from a team as a code owner January 7, 2022 01:13
@codecov
Copy link

codecov bot commented Jan 7, 2022

Codecov Report

Merging #128 (7fea23a) into main (330cb6d) will decrease coverage by 0.24%.
The diff coverage is 11.36%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #128      +/-   ##
============================================
- Coverage     23.05%   22.80%   -0.25%     
  Complexity       75       75              
============================================
  Files            65       65              
  Lines          1683     1732      +49     
  Branches         52       51       -1     
============================================
+ Hits            388      395       +7     
- Misses         1286     1328      +42     
  Partials          9        9              
Flag Coverage Δ
unit 22.80% <11.36%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...hypertrace/graphql/entity/dao/EntityDaoModule.java 0.00% <0.00%> (ø)
...e/graphql/entity/dao/EntityNeighborMapFetcher.java 0.00% <0.00%> (ø)
...phql/entity/dao/GatewayServiceEntityConverter.java 0.00% <0.00%> (ø)
...ce/graphql/entity/dao/GatewayServiceEntityDao.java 0.00% <0.00%> (ø)
...ql/entity/dao/GatewayServiceEntityEdgeFetcher.java 0.00% <0.00%> (ø)
...ty/dao/GatewayServiceEntityEdgeTableConverter.java 0.00% <0.00%> (ø)
...GatewayServiceEntityInteractionRequestBuilder.java 0.00% <0.00%> (ø)
...ace/graphql/entity/request/EdgeRequestBuilder.java 0.00% <0.00%> (ø)
...entity/request/NeighborEntitiesRequestBuilder.java 0.00% <0.00%> (ø)
...lorer/dao/GatewayServiceSelectionMapConverter.java 0.00% <0.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 330cb6d...7fea23a. Read the comment docs.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@@ -73,13 +76,15 @@
GraphQlRequestContext context = request.resultSetRequest().context();
return this.requestBuilder
.buildRequest(request)
.doOnSuccess(built -> log.warn(JsonFormat.printer().print(built)))
Copy link
Contributor

Choose a reason for hiding this comment

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

should we go with debug - log.debug?

Copy link
Contributor Author

@aaron-steinfeld aaron-steinfeld Jan 7, 2022

Choose a reason for hiding this comment

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

thanks - will strip this, it was only for debugging. Thought I had removed it, but I forgot to check in the removal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

.subscribeOn(this.boundedIoScheduler)
.flatMap(serverRequest -> this.fetchAndMapEntities(context, request, serverRequest));
}

private Single<EntityResultSet> fetchAndMapEntities(
GraphQlRequestContext context, EntityRequest request, EntitiesRequest serverRequest) {
return this.makeEntityRequest(context, serverRequest)
.doOnSuccess(built -> log.warn(JsonFormat.printer().print(built)))
Copy link
Contributor

Choose a reason for hiding this comment

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

here also should we move to log.debug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed entirely

return convertForArgsButNoAlias(attribute, aggregationType, Collections.emptyList());
AttributeAssociation<AttributeExpression> attributeExpression,
AttributeModelMetricAggregationType aggregationType) {
return convertForArgsButNoAlias(attributeExpression, aggregationType, Collections.emptyList());
Copy link
Contributor

Choose a reason for hiding this comment

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

while reading I had to look for type, so would attributeAssociation would have been a better argument name?
AttributeAssociation<AttributeExpression> attributeExpression -> AttributeAssociation<AttributeExpression> attributeAssociation?

If, we change, the same thing for appropriate places in other files too. If, we keep the same, it's fine too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah this naming's tricky. AttributeAssociation is really just a wrapper to materialize an attribute reference on another thing, attribute expression is the kernel of data that's more relevant. So I could call it attributeExpressionAssociation if you think that'd be clearer?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think, that would be better - attributeExpressionAssociation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, that likely goes into the core code as well so will do that pass starting 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe there were many files, it was really hard what is what attributeExpressionAssociation or attributeExpression, but, it more clear to me. Thanks a lot for making this change.
Reviewed - hypertrace/hypertrace-core-graphql#92

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Merged and updated in this PR

}

private MetricAggregationRequest requestForAggregationField(
AttributeModel attribute, SelectedField field) {
AttributeAssociation<AttributeExpression> attributeExpression, SelectedField field) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I still think attributeExpression -> attributeAssociation would be more readable. It is getting confused with actual AttributeExpression and association with the model while reading. What do you think - should we rename?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

BaselinedMetricAggregationContainer metric(
@GraphQLName(MetricKeyArgument.ARGUMENT_NAME) @GraphQLNonNull String key);
default BaselinedMetricAggregationContainer metric(
@GraphQLName(MetricKeyArgument.ARGUMENT_NAME) @Nullable String key,
Copy link
Contributor

Choose a reason for hiding this comment

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

will this @Nullable String key be deprecated later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, exactly

@kotharironak
Copy link
Contributor

lgtm, minor nit comments

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

kotharironak
kotharironak previously approved these changes Jan 7, 2022
Copy link
Contributor

@kotharironak kotharironak left a comment

Choose a reason for hiding this comment

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

overall, lgtm. Have only minor comments for renaming to attributeExpressionAssociation, which we can handle as a follow-up.

@github-actions

This comment has been minimized.

Copy link
Contributor

@kotharironak kotharironak left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of the comments.

@aaron-steinfeld aaron-steinfeld merged commit 317440b into main Jan 10, 2022
@aaron-steinfeld aaron-steinfeld deleted the attribute-expressions branch January 10, 2022 13:17
@github-actions
Copy link

Unit Test Results

11 files  ±0  11 suites  ±0   15s ⏱️ +3s
24 tests ±0  24 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 317440b. ± Comparison against base commit 330cb6d.

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