public override void ViewDidLoad () { base.ViewDidLoad (); // Perform any additional setup after loading the view, typically from a nib. Button.AccessibilityIdentifier = "Splunk>®"; SplunkLogger spl = new SplunkLogger ("http://10.80.8.76:8088/services/collector", "9658F9CB-796C-4C0B-A1EC-84CEA4B9F768", false); spl.EnableBatching (); SendRandomEvents (spl); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); //Start sending random events SplunkLogger spl = new SplunkLogger ("http://10.80.8.76:8088/services/collector", "81EBB9BA-BEAC-43AF-B482-F683CFBBE68C", false); spl.EnableBatching (); SendRandomEvents (spl); }
public static async Task<long> SendMultipleTestEventsAsync(int howMany, SplunkLogger logger) { Stopwatch timer = new Stopwatch(); timer.Start(); for (int i = 1; i <= howMany; i++) { string time = timer.ElapsedMilliseconds.ToString(); await logger.LogAsync ("This is test event " + i + " out of " + howMany + ". It has been " + time + " millis since requests started."); } timer.Stop(); return timer.ElapsedMilliseconds; }
public static long SendMultipleTestEvents(int howMany, SplunkLogger logger) { Stopwatch timer = new Stopwatch(); timer.Start(); for (int i = 1; i <= howMany; i++) { string time = timer.ElapsedMilliseconds.ToString(); logger.Log("This is test event " + i + " out of " + howMany + ". It has been " + time + " millis since requests started."); } timer.Stop(); return(timer.ElapsedMilliseconds); }
async private Task SendRandomEvents(SplunkLogger spl) { Stopwatch timer = new Stopwatch (); timer.Start (); Random r = new Random(); while (true) { int waitTimeMillis = r.Next(250, 1500); await Task.Delay(waitTimeMillis); int numEvents = r.Next (1,10); for (int i = 1; i <= numEvents; i++) { await spl.LogAsync ("This is event " + i + " out of " + numEvents + ", sent " + timer.ElapsedMilliseconds + " milliseconds after application started"); } } }
public static async Task<long> SendTestBatchAsync(int batchSize, SplunkLogger logger) { Stopwatch timer = new Stopwatch(); timer.Start(); Queue<string> batch = new Queue<string>(); for (int i = 1; i <= batchSize; i++) { string time = timer.ElapsedMilliseconds.ToString(); batch.Enqueue("This is test event " + i + " out of " + batchSize + " in a batch. It has been " + time + " millis since request began."); } await logger.SendBatchAsync(batch); timer.Stop(); return timer.ElapsedMilliseconds; }