How to set a trace_id for a service that has no incoming request?

64 views Asked by At

For example, in java module 1, it is a service that accept an REST request, then generate and put an object in the cache or a database. It also has an REST endpoint for getting the object. in jave module 2, once it starts, it keeps calling module 1's endpoint and get the object. It then do some processing. Auto instrumention doesn't work for module 2, because module 2 is calling module 1, and it is not received calls from module 1. So the trace_id related to the object it gets is not propegated to module 2. So if in module 1, we set the trace_id as the object id, and then in module 2, when we get object 2, we start a new trace and setting the trace_id from the object id, would this work? And how? I am using opentelemtry, but open to other framework.

tried using opentelemtry's auto instrumention, with java agent. I suppose I need to do some mannul setting.

0

There are 0 answers