2

When using Hot Chocolate with .Net Core I am creating my scheme like this:

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        // Here I register my services / repositories; omitted for brevity

        services.AddGraphQL(sp => Schema.Create(c =>
        {
            // Here I register my schema types and so on; omitted for brevity
        }));
    }

     // Code omitted for brevity
}

But how do I enable the built-in Apollo Tracing for all requests actually? And does it work with .Net Framework the same way?

Rafael Staib
  • 1,226
  • 12
  • 14

1 Answers1

3

Basically, by setting the TracingPreference option to TracingPreference.Always.

The following code fragment shows how this would look like.

services.AddGraphQL(sp => Schema.Create(c =>
{
    // Here goes the schema definition which is omitted for brevity purpose
}),
new QueryExecutionOptions
{
    TracingPreference = TracingPreference.Always
});

And yes, it works the same way in .Net Framework. The API in .Net Core and Framework is kept identical let say 99% identical. What here differs is just the surrounding which means the Startup class which wraps the DI configuration.

For more information about Apollo Tracing, head over here.

Rafael Staib
  • 1,226
  • 12
  • 14