Skip to content

Conversation

@zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented May 27, 2025

Possible fix for #1907

@otelbot-java-contrib
Copy link
Contributor

🔧 The result from spotlessApply was committed to the PR branch.

* @throws IOException if the delegate ToDiskExporter could not be created.
*/
@Deprecated
public static SpanToDiskExporter create(SpanExporter delegate, StorageConfiguration config)
Copy link
Contributor

Choose a reason for hiding this comment

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

We've previously added breaking changes without adding deprecations, because this tool isn't stable yet, if you think it's worth doing so, I'm fine with it. However, I think it should be fine to just change the signature here to replace StorageConfiguration by Storage for now.

Copy link
Member 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.

Makes sense 👍 I think the getBody() one was causing issues before because it's defined upstream (maybe those are sorted now), but apart from that, I don't see why we should keep deprecated methods for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@zeitlinger zeitlinger marked this pull request as ready for review May 27, 2025 09:43
@zeitlinger zeitlinger requested a review from a team May 27, 2025 09:43
@zeitlinger
Copy link
Member Author

@LikeTheSalad please review

throws IOException {
FromDiskExporterImpl<LogRecordData> delegate =
FromDiskExporterImpl.<LogRecordData>builder()
.setFolderName(SignalTypes.logs.name())
Copy link
Contributor

Choose a reason for hiding this comment

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

It's been a while since I worked on this, so apologies because I didn't notice it earlier, though I just recalled that each signal's set of files needs to be in its own folder, separated from other signal files, and that's why this property was set, and also why we needed a storage object per signal. I know from a first glance it looks strange, as I also was confused for a moment, and I think it's because the current architecture is not straightforward. I'm planning to work on enhancing it soon to make it cleaner, but for now, I'm afraid that if we merge these changes, it can cause issues, especially around serialization.

In theory, we could share the same storage object across a single signal's ToDiskExporter and FromDiskExporter objects, however, those are instantiated independently by the consumer, so to make it work we would have to create some sort of factory that focuses on providing both ToDiskExporter and FromDiskExporter instances for a single signal where we would internally ensure that the same storage object is used. And then we would have to make these create methods package private to prevent users from calling them, so that they don't provide the wrong storage object. Though I'm not sure if that would add much value compared to the current way of using the lib.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point - I changed the PR so that the storage builder takes the signal type as an argument.
This should make clear that the storage should not be used across signal types.

Copy link
Contributor

@LikeTheSalad LikeTheSalad left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

exportedFnSeen = x;
return exportFnResultToReturn.get();
};
toDiskExporter = new ToDiskExporter<>(serializer, exportFn, storage, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be a small thing but I really like when a boolean parameter is removed, cheers!

@trask trask added this pull request to the merge queue May 28, 2025
Merged via the queue into open-telemetry:main with commit f597cbe May 28, 2025
19 checks passed
@zeitlinger zeitlinger deleted the shared-storage branch June 2, 2025 10:40
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