remove rx in entity span enricher resolution#439
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #439 +/- ##
============================================
- Coverage 79.93% 79.87% -0.06%
+ Complexity 1421 1413 -8
============================================
Files 128 127 -1
Lines 5566 5551 -15
Branches 509 515 +6
============================================
- Hits 4449 4434 -15
+ Misses 885 879 -6
- Partials 232 238 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Blocked on fixing gradle issue on consuming attribute service which has ht bom. Looks like we need to migrate to gradle 8+ at least for fix if not complete bom, but if we're doing that might as well take care of bom cc @mihirgt |
Even if we want to the bom now, I'd do gradle 8 first anyway. That should only take a few min. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| private static final String ATTRIBUTE_SERVICE_HOST_KEY = "attribute.service.config.host"; | ||
| private static final String ATTRIBUTE_SERVICE_PORT_KEY = "attribute.service.config.port"; | ||
| private static final String ATTRIBUTE_SERVICE_CONFIG_KEY = "attribute.service.config"; | ||
| private static final String ATTRIBUTE_SERVICE_HOST_KEY = ATTRIBUTE_SERVICE_CONFIG_KEY + ".host"; |
There was a problem hiding this comment.
are host/port still used directly?
There was a problem hiding this comment.
They're used to build channel
this.attributeServiceChannel =
this.buildChannel(
config.getString(ATTRIBUTE_SERVICE_HOST_KEY),
config.getInt(ATTRIBUTE_SERVICE_PORT_KEY));There was a problem hiding this comment.
Ah I thought that went away since you removed the getter and are passing in the raw config to the client. I wonder if passing in the registry would be better so it can read the channel config in the same way? Oh well, doesn't really matter - only thing I would suggest in this case would be to remove the instance variable for channel since now it's only used locally in creating the cached client.
| .filter(Optional::isPresent) | ||
| .findFirst() | ||
| .flatMap(Function.identity()); |
There was a problem hiding this comment.
if I'm reading this correctly you've got a resolution that can return an optional and you're just trying to get the first value present, if it exists. If so, suggest:
| .filter(Optional::isPresent) | |
| .findFirst() | |
| .flatMap(Function.identity()); | |
| .flatMap(Optional::stream) | |
| .findFirst(); |
| return new UnsupportedOperationException(String.format(message, args)); | ||
| }); | ||
| Stream<Optional<LiteralValue>> resolvedArguments = | ||
| arguments.stream().map(argument -> this.resolveProjection(valueSource, argument)); |
There was a problem hiding this comment.
If this is the only place we're using it and we don't support it return empty, why not just throw? You're eventually throwing anyway, you're just going through an extra level of indirection. If your goal is to completely avoid the throw, collect to list (use flatmap to optional stream) and just compare size before returning.
| attributeMetadataList.stream() | ||
| .filter(this::isEntitySourced) | ||
| .map(attributeMetadata -> this.resolveAttribute(attributeMetadata, trace, span)) | ||
| .filter(Optional::isPresent) |
There was a problem hiding this comment.
optional stream again (there's always a better alternative for optional.get - even if it's just optional.orElseThrow - so always be wary when you find yourself pulled to it)
There was a problem hiding this comment.
Thanks, wasn't aware of this neat trick with flatMap(Optional::stream)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| private static final String ATTRIBUTE_SERVICE_HOST_KEY = "attribute.service.config.host"; | ||
| private static final String ATTRIBUTE_SERVICE_PORT_KEY = "attribute.service.config.port"; | ||
| private static final String ATTRIBUTE_SERVICE_CONFIG_KEY = "attribute.service.config"; | ||
| private static final String ATTRIBUTE_SERVICE_HOST_KEY = ATTRIBUTE_SERVICE_CONFIG_KEY + ".host"; |
There was a problem hiding this comment.
Ah I thought that went away since you removed the getter and are passing in the raw config to the client. I wonder if passing in the registry would be better so it can read the channel config in the same way? Oh well, doesn't really matter - only thing I would suggest in this case would be to remove the instance variable for channel since now it's only used locally in creating the cached client.
No description provided.