-
Notifications
You must be signed in to change notification settings - Fork 929
Add block import tracer provider to plugin-api #8534
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
Add block import tracer provider to plugin-api #8534
Conversation
026f2e5
to
10ca621
Compare
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.
LGTM, please add a CHANGELOG entry
// if we have a BlockImportTracerProvider from pluginContext, use it. | ||
return Optional.ofNullable(pluginContext) | ||
.flatMap(serviceManager -> serviceManager.getService(BlockImportTracerProvider.class)) | ||
.map(z -> z.getBlockImportTracer(header)) | ||
// otherwise return NO_TRACING | ||
.orElse(BlockAwareOperationTracer.NO_TRACING); |
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.
not blocking: can the resolution of the tracer to use be done only once since I assume the tracer will not change?
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.
I wanted to do this in the constructor, but we are not providing a protocol context in the constructor. The lookup is pretty cheap, but I will look again to see how much plumbing it would be to require a protocol context in the constructor
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.
I see, if it is not straight forward it could stay like that or just use a memoizing supplier
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.
CHANGELOG entry missing
// if we have a BlockImportTracerProvider from pluginContext, use it. | ||
return Optional.ofNullable(pluginContext) | ||
.flatMap(serviceManager -> serviceManager.getService(BlockImportTracerProvider.class)) | ||
.map(z -> z.getBlockImportTracer(header)) | ||
// otherwise return NO_TRACING | ||
.orElse(BlockAwareOperationTracer.NO_TRACING); |
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.
I see, if it is not straight forward it could stay like that or just use a memoizing supplier
Ah yes, a memoizing supplier would be 👍 |
Signed-off-by: garyschulte <[email protected]>
Signed-off-by: garyschulte <[email protected]>
Signed-off-by: garyschulte <[email protected]>
…onTracer is not part of plugin-api Signed-off-by: garyschulte <[email protected]>
Signed-off-by: garyschulte <[email protected]>
Signed-off-by: garyschulte <[email protected]>
10ca621
to
0e220bd
Compare
PR description
Adds the ability to specify a default tracer to AbstractBlockProcessor, so imported blocks may implement tracing.
Fixed Issue(s)
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew spotlessApply
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests