Hacker News new | ask | show | jobs
by abhishekjha 1104 days ago
New to golang, I have recently started looking at some of the open source projects in golang. Looking a at some of the code you get to see that there are producers and there are consumers.

The problem is you won't see them connected in a single stack trace which makes looking at the flow of data in the system difficult. I mean there are profiling tools but they don't go that far.

Another way is to put print on log statements all over function on their entry and exit and try to find a coherent flow.

How do people wrriting golang everyday deal with this problem?

2 comments

OpenTracing and Jaeger. I.e. what you are suggesting, but with more structured output.
> How do people wrriting golang everyday deal with this problem?

For your development setup, have everything run in a docker container and use breakpoints in your IDE to catch program flow. Similar to what you do with a standard/monolith program.

Is this the kind of thing you're asking about, or something different?

channels specifically. These are queues where one side is the producer and other the consumer and they don't share a single call stack.

How do I know where the call chain goes after I have produced on a channel? There can be many subscribers on the same channel.

I guess I amasking to debug a multithreaded program to get some kind of unifrom stack trace.

Ahhh yeah. As another commenter mentioned, OpenTracing and Jaeger works for that. :)