Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4b81f0d
wip: Align with OTEL spec
tobias-tengler Mar 4, 2026
e5e8eb3
Introduce HotChocolate.Diagnostics.Core project
tobias-tengler Mar 4, 2026
fffbcd2
wip: More consolidation
tobias-tengler Mar 4, 2026
11ae4a6
Cleanup
tobias-tengler Mar 4, 2026
4460065
Cleanup
tobias-tengler Mar 4, 2026
e48ba42
Cleanup
tobias-tengler Mar 4, 2026
d83edcd
Cleanup
tobias-tengler Mar 4, 2026
e361071
wip: More cleanup
tobias-tengler Mar 4, 2026
3f8e8c7
More cleanup
tobias-tengler Mar 4, 2026
dbdca5d
wip: refactor
tobias-tengler Mar 4, 2026
d6b2c45
wip: more cleanup
tobias-tengler Mar 4, 2026
8754015
Add back enrichment
tobias-tengler Mar 4, 2026
48b0955
More cleanup
tobias-tengler Mar 5, 2026
e9f7e74
More cleanup
tobias-tengler Mar 5, 2026
a941964
More cleanup
tobias-tengler Mar 5, 2026
4cd6f2d
Fix ServerInstrumentationTests
tobias-tengler Mar 5, 2026
fd91e51
Properly report errors and set status
tobias-tengler Mar 5, 2026
351469f
Add more tests
tobias-tengler Mar 5, 2026
3b5df4f
Add GraphQL error details on "exception" span event
tobias-tengler Mar 5, 2026
1b35848
More cleanup
tobias-tengler Mar 5, 2026
212c627
Update migration guide again
tobias-tengler Mar 5, 2026
67734b1
Cleanup tests
tobias-tengler Mar 5, 2026
64caa2c
Fix snapshots
tobias-tengler Mar 5, 2026
0b7418c
Mark flaky tests
tobias-tengler Mar 5, 2026
fc4fc5a
Merge remote-tracking branch 'origin/main' into tte/align-with-otel-spec
tobias-tengler Mar 5, 2026
6fa230e
Small refactorings
tobias-tengler Mar 5, 2026
e874d37
Update snapshots
tobias-tengler Mar 5, 2026
e85f686
Cleanup
tobias-tengler Mar 5, 2026
aed5f55
Fix snapshots
tobias-tengler Mar 5, 2026
8d520d9
Fix test flakiness
tobias-tengler Mar 5, 2026
3e6c0f9
Retrigger CI
tobias-tengler Mar 5, 2026
4c4d87a
Cleanup
tobias-tengler Mar 12, 2026
3b9a499
Undo TryGetOperationDocument change
tobias-tengler Mar 13, 2026
bd0e316
Merge origin/main into tte/align-with-otel-spec
tobias-tengler Mar 13, 2026
0fec0af
Update migration guide
tobias-tengler Mar 13, 2026
81f370e
Fix build issue
tobias-tengler Mar 13, 2026
c40b318
Add subscription event span
tobias-tengler Mar 13, 2026
55d06e7
Consolidate source schema errors
tobias-tengler Mar 13, 2026
2c6ac34
Fix lambda function flakiness
tobias-tengler Mar 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/All.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
</Folder>
<Folder Name="/HotChocolate/Diagnostics/" />
<Folder Name="/HotChocolate/Diagnostics/src/">
<Project Path="HotChocolate/Diagnostics/src/Diagnostics.Core/HotChocolate.Diagnostics.Core.csproj" />
<Project Path="HotChocolate/Diagnostics/src/Diagnostics/HotChocolate.Diagnostics.csproj" />
</Folder>
<Folder Name="/HotChocolate/Diagnostics/test/">
Expand Down
20 changes: 15 additions & 5 deletions src/HotChocolate/Core/src/Execution.Abstractions/Path.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public string Print()
{
if (this is RootPathSegment)
{
return "/";
return string.Empty;
}

// On first pass we calculate the total length
Expand All @@ -147,7 +147,11 @@ public string Print()
break;

case NamePathSegment name:
totalLength += 1 + name.Name.Length; // '/' + name
totalLength += name.Name.Length;
if (current.Parent is not RootPathSegment)
{
totalLength++;
}
break;

default:
Expand All @@ -158,10 +162,13 @@ public string Print()
}

// On second pass we fill from right to left using string.Create
return string.Create(totalLength, this, static (span, path) =>
return string.Create(
totalLength,
this,
static (span, state) =>
{
var pos = span.Length;
var current = path;
var current = state;

while (current is not RootPathSegment)
{
Expand All @@ -188,7 +195,10 @@ public string Print()
case NamePathSegment name:
pos -= name.Name.Length;
name.Name.AsSpan().CopyTo(span[pos..]);
span[--pos] = '/';
if (current.Parent is not RootPathSegment)
{
span[--pos] = '.';
}
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,30 +186,6 @@ public IDisposable ExecuteOperation(RequestContext context)
return new AggregateActivityScope(scopes);
}

public IDisposable ExecuteStream(IOperation operation)
{
var scopes = new IDisposable[_listeners.Length];

for (var i = 0; i < _listeners.Length; i++)
{
scopes[i] = _listeners[i].ExecuteStream(operation);
}

return new AggregateActivityScope(scopes);
}

public IDisposable ExecuteDeferredTask()
{
var scopes = new IDisposable[_listeners.Length];

for (var i = 0; i < _listeners.Length; i++)
{
scopes[i] = _listeners[i].ExecuteDeferredTask();
}

return new AggregateActivityScope(scopes);
}

public IDisposable ResolveFieldValue(IMiddlewareContext context)
{
if (_resolverListener.Length == 0)
Expand All @@ -235,14 +211,6 @@ public void ResolverError(IMiddlewareContext context, IError error)
}
}

public void ResolverError(RequestContext context, ISelection selection, IError error)
{
for (var i = 0; i < _listeners.Length; i++)
{
_listeners[i].ResolverError(context, selection, error);
}
}

public IDisposable RunTask(IExecutionTask task)
{
if (_resolverListener.Length == 0)
Expand Down Expand Up @@ -316,18 +284,6 @@ public void SubscriptionEventError(RequestContext context, ulong subscriptionId,
}
}

public IDisposable DispatchBatch(RequestContext context)
{
var scopes = new IDisposable[_listeners.Length];

for (var i = 0; i < _listeners.Length; i++)
{
scopes[i] = _listeners[i].DispatchBatch(context);
}

return new AggregateActivityScope(scopes);
}

public void ExecutorCreated(string name, IRequestExecutor executor)
{
for (var i = 0; i < _listeners.Length; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,6 @@ public interface IExecutionDiagnosticEvents : ICoreExecutionDiagnosticEvents
/// </returns>
IDisposable CompileOperation(RequestContext context);

/// <summary>
/// Called within the execute operation scope when the result is a streamed result.
/// The ExecuteStream scope will run longer than the ExecuteOperation scope.
/// The ExecuteOperation scope completes once the initial operation is executed,
/// while all deferred elements are executed and delivered within the ExecuteStream scope.
/// </summary>
/// <param name="operation">
/// The compiled operation that is being streamed.
/// </param>
/// <returns>
/// A scope that will be disposed when the streaming execution has finished.
/// </returns>
IDisposable ExecuteStream(IOperation operation);

/// <summary>
/// Called when starting to execute a deferred part of an operation
/// within the ExecuteStream scope or ExecuteSubscription scope.
/// </summary>
/// <returns>
/// A scope that will be disposed when the deferred task execution has finished.
/// </returns>
IDisposable ExecuteDeferredTask();

/// <summary>
/// Called when starting to resolve a field value.
/// </summary>
Expand Down Expand Up @@ -131,26 +108,6 @@ public interface IExecutionDiagnosticEvents : ICoreExecutionDiagnosticEvents
/// </param>
void ResolverError(IMiddlewareContext context, IError error);

/// <summary>
/// Called for field errors that occur outside the resolver task execution,
/// typically during result processing or validation.
/// </summary>
/// <param name="context">
/// The request context encapsulates all GraphQL-specific information about an
/// individual GraphQL request.
/// </param>
/// <param name="selection">
/// The field selection that is affected by the error.
/// </param>
/// <param name="error">
/// The error that occurred during field processing.
/// </param>
/// <remarks>
/// Some field-level errors are handled after the resolver completes and these
/// are processed in the request scope rather than the resolver scope.
/// </remarks>
void ResolverError(RequestContext context, ISelection selection, IError error);

/// <summary>
/// Called when starting to execute an execution engine task.
/// </summary>
Expand Down Expand Up @@ -215,19 +172,4 @@ public interface IExecutionDiagnosticEvents : ICoreExecutionDiagnosticEvents
/// individual GraphQL request.
/// </param>
void RetrievedOperationFromCache(RequestContext context);

/// <summary>
/// Called when the execution engine dispatches deferred execution batches.
/// During execution, components like DataLoader defer data resolver execution
/// to be processed in batches. When the execution engine has no immediate work,
/// these batches are dispatched for execution.
/// </summary>
/// <param name="context">
/// The request context encapsulates all GraphQL-specific information about an
/// individual GraphQL request.
/// </param>
/// <returns>
/// A scope that will be disposed when the batch dispatch has finished.
/// </returns>
IDisposable DispatchBatch(RequestContext context);
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void SetPath_Foo_PathIsFooWithCount1()
.Build();

// assert
Assert.Equal("/foo", error.Path?.Print());
Assert.Equal("foo", error.Path?.Print());
}

[Fact]
Expand All @@ -206,7 +206,7 @@ public void SetPathObject_Foo_PathIsFooWithCount1()
.Build();

// assert
Assert.Equal("/foo", error.Path?.Print());
Assert.Equal("foo", error.Path?.Print());
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,6 @@ public void WithPath()
error = error.WithPath(Path.FromList(["foo"]));

// assert
Assert.Equal("/foo", error.Path!.Print());
Assert.Equal("foo", error.Path!.Print());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,30 @@ public void Path_ToString()
var result = path.ToString();

// assert
Assert.Equal("/hero/friends[0]/name", result);
Assert.Equal("hero.friends[0].name", result);
}

[Fact]
public void Path_Print()
{
// arrange
var path = Path.Root.Append("person").Append(0).Append("address");

// act
var result = path.Print();

// assert
Assert.Equal("person[0].address", result);
}

[Fact]
public void Path_Print_Root()
{
// act
var result = Path.Root.Print();

// assert
Assert.Equal(string.Empty, result);
}

[Fact]
Expand Down Expand Up @@ -172,12 +195,12 @@ public void Complex_Ordering()

string[] expected =
[
"/bar",
"/bar[3]",
"/bar[3][2]",
"/bar[3]/foo",
"/foo",
"/foo[0]"
"bar",
"bar[3]",
"bar[3][2]",
"bar[3].foo",
"foo",
"foo[0]"
];

for (var i = 0; i < paths.Length; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ input Bar {

// assert
Assert.True(report.HasErrors);
Assert.Equal("/root/a", report.Path.ToString());
Assert.Equal("root.a", report.Path.ToString());
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
The directive arguments have invalid values: 'The required input field `d` is missing.' at /d.
The directive arguments have invalid values: 'The required input field `d` is missing.' at d.
@a
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
The directive arguments have invalid values: 'Int cannot coerce the given literal of type `BooleanValue` to a runtime value.' at /e.
The directive arguments have invalid values: 'Int cannot coerce the given literal of type `BooleanValue` to a runtime value.' at e.
@a(d: 1, e: true)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
The directive arguments have invalid values: 'Cannot accept null for non-nullable input.' at /d.
The directive arguments have invalid values: 'Cannot accept null for non-nullable input.' at d.
@a(d: null)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
The directive arguments have invalid values: 'Int cannot coerce the given literal of type `IntValue` to a runtime value.' at /d.
The directive arguments have invalid values: 'Int cannot coerce the given literal of type `IntValue` to a runtime value.' at d.
@a(d: 9223372036854775807)
1 change: 1 addition & 0 deletions src/HotChocolate/Diagnostics/HotChocolate.Diagnostics.slnx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Solution>
<Folder Name="/src/">
<Project Path="src/Diagnostics/HotChocolate.Diagnostics.csproj" />
<Project Path="src/Diagnostics.Core/HotChocolate.Diagnostics.Core.csproj" />
</Folder>
<Folder Name="/test/">
<Project Path="test/Diagnostics.Tests/HotChocolate.Diagnostics.Tests.csproj" />
Expand Down
Loading
Loading