void Application_Start(object sender, EventArgs e) { string projectId = "[Google Cloud Platform project ID]"; // Trace a sampling of incoming Http requests. CloudTrace.Initialize(projectId, this); }
public override void Init() { base.Init(); string projectId = "[Google Cloud Platform project ID]"; // Trace a sampling of incoming Http requests. CloudTrace.Initialize(this, projectId); }
public override void Init() { base.Init(); CloudTrace.Initialize( this, Environment.GetEnvironmentVariable("GOOGLE_PROJECT_ID"), TraceOptions.Create(1_000_000, BufferOptions.NoBuffer())); }
public override void Init() { base.Init(); var configurationProvider = new ConfigurationProvider(); // Trace a sampling of incoming Http requests. CloudTrace.Initialize(this, configurationProvider.ProjectId); }
// End sample public void TraceHelloWorld() { // Sample: UseTracer // Manually trace a specific operation. CloudTrace.GetCurrentTracer().StartSpan("hello-world"); Console.Out.WriteLine("Hello, World!"); CloudTrace.GetCurrentTracer().EndSpan(); // End sample }
public async Task <string> TraceOutgoing(string id) { string message = EntryData.GetMessage(nameof(TraceOutgoing), id); using (CloudTrace.Tracer.StartSpan(message)) using (HttpClient httpClient = new HttpClient(CloudTrace.CreateTracingHttpMessageHandler())) { await httpClient.GetAsync("https://google.com/"); } return(message); }
public async Task <HttpResponseMessage> TraceOutgoing() { // Sample: TraceOutgoing // Add a handler to trace outgoing requests and to propagate the trace header. var traceHeaderHandler = CloudTrace.CreateTracingHttpMessageHandler(); using (var httpClient = new HttpClient(traceHeaderHandler)) { return(await httpClient.GetAsync("https://weather.com/")); } // End sample }
public void Trace() { using (var cloudTrace = CloudTrace.InitializeInternal(new HttpApplication(), _projectId, _noBuffer)) { cloudTrace.BeginRequest(null, null); cloudTrace.EndRequest(null, null); } var trace = _polling.GetTrace($"/{_testId}", _startTime); Assert.NotNull(trace); Assert.Single(trace.Spans); }
public void No_Trace() { var predicate = TraceDecisionPredicate.Create((req) => false); using (var cloudTrace = CloudTrace.InitializeInternal(new HttpApplication(), projectId: _projectId, options: _noBuffer, traceFallbackPredicate: predicate)) { cloudTrace.BeginRequest(null, null); cloudTrace.EndRequest(null, null); } var trace = _polling.GetTrace($"/{_testId}", _startTime, false); Assert.Null(trace); }
public void Trace_Multiple_Spans() { using (var cloudTrace = CloudTrace.InitializeInternal(new HttpApplication(), _projectId, _noBuffer)) { cloudTrace.BeginRequest(null, null); using (CloudTrace.Tracer.StartSpan("/another-trace")) { Thread.Sleep(TimeSpan.FromMilliseconds(10)); } cloudTrace.EndRequest(null, null); } var trace = _polling.GetTrace($"/{_testId}", _startTime); Assert.NotNull(trace); Assert.Equal(2, trace.Spans.Count); }
// [START configure_services_trace] public override void Init() { // [START_EXCLUDE] string projectId = ConfigurationManager.AppSettings["projectId"]; // Confirm that projectId has been changed from placeholder value. if (projectId == ("YOUR-PROJECT-ID")) { throw new Exception("Update Web.config and replace " + "YOUR-PROJECT-ID with your project id, and recompile."); } // [END_EXCLUDE] base.Init(); TraceConfiguration traceConfig = TraceConfiguration .Create(bufferOptions: BufferOptions.NoBuffer()); CloudTrace.Initialize(this, projectId, traceConfig); }
public override void Init() { base.Init(); CloudTrace.Initialize(this, "cloudsharptest", TraceOptions.Create(1_000_000, BufferOptions.NoBuffer())); }
public override void Init() { base.Init(); CloudTrace.Initialize("cloud-sharp-work", this); }