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.

Consider a blacklist approach for RequestContextCurrentTraceContext

See original GitHub issue

An armeria app uses a tracing object that coexists with activity that is not request originated. Threads like these will result in the following message to be logged:

                logger.warn("Attempted to propagate trace context, but no request context available. " +
                            "Did you forget to use RequestContext.contextAwareExecutor() or " +
                            "RequestContext.makeContextAware()?", new NoRequestContextException());

The advice is totally invalid in these cases as for example a scheduled thread or reporting loop has no relevance (afaik).

One way out is to allow configuration of a pattern of threads that should be ignored as opposed to spawning this message. This will allow options besides wild hacks or worse killing the log message.

Ex this is how sleuth handles one of the places that are relatively hard to shut-up 😃 https://github.com/spring-cloud/spring-cloud-sleuth/blob/558900155adb1ae4a732cf450c216e2ff04a3f90/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/rxjava/SleuthRxJavaSchedulersHook.java#L126

Another option is to introduce some sort of thread local which you can set to say “ignore”. For example, I could set that in a thread factory in order to quiet the root thing I’m trying to do which is in some ways better than scary comments which may end up lying.

thoughts?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
codefromthecryptcommented, Aug 8, 2019

I agree it is worthwhile thinking through, if nothing else for brave 6. There have been cases especially around propagation policy (like which headers… which is different than in-process) that need some rethought eventually. However, at the moment, trying to add a hook to the span about how you will look the same span up ends up contortionist I think (as currently any hints we store are inside the data in the thread local which we are currently discussing 😛). That said each instrumentation could choose to do things differently, but we sortof already do because we never use thread locals in our code except crazy circumstances. regardless, feel free to raise a discussion on brave. tx!

1reaction
anuraagacommented, Aug 7, 2019

Yeah think we can discuss here, just wondering if it makes sense to add the switching mechanism in Brave. Allowing threads to opt-out of the warning handles many use cases, but still stuck for my database threadpool since it’s used both during request handling and also in the background with things like SET charset. Being able to specify the trace context propagation method when starting a trace, instead of globally, would help with that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

armeria/RequestContextCurrentTraceContext.java at master
Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your...
Read more >
Spring Cloud
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, ...
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