Search code examples
asp.netstackdriver

Can't find TraceConfigruation reference (StackDriver ASP.Net setup)


I'm following the setup instructions for Setting up StackDriver Trace for C# ASP.NET. In the section "Configuring the client library", step 3: In the Global.asax.cs file's WebApiApplication class add teh following Init code block to initialize trace:

public override void Init()
{
    string projectId = ConfigurationManager.AppSettings["projectId"];
    // ...
    base.Init();
    TraceConfiguration traceConfig = TraceConfiguration
        .Create(bufferOptions: BufferOptions.NoBuffer());
    CloudTrace.Initialize(this, projectId, traceConfig);
}

The TraceConfiguration object doesn't exist in either of the client libraries referenced in step 2:

using Google.Cloud.Diagnostics.AspNet;
using Google.Cloud.Diagnostics.Common;

I can't find any reference to this object, and doesn't appear to be built-in to the .net framework.


Solution

  • Assuming you're using this:

    https://cloud.google.com/trace/docs/setup/aspnet

    If I'm following this correctly, I think the documentation is out-of-date and TraceConfiguration was replaced with TraceOptions some time ago:

    https://github.com/googleapis/google-cloud-dotnet/pull/1120

    And: TraceOptions

    I'll ping the folks on the PR and who contribute to this library, let's see whether I can get them to help you and -- if necessary -- correct the docs.