-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tracer] Finishes Adding Support for ActivityLink (#5627)
* Add some basic unit tests for Activity tags * Remove TODOs from OtlpHelpers * Support dot notation arrays in Activity tags * Update Activity-based snapshots for dot-notation * Add multi-dimensional test * Re-add empty arrays to tags * Update snapshots * Add initial ActivityLink support * Get snapshots passing * Update Benchmarks for Activity * Update snapshots * Setting SpanLink as a tag as opposed to using JsonSerializer * Setting isRemote based on context * Updating how we handle the tracestate * Updated to actually use the context state if dd= is present there * Fixing expected tracestate value * Fixing Origin and adding Attributes * Deleted ActivityLinkConverterTests class * Addressing nullability comments * Addressing nitpicks * Scrubbed and updated snapshots * Updating Snapshots from build * Updating difference on expected span count --------- Co-authored-by: Steven Bouwkamp <steven.bouwkamp@datadoghq.com>
- Loading branch information
Showing
28 changed files
with
1,264 additions
and
297 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
tracer/src/Datadog.Trace/Activity/DuckTypes/ActivityTraceFlags.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// <copyright file="ActivityTraceFlags.cs" company="Datadog"> | ||
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. | ||
// </copyright> | ||
|
||
#nullable enable | ||
|
||
namespace Datadog.Trace.Activity.DuckTypes; | ||
|
||
internal enum ActivityTraceFlags | ||
{ | ||
None = 0, | ||
Recorded = 1 | ||
} |
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
27 changes: 27 additions & 0 deletions
27
tracer/src/Datadog.Trace/Activity/DuckTypes/IActivityContext.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// <copyright file="IActivityContext.cs" company="Datadog"> | ||
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. | ||
// </copyright> | ||
|
||
#nullable enable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Datadog.Trace.DuckTyping; | ||
|
||
namespace Datadog.Trace.Activity.DuckTypes; | ||
|
||
// https://github.com/dotnet/runtime/blob/f2a9ef8d392b72e6f039ec0b87f3eae4307c6cae/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityContext.cs#L13 | ||
|
||
internal interface IActivityContext : IDuckType | ||
{ | ||
IActivityTraceId TraceId { get; } | ||
|
||
IActivitySpanId SpanId { get; } | ||
|
||
ActivityTraceFlags TraceFlags { get; } | ||
|
||
string? TraceState { get; } | ||
|
||
bool IsRemote { get; } | ||
} |
21 changes: 21 additions & 0 deletions
21
tracer/src/Datadog.Trace/Activity/DuckTypes/IActivityLink.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// <copyright file="IActivityLink.cs" company="Datadog"> | ||
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. | ||
// </copyright> | ||
|
||
#nullable enable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Datadog.Trace.DuckTyping; | ||
|
||
namespace Datadog.Trace.Activity.DuckTypes; | ||
|
||
// https://github.com/dotnet/runtime/blob/f2a9ef8d392b72e6f039ec0b87f3eae4307c6cae/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityLink.cs#L15 | ||
|
||
internal interface IActivityLink : IDuckType | ||
{ | ||
IActivityContext Context { get; } | ||
|
||
IEnumerable<KeyValuePair<string, object?>>? Tags { get; } | ||
} |
16 changes: 16 additions & 0 deletions
16
tracer/src/Datadog.Trace/Activity/DuckTypes/IActivitySpanId.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// <copyright file="IActivitySpanId.cs" company="Datadog"> | ||
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. | ||
// </copyright> | ||
|
||
#nullable enable | ||
|
||
using Datadog.Trace.DuckTyping; | ||
|
||
namespace Datadog.Trace.Activity.DuckTypes; | ||
|
||
internal interface IActivitySpanId : IDuckType | ||
{ | ||
[DuckField(Name = "_hexString")] | ||
string? SpanId { get; } | ||
} |
16 changes: 16 additions & 0 deletions
16
tracer/src/Datadog.Trace/Activity/DuckTypes/IActivityTraceId.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// <copyright file="IActivityTraceId.cs" company="Datadog"> | ||
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. | ||
// </copyright> | ||
|
||
#nullable enable | ||
|
||
using Datadog.Trace.DuckTyping; | ||
|
||
namespace Datadog.Trace.Activity.DuckTypes; | ||
|
||
internal interface IActivityTraceId : IDuckType | ||
{ | ||
[DuckField(Name = "_hexString")] | ||
string? TraceId { get; } | ||
} |
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
Oops, something went wrong.