tl-its-umich-edu / canvas-course-manager-next

Canvas Course Manager Next: A redesign of the existing CCM application. It extends Canvas features, makes cumbersome features easier to use, and adds new features.
8 stars 9 forks source link

Add API request IDs to trace requests between controller and service method calls #128

Open ssciolla opened 3 years ago

ssciolla commented 3 years ago

I think something useful to consider is incorporating a request id. For example, putCourseNamein api.service.ts can accept a guid and putCourseName in api.controller.ts can generate one and forward it on to be used in logging. You can use this info when trying to isolate a single request 'thread' when there is a lot of activity going on that would otherwise make it difficult to tell what is going on.

You can do stuff like logger.log('putCourseName[ '+ requestId +'] userLoginId: ' + userLoginId +' courseId: ' + ... )

Honestly I have no idea if there is a design pattern or best practice around this, I just started doing it in my own projects because it seemed useful. Maybe there is a better way to implement it.

_Originally posted by @chrisrrowland in https://github.com/tl-its-umich-edu/canvas-course-manager-next/pull/121#discussion_r652868459_

ssciolla commented 3 years ago

@pushyamig, this is the issue I was thinking of.