dorbel-tech / dorbel-shared

dorbel shared dependencies used in dorbel-app
0 stars 1 forks source link

Implement requestId in all APIs for easier monitoring #23

Closed virtser closed 7 years ago

virtser commented 7 years ago

See if we can add it on middle ware level.

To better trace errors: https://www.loggly.com/blog/monitoring-microservices-three-ways-to-overcome-the-biggest-challenges/

avnersorek commented 7 years ago

This is a notoriously tough one in Node.JS It's hard to bind an ID to a request-context since everything is event-based. It used to be possible with Domain https://nodejs.org/api/domain.html but that's being deprecated. I'm not sure what the option is

On Tue, Dec 6, 2016 at 9:03 AM, David Virtser notifications@github.com wrote:

See if we can add it on middle ware level.

To better trace errors: https://www.loggly.com/blog/monitoring-microservices- three-ways-to-overcome-the-biggest-challenges/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dorbel-tech/dorbel-shared/issues/23, or mute the thread https://github.com/notifications/unsubscribe-auth/ACHtjjfFABnNxDtUJqr3qSDQxl9sjTQjks5rFQjWgaJpZM4LFFrQ .

virtser commented 7 years ago

https://www.facebook.com/groups/nodejsisrael/permalink/1404710032881966/

virtser commented 7 years ago

Looks like they have some tracing capabilities: https://trace.risingstack.com

avnersorek commented 7 years ago

About the comments in the FB group - The problem is having the 'request ID' persist inside the application. After that it's pretty easy to have it sent across services. The common solution today is indeed continuation-local-storage https://github.com/othiym23/node-continuation-local-storage but it has a lot of issues. It doesn't always work and requires all kinds of patching to make it work better. It sometimes even causes bugs. You can check out the issues section on their github.

The whole problem is a difficult one to solve in the node.js context, the node core team have addressed it and wanted to solve it with domains but realized it caused too much problems so domains were deprecated. Strongloop also tried to address it with zone https://github.com/strongloop/zone which was also deprecated. There is a proposal for solutions for the next node.js versions but for now CLS is the best solution - but I'm not sure it's worth the effort.

I usually find that proper logging - adhering to a standard convention of how logs look like and always have them include the entity ID's of what's being processed - is enough for understanding how a transaction went through several processes.

On Tue, Dec 6, 2016 at 9:55 PM, David Virtser notifications@github.com wrote:

Looks like they have some tracing capabilities: https://trace.risingstack.com

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dorbel-tech/dorbel-shared/issues/23#issuecomment-265255282, or mute the thread https://github.com/notifications/unsubscribe-auth/ACHtjqGkFWGU_iISY7cMrofAjVzLJ8GNks5rFb2ngaJpZM4LFFrQ .

virtser commented 7 years ago

I see. Let's put this task on hold for better times. :)