Created
September 27, 2016 18:25
-
-
Save adam-hert/4dda136b34136e3c8a0b339a7bf9a798 to your computer and use it in GitHub Desktop.
Custom traceview instrumentation in aspx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
using AppNeta.Instrumentation; | |
public partial class _Default : Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
//info event to report controllers and actions in IIS layer | |
InfoTraceEvent traceEvent = AppNeta.Instrumentation.Trace.CreateInfoEvent("IIS"); | |
traceEvent.AddInfo("Controller", "Test_controller"); | |
traceEvent.AddInfo("Action", "Test_action"); | |
traceEvent.Report(); | |
//create entry event for custom layer | |
EntryTraceEvent traceEvent1 = AppNeta.Instrumentation.Trace.CreateEntryEvent("my_layer_name"); | |
//optional, add KV pairs to the layer | |
traceEvent1.AddInfo("something", "interesting"); | |
traceEvent1.Report(); | |
//Do some work | |
System.Threading.Thread.Sleep(2000); | |
//create exit event | |
ExitTraceEvent traceEvent2 = AppNeta.Instrumentation.Trace.CreateExitEvent("my_layer_name"); | |
traceEvent2.Report(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment