Obtain information about the caller of a remoting operation from ServiceRemotingServiceEvents

WhitW 41 Reputation points
2020-07-24T05:52:59.073+00:00

Per the Application Insights implementation details for instrumenting Service Fabric available here, I've can see that one way to identify that Service Remoting is in use is to hook to the ServiceRemotingServiceEvents and identify whether it's an inbound or outbound request/response from the EventArgs argument. Unfortunately, that allows me to identify it only as one of the following:

The Request args tell me what's being called and each tell me about their respective bodies and headers.

What I don't see is how to retrieve information about the calling method that's creating the outbound request itself. I presume this is information I could glean from the sender argument in the event handler, but I don't see any documentation here describing what to cast the object to in order to obtain this. Could you please point me towards this type so I might learn from what service and method the event was triggered from?

Thank you!

Azure Service Fabric
Azure Service Fabric
An Azure service that is used to develop microservices and orchestrate containers on Windows and Linux.
253 questions
0 comments No comments
{count} votes

Accepted answer
  1. prmanhas-MSFT 17,891 Reputation points Microsoft Employee
    2020-07-24T11:23:34.07+00:00

    @WhitW-6534 Thank you for your question.

    Using ServiceRemotingServiceEvents, there is no direct way to identify the caller of the remote method as only information about method to be called along with remote service is exposed in the event.

    Moreover other parameters like request body and headers are also exposed.
    Moreover trying to identify the source of event using the sender of the event might give exact source as dispatcher of the event might be Async and might not expose that information about it.

    One of the way which I see this can be done (with code modification) is via making Remote API call through an proxy class which adds the caller information into headers which is extracted out in the event or using similar approaches only.

    Hope this helps.

    Please 'Accept as answer' if it helped, so that it can help others in the community looking for help on similar topics

    0 comments No comments

0 additional answers

Sort by: Most helpful