Skip to content

4. The Probe

Jérôme Oesch edited this page Feb 26, 2018 · 2 revisions

The Probe contains the body that will be injected into the assembly that the user provides. It consists of three methods:

  • OnBeforeMethod(string documentationId)
  • OnAfterMethod(string documentationId)
  • OnException(string documentationId)`` These methods are placed into the body of all methods that are available inside an assembly. The methods OnBeforeMethodandOnAfterMethodare inserted as first and last statement of any method, the latter one sending the recorded information to the cloud. TheOnException` method is inserted into any try catch statement.

The Probe itself is inserted into the assembly by reference and will be placed as .dll file next to the original .dll file that was changed. It uses the Microsoft.ApplicationInsights library to send the telemetry data to the cloud. The Probe contains a list, in which the starting time is stored, such that as soon as a method has finished running its body, the actual timestamp minus the stored one equals the runtime duration of that method.

Currently there exist multiple probes inside the repository. The AzureTelemetryProbe is developed with .Net Framework 4.6.1, meaning that it can be loaded in any .Net Framework 4.6.1 project or higher. It is tested to work also with .Net Core 2.0.3. There existed a bug in version 2.0.2 and lower where during execution the compiled code was not interpretable by .Net Core which was resolved in version 2.0.3.

The other two probes have currently no use, but display how other Probes could look like when being developed.