How to Integrate Detailed Logging and Tracing for GraphQL in .NET/C# with Dynatrace?

I am using a .NET/C# implementation for GraphQL and I want to capture all logging and tracing information on Dynatrace. When a query or mutation fails, I understand that the response still returns a 200 OK status with a failure message. However, I would like to have these insights reflected in Dynatrace, specifically with the red error indicators, on the main requests even if the request has 200 response but a query or mutation throws GraphQL Exception so I can easily identify a request failed just by looking into it.

I am looking to explore ways to gain more detailed information on any failures in the GraphQL main service using Dynatrace. Here is my current setup:
Packages Installed :

OpenTelemetry.Exporter.OpenTelemetryProtocol,

OpenTelemetry.Extensions.Hosting,

OpenTelemetry.Instrumentation.AspNetCore,

OpenTelemetry.Instrumentation.Http

Program.cs

builder
    .Services
    .AddOpenTelemetry()
    .WithTracing(tracingBuilder =>
    {
        tracingBuilder
            .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("SomeService"))
            .AddAspNetCoreInstrumentation()
            .AddHttpClientInstrumentation()
            .AddHotChocolateInstrumentation();
    });

GraphQL Configuration

.AddInstrumentation(x =>
{
    x.Scopes = HotChocolate.Diagnostics.ActivityScopes.All;
    x.IncludeDocument = true;
    x.IncludeDataLoaderKeys = true;
});

Read more here: Source link