-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Activity.Current is a static variable that uses AsyncLocal internally, which means that it flows into children async calls, but not back to the caller (message consumer and producer). With the previous implementation, the Activity.Current is null after the produce and consume of messages, which means that all spans created after it will generate new trace information because the context is not being propagated. This change fixes the problem firing sync events and making the OpenTelemetry handlers subscribe them.
- Loading branch information
1 parent
06fcddf
commit a45ea76
Showing
7 changed files
with
123 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,19 @@ | |
/// </summary> | ||
public interface IEvent | ||
{ | ||
/// <summary> | ||
/// Subscribes to the async event. | ||
/// </summary> | ||
/// <param name="handler">The handler to be called when the async event is fired.</param> | ||
/// <returns>Event subscription reference</returns> | ||
IEventSubscription Subscribe(Func<Task> handler); | ||
|
||
/// <summary> | ||
/// Subscribes to the event. | ||
/// </summary> | ||
/// <param name="handler">The handler to be called when the event is fired.</param> | ||
/// <returns>Event subscription reference</returns> | ||
IEventSubscription Subscribe(Func<Task> handler); | ||
IEventSubscription Subscribe(Action handler); | ||
} | ||
|
||
/// <summary> | ||
|
@@ -22,11 +29,18 @@ public interface IEvent | |
/// <typeparam name="TArg">The argument expected by the event.</typeparam> | ||
public interface IEvent<out TArg> | ||
{ | ||
/// <summary> | ||
/// Subscribes to the async event. | ||
/// </summary> | ||
/// <param name="handler">The handler to be called when the async event is fired.</param> | ||
/// <returns>Event subscription reference</returns> | ||
IEventSubscription Subscribe(Func<TArg, Task> handler); | ||
|
||
/// <summary> | ||
/// Subscribes to the event. | ||
/// </summary> | ||
/// <param name="handler">The handler to be called when the event is fired.</param> | ||
/// <returns>Event subscription reference</returns> | ||
IEventSubscription Subscribe(Func<TArg, Task> handler); | ||
IEventSubscription Subscribe(Action<TArg> handler); | ||
} | ||
} | ||
Check warning on line 46 in src/KafkaFlow.Abstractions/IEvent.cs GitHub Actions / Test deployment
|
12 changes: 12 additions & 0 deletions
12
src/KafkaFlow.Admin.Dashboard/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"profiles": { | ||
"KafkaFlow.Admin.Dashboard": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "https://localhost:63908;http://localhost:63909" | ||
} | ||
} | ||
} |
7 changes: 6 additions & 1 deletion
7
src/KafkaFlow.IntegrationTests/Core/Middlewares/GzipMiddleware.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters