Repository navigation
Rework lettuce reactive client instrumentation - #3049
Merged
Merged
Conversation
jbachorik
force-pushed
the
jb/lettuce_checkpoints
branch
from
September 13, 2021 10:38
910c136 to
992816a
Compare
jbachorik
force-pushed
the
jb/lettuce_checkpoints
branch
from
September 15, 2021 16:14
992816a to
1dc4b5f
Compare
jbachorik
force-pushed
the
jb/lettuce_checkpoints
branch
from
September 20, 2021 10:25
d6e5a32 to
c46aea3
Compare
…'checksum' method from ConsumerRecord (#3080)
devinsba
reviewed
Sep 20, 2021
Contributor
|
This looks good to me. I think we might want to generalize some of this into the reactor instrumentation at some point but I like starting with the more specific instrumentation here |
…oke-test Add resource to RabbitMQ smoke test
…trace/instrumentation/lettuce5/LettuceReactiveClientInstrumentation.java Co-authored-by: Brian Devins-Suresh <brian.devinssuresh@datadoghq.com>
jbachorik
marked this pull request as ready for review
September 21, 2021 09:27
* Add dd.jms.legacy.tracing.enabled system property (default to true) * Add structures to track batch JMS messages * Track time-in-queue spans per-session-thread * Cleanup active scopes and time-in-queue spans on every session commit/rollback/ack/close * Finish time-in-queue spans on each receive/onMessage (for auto-ack) or when closing consumer * Support inject/extract of batch id and produced time * Assign ids to message batches * Inject produce time and extract it into a time-in-queue span when consuming * Use configured serviceName * Only expose batch-state to producers * Test time-in-queue generation * Test batch time-in-queue generation * Handle WebLogic JMS destinations which mix all APIs (Queue/Topic/Temporary...) in the same type * Use current context's service name on producer side, while using configured service name on consumer side * Widen JMS WebLogic check to cover both DestinationImpl and DistributedDestinationImpl * Expand explanation of WebLogic handling * Evict entries by age if can't evict by liveliness
* Order correctly the expected and actual for assertEquals * Enable OldObjectSample by default in dd.jfp That is to bring the the Heap Profiler to GA for Java.
devinsba
reviewed
Sep 21, 2021
devinsba
approved these changes
Sep 21, 2021
devinsba
left a comment
Contributor
There was a problem hiding this comment.
Looks good once you delete the advice that isn't used
…at are only ever used synchronously and could be re-used. (#3087) Turning off async propagation for `TransactionBroker.beginTransaction` stops those `FutureTask` instances from being captured when the transaction is constructed and results in better checkpoints for ActiveMQ (we can't exclude these instances by type because their type is `FutureTask`, ie. they don't extend it.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Lettuce reactive client is based on Reactive Streams
The whole command execution process is driven by an associated
io.lettuce.core.RedisPublisher#RedisSubscriptioninstance which creates areactor.core.publisher.Mono(for a singleton command) orreactor.core.publisher.Flux(for a command set) instance.Once the subscription is created the client will subscribe to it and by doing this will trigger the reactive command processing.
As a part of the subscription process a special
io.lettuce.core.RedisPublisher.SubscriptionCommandwrapper command instance is created which will be handed over for transmission to Redis inio.lettuce.core.RedisPublisher.RedisSubscription#dispatchCommand()method. At exactly this point the associated span can be marked for migration as the Redis response (if any) may be processed by a different thread.When the response is received back from Redis server the subscription command is connected with the incoming data and
io.lettuce.core.RedisPublisher.SubscriptionCommand#complete()method is invoked to start processing the response. At this point the command span migration can be finalized as the span processing resumes on this particular thread.When it is a set of commands that is being executed we want to have the information about the number of processed commands - this can be achieved by hooking into
io.lettuce.core.RedisPublisher.RedisSubscription#onNext(Object)method, incrementing the tracked count until the associated subscription command has been cancelled. In order to propagate the parent span active at the time of issuing the Redis command it is necessary to instrumentio.lettuce.core.AbstractRedisReactiveCommands, intercepting allcreateMonoandcreate*Fluxmethods - capturing the parent span whenreactor.core.publisher.Monoorreactor.core.publisher.Fluxinstance is created and reactivating each time they are subscribed.