When implementing IComMethodEvents you get three events.
- OnMethodCall
- OnMethodException
- OnMethodReturn
The goal of what I am trying to do is to log call times per method in COM+ components.
The time of the event can be retrieved by using lTime
and lMicroTime
in the COMSVCSEVENTINFO structure so by logging that time in both OnMethodCall
and in OnMethodReturn
I should be able to calculate the call time but how can I be sure that the two events are related.
By testing it looks as I should be able to use the just-in-time (JIT) activated object oid
.
Any problems in doing it like that or are there other ways?
One problem that might be is that I see the oid
is frequently being reused so if the events for some reason is fired out of order it might be a bit more difficult to implement the correlation.
Update 1:
Further testing shows that oid
is not enough in a multi user scenario. The same object is used at the same time so correlation has to be done using at least oid
and original caller
. A follow up question would be: How to get the original caller from a COM+ event subscriber?
Update 2:
Just found IComMethod2Events. Difference is that the events has an identifier of the thread executing the call. Looks promising in tests and I can't imagine a scenario where the correlation could fail. The threading model for the COM+ components are Any Apartment
.
Update 3
In this article Creating COM+ PerfMon Counters to Monitor COM+ Data oid
is used. I don't think that is enough in a multithreaded apartment.
Note: I will eventually implement this in Delphi so I added the Delphi tag. I also added the C# tag because chances are that the language used to implement the interface is not important at all. Update: Tentatively adding the c++ tag just to draw the attention of someone who has actually used this stuff before.
AppMetrics
. Perhaps useful and you may figure out how they do the monitoring. – PickardMSDN COM+ Tracking
. – Pickard