Zipkin is not nesting parent trace to its child - twitter

We are using finagle stack and taught of adding zipkin for tracing our micro-services.
I am able to see our tracing happening but parent finishes before the child.
I have already opened an issue here:
https://github.com/openzipkin/docker-zipkin/issues/100
Any help would be really appreciated.

I was recording wrong annotation i.e client instead of server.
Just a simple change did the trick.
Trace.traceService("Function1","Test")
Sample working Zipkin example: https://gist.github.com/AkhilJ876/3e38757c28d43924f296dd2d147c0bd9#file-zipkintracing_example-L34

Related

How to pass thread local variable in Project Reactor

I started using project reactor. Does anyone know how can I pass thread local variables from one thread to another? I saw some methods on Hooks.java but could not figure out what is the recommended way of doing this. Can someone point me to some documentation or with a code snippet on how to do it. Thanks.
I have a working example in this github repository based on the spring-cloud-sleuth's implementation: https://github.com/gumartinm/JavaForFun/tree/master/SpringJava/WebReactive/spring-webreactive-reactor-context-enrich
The key classes are: ContextCoreSubscriber.java, SubscriberContext.java, ThreadContextEnrichmentAutoConfiguration.java and UsernameFilter.java
ContextCoreSubscriber.java:
Enables you to fill the Mapped Diagnostic Context: MDC
SubscriberContext.java:
Helper class for inserting data in the Reactor's Context.
ThreadContextEnrichmentAutoConfiguration.java:
In charge of configuring the Reactor's Hooks: Hooks.onEachOperator
UsernameFilter.java:
Example where we want to register the username information based on some HTTP header.
Reactor doesn't guarantee that the processing done by a Flux or Mono chain of operators will stick executing on a single thread. On the contrary, it performs work-stealing and lets the user switch execution context.
As such, using ThreadLocal is not very adapted to Reactor.
There is currently some work done in 3.1.0 towards providing an equivalent, at least for library authors that use Reactor, but nothing definite in place yet.
Keep your eyes peeled for 3.1.0, that should be the main theme of that release (and will probably be the focus of the second upcoming milestone, M2).

Nodes timing out in umbraco back-end

I'm having an issue with an umbraco site of mine: For some reason some of the nodes are timing out when I try to click on them in the back-end of the site.
The front-end works fine and there aren't any slowdown issues there, however I'm unable to edit these same nodes in the back-end as the system seems to just hang. This is making it incredibly difficult to debug as I have no idea what properties are actually causing the problems here. What's strange is I can create a node of the same document type and enter in some dummy values and that works fine, yet I can't seem to edit the existing nodes.
I've tried republishing the entire site, republishing the individual nodes, deleting the umbraco.config file and nothing has worked up to this point.
What's also interesting is that if I close down the browser the system seems to stop hanging and I can log in and try again.
Has anyone encountered this before or know where to begin?
Thanks
I have encountered something similar. The longer you work with Umbraco the slower it becomes and if you check the memory usage in Chrome's task manager, you can see that certain actions upon nodes bump the memory usage up a little further. The answer is just to close down the tab and open a new one.
I have reported this and Umbraco cannot replicate this. However, I do think that this is possibly due to maybe a package installed into Umbraco, maybe uComponents. It's very difficult to pin point.
Update:
If you can access some nodes but not others, then this is actually slightly easier to debug. I would check what similarities the nodes that timeout have.
Are they all of the same document type?
Do they all use the same data type?
I would guess that the nodes in question are using a data type that is performing an operation when the node is loading, and that operation is timing out. For example, do you have any data types that load data from the database, like enums? Do you have any datatypes that load data from a web service?
Do you have any usercontrol data types wrapped in the UserControlWrapper data type? These would be somewhere to check.
Finally, check:
The databases [umbracoLog] table. Any Umbraco-specific errors will be listed there.
Check the computer's event viewer. This will show any unhandled errors.
My money's on a database timeout.

SQLite.net exception on screen rotation on android 4.1+

I am currently working on a cross-platform application using Monodroid/Xamarin. It uses a SQLite.net database and at the moment I have only built the Android UI.
In the application there is a long running method on a background thread which does several database reads and writes.
I was testing this long running method on a Nexus 7 running android 4.2.2 and it seems as though after a second screen rotation, a SQLite exception is thrown and the application crashes.
The exception stack trace varies depending on when you rotate the screen but the exception is always object not set to an instance inside Prepare2.
The interesting part is when testing on Samsung Galaxy S2 running 4.1.2 an exception still occurs but it is a different exception.
Furthermore, testing on a Samsung Galaxy Tab 2 and emulators the error is not thrown at all and the method completes just fine.
Any ideas, hints, suggestions would be much appreciated.
As a side question - in all the cross platform applications i have seen using Xamarin - the database layer and or repository is always static - whats the reason for this?
Thanks everyone
It's hard to identify the problem from what you've written - would be easier if you'd included some code about how you are accessing the database from your app.
However, I suspect that the problem here will be due to some interaction between the lifecycle of your UI Activity and the way it interacts with the SQLite database.
By default, when you rotate an Activity, then the existing instance is destroyed and a new one is created - your old Activity will be called to store its state in SaveInstanceState and your new rotated Activity will get called with a bundle in OnCreate.
This is why the database layer is often static/singleton in the samples - it's an easy way to allow the same database instance to be shared by multiple Activities/Components.
I guess that your Activity is doing something with the database during OnCreate - and that this is being called after each rotation/creation? Alternatively maybe your long-running method is trying to do something after the Activity that's hosting it has been finished and disposed?
In the end, this turned out to be a issue with mulithreading and Linq not playing well together. Thanks to Stuart for his answer.

What are good strategies to debug iOS apps with 'dangling UIViews'?

I recently inherited maintenance of a relatively small iOS application. The app was created by external contractors with very little guidance and oversight. Needless to say it needs "a little" cleaning - I am evaluating whether to redo the entire thing or not.
One thing that got me stumped is a crash in the app whereby the debugger shows "Applications are expected to have a root view controller at the end of application launch". In the module where this occurs, I researched all UIViews to make sure they are created with a parent (addSubView sets the root view controller, right?) - this seems all prim and proper.
Being rather new to XCode, I am not familiar with facilities that help me figure out what might be going on here. E.g., how can I quickly see/investigate the status of all UIViews created by a module? How can I 'watch' a variable just to be alerted when it changes? And in general, is there a best strategy to use to tackle issues like the one I described above?
Sorry to stay a bit vague but I don't think that publishing a bunch of ugly code helps you to understand the problem better :-)
That particular problem happens when the application's UIWindow doesn't have a value for its rootViewController property by the time it finishes launching. Take a look in your application delegate file - usually, the root view controller is set on the window there.
With regards to your more general questions: there are a variety of ways to inspect the state of your program as it runs. A very basic way to dump some info is to use an NSLog statement - you can print out messages to the console in much the same way as a C printf would. You can also set breakpoints in your application and use the debugger to inspect different variables - take a look at the lldb documentation for more info.
Whether you have "dangling" UIViews or not has not much to do with having a root view controller or not.
Instead, you should make sure that your app's UIWindow has a rootViewController at the end of your app delegates appDidFinishLaunching method.

Mochiweb mnesia requests

I'm trying to link Mochiweb with my ejabberd mnesia db and am unable to do any mnesia transactions in my controllers. I test my controllers without the mnesia transactions and they work fine. I am using application:start(mnesia) inside the start function.
On the browser, I see "Internal server error" and on Mochiweb's log I see, "=ERROR REPORT=== function_clause". I'd like to know how to either 1.) get mnesia to work with Mochiweb or 2.) what a good framework I could plugin to ejabberd's web server is.
Thanks!
Do you have the rest of the error message from Mochiweb's log - the bit after "function_clause" if it has it?
This must be an error within your code. Last time I checked the mochiweb source it wrapped your "loop" function within a try catch. If it caught an exception, it printed the type of that exception to the error log; in your case you have a function_clause exception.
Either try calling your loop function manually, or wrap your code in yet another try catch to be able to see the whole exception. If you can't decipher it, paste it to your question please.
You know, I think I was doing it all wrong... I was thinking it would work like PHP/SQL and Rails/SQL, but it seems the best way to do this is calling methods from the Mochiweb node to the ejabberd node.
Also I noticed that when I started Mochiweb connected to the same mnesia database as ejabberd, it tried to "repair" some of my tables - basically erasing everything.
If anyone has any input on this (or if I'm totally off) please let me know. Thanks!

Resources