-
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.
Loading status checks…
fixes
1 parent
6ba75d8
commit acfdf81
Showing
12 changed files
with
103 additions
and
36 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace KafkaFlow | ||
{ | ||
/// <summary>Activity operation names enum values</summary> | ||
public enum ActivityOperationType | ||
{ | ||
/// <summary>PUBLISH</summary> | ||
Publish, | ||
|
||
/// <summary>PROCESS</summary> | ||
Process, | ||
} | ||
} |
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 @@ | ||
namespace KafkaFlow | ||
{ | ||
using System.Diagnostics; | ||
using System.Reflection; | ||
|
||
public static class ActivitySourceAccessor | ||
Check warning on line 6 in src/KafkaFlow.Abstractions/ActivitySourceAccessor.cs GitHub Actions / Test deployment
Check warning on line 6 in src/KafkaFlow.Abstractions/ActivitySourceAccessor.cs GitHub Actions / Test deployment
|
||
{ | ||
public const string ActivityString = "otel_activity"; | ||
Check warning on line 8 in src/KafkaFlow.Abstractions/ActivitySourceAccessor.cs GitHub Actions / Test deployment
|
||
public static readonly ActivitySource ActivitySource = new("KafkaFlow.OpenTelemetry", Version); | ||
Check warning on line 9 in src/KafkaFlow.Abstractions/ActivitySourceAccessor.cs GitHub Actions / Test deployment
|
||
internal static readonly string Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Diagnostics; | ||
|
||
namespace KafkaFlow | ||
{ | ||
internal class ActivityFactory : IActivityFactory | ||
{ | ||
public Activity Start(string topicName, ActivityOperationType activityOperationType, ActivityKind activityKind) | ||
{ | ||
var activityName = !string.IsNullOrEmpty(topicName) ? $"{topicName} {activityOperationType}" : activityOperationType.ToString(); | ||
|
||
// Start an activity with a name following the semantic convention of the OpenTelemetry messaging specification. | ||
// The convention also defines a set of attributes (in .NET they are mapped as `tags`) to be populated in the activity. | ||
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/messaging.md | ||
return ActivitySourceAccessor.ActivitySource.StartActivity(activityName, activityKind); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Diagnostics; | ||
|
||
namespace KafkaFlow | ||
{ | ||
internal interface IActivityFactory | ||
{ | ||
|
||
public Activity Start(string topicName, ActivityOperationType activityOperationType, ActivityKind activityKind); | ||
} | ||
} |
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