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;
});
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;
});
Share
Improve this question
edited Mar 12 at 23:28
wax
asked Mar 12 at 23:11
waxwax
856 bronze badges
1 Answer
Reset to default 0You can use the OneAgent SDK to mark traces as failed and provide error information.
Or if you don't want to change your code, you could use Failure detection rules with request attributes to mark them as failed.