question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reactor decorator added too late

See original GitHub issue

Hello,

We are trying to replace Spring Clould Sleuth by your opentracing solution. In general, it works mostly fine šŸ‘ Thanks a lot for the great work!

However, we have encountered an edge case when Reactor schedulers might not be decorated with TracedScheduledExecutorService, even if the lambda is added by ReactorTracingAutoConfiguration.

To be able to easily explain the problem, I forked your repo and modified a bit the test: https://github.com/chengchen/java-spring-cloud/blob/0.2.5-CJI/instrument-starters/opentracing-spring-cloud-reactor-starter/src/test/java/io/opentracing/contrib/spring/cloud/reactor/ReactorTracingAutoConfigurationTest.java

With your current implementation, the Reactor schedulers won’t be decorated and thus a failing test. This is because Schedulers.parallel() is already initialized / cached in TestController before ReactorTracingAutoConfiguration adding the decorator. Unless you restart the parallel scheduler and discard the cached reference, this cached one will always be there without the ability to propagate tracing infos. This issue is partially related to how Reactor schedulers are designed… (and we can not control how / when users would call Schedulers.parallel())

I took a look at how it’s done in Sleuth, and try to do the similar way, it seems to work for our use cases: https://github.com/chengchen/java-spring-cloud/blob/0.2.5-CJI/instrument-starters/opentracing-spring-cloud-reactor-starter/src/main/java/io/opentracing/contrib/spring/cloud/reactor/ReactorTracingAutoConfiguration.java

But I am not sure how robust is this solution, and I would like to get some feedbacks from you guys before doing anything concrete. Besides, this solution requires changes on opentracing-reactor and opentracing-concurrent projects as well.

Many thanks!

Chengchen

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
csabakoscommented, Apr 29, 2019

@chengchen The lazy operators were introduced as a fix for https://github.com/spring-cloud/spring-cloud-sleuth/issues/866 so I’m assuming that it’s not just dead code and there are some configurations out there in which the ā€œnot active bean factoryā€ code path is useful. That said, I don’t know off the top of my head how to construct a test case that reproduces the issue.

I think we don’t have to handle that case for now, since it’s unclear how to exactly reproduce it. If it’s a real-world issue, somebody will file a ticket for it soon enough. 😃 For now, I suggest just logging an error and foregoing instrumentation for non-active bean factories.

1reaction
pavolloffaycommented, Apr 26, 2019

I am not very familiar with the reactor, therefore I would defer on @csabakos. I would also say if it follows sleuth approach it’s probably good.

The changes to all mentioned projects should be discussed there as they are reused across various instrumentations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

U.S. Small Modular Reactor Design 'Too Late, Too Risky ...
Responding to NuScale's claim that it will build its SMR for less than US$3,000 per kilowatt (kW), IEEFA writes, ā€œno nuclear power plant...
Read more >
Spring cloud sleuth starter breaks Reactor kafka Ā· Issue #866
When Spring Sleuth is enabled it's no longer possible to send messages to topic. ... Reactor decorator added too late ...
Read more >
Hooks (reactor-core 3.5.0)
Adds a wrapper for every Queue used in Reactor. Note that it won't affect existing instances of Queue . Hint: one may use...
Read more >
Pragmatic 280MW reactor design : r/factorio - Reddit
r/factorio - Pragmatic 280MW reactor design ... while efficient, they are cumbersome and provide no real advantage until very late game.
Read more >
Report claims 'serious problems' with proposed NuScale SMR
NuScale calls IEEFA's report ā€œfactually inaccurate.ā€ ... ā€œToo late, too expensive, too risky and too uncertainā€ is how a new report by theĀ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found