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
| NewRelic.Api.Agent.NewRelic.NoticeError(new Exception(“WorkerRole test exception”)); |
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
| <system.diagnostics> | |
| <trace> | |
| <listeners> | |
| <add | |
| type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, | |
| Microsoft.WindowsAzure.Diagnostics, | |
| Version=2.5.0.0, | |
| Culture=neutral, | |
| PublicKeyToken=31bf3856ad364e35" | |
| name="AzureDiagnostics"> |
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
| workflow Stop-VM | |
| { | |
| Param ( | |
| [parameter(Mandatory=$true)] | |
| [String] | |
| $VMName, | |
| [parameter(Mandatory=$true)] | |
| [String] | |
| $ServiceName |
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
| workflow Start-VM | |
| { | |
| Param ( | |
| [parameter(Mandatory=$true)] | |
| [String] | |
| $VMName, | |
| [parameter(Mandatory=$true)] | |
| [String] | |
| $ServiceName |
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
| void Main() | |
| { | |
| IObservable<PerformanceSample> performanceCounterObservable = PerfCounterObservable.FromRealTime(TimeSpan.FromSeconds(1), new[]{ | |
| @"\Processor(_Total)\% Processor Time", | |
| @"\Memory(_Total)\% Committed Bytes In Use", | |
| @"\Memory(_Total)\Available MBytes"}) | |
| .Take(6); | |
| performanceCounterObservable.Subscribe(new PerfSampleObserver()); | |
| } |
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
| public class NewRelicLogger | |
| { | |
| public static void LogError(Exception ex, ErrorAction actionTaken, object parameters) | |
| { | |
| /* code omitted */ | |
| var errorDetails = Create(ex, ex.Message, ex.StackTrace, actionTaken, parameters); | |
| LogToNewRelic(errorDetails); | |
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
| public class TwilioRequestErrorFilter : ExceptionFilterAttribute | |
| { | |
| public override void OnException(HttpActionExecutedContext context) | |
| { | |
| /* code omitted */ | |
| var customException = context.Exception as CustomException; | |
| var errorAction = customException == null ? ErrorAction.Escalate : customException.ErrorAction; | |
| var parameters = context.ActionContext.ActionArguments.ToRequestParameters(); |
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
| public static class FilterConfig | |
| { | |
| public static void Register(HttpConfiguration config) | |
| { | |
| config.Filters.Add(new TwilioRequestErrorFilter()); | |
| } | |
| } |
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
| public class InvalidPinException : CustomException | |
| { | |
| /* code omitted */ | |
| public override ErrorAction ErrorAction | |
| { | |
| get | |
| { | |
| return ErrorAction.Ignore; | |
| } |
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
| public class UserController : TwilioApiController | |
| { | |
| public HttpResponseMessage Post(VoiceRequest request, string pin) | |
| { | |
| var user = AuthenticationService.GetUser(pin); | |
| var response = new TwilioResponse(); | |
| response.Say(string.Format("Hello {0}", user.Name)); | |
| response.Pause(2); | |
| response.Hangup(); |