Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Link/TelemetrySpan to accept SpanAttributes #1120

Merged
merged 12 commits into from
Aug 21, 2020
4 changes: 2 additions & 2 deletions src/OpenTelemetry.Api/Trace/Link.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public Link(in SpanContext spanContext)
/// </summary>
/// <param name="spanContext">Span context of a linked span.</param>
/// <param name="attributes">Link attributes.</param>
public Link(in SpanContext spanContext, ActivityTagsCollection attributes)
public Link(in SpanContext spanContext, SpanAttributes attributes)
eddynaka marked this conversation as resolved.
Show resolved Hide resolved
{
this.ActivityLink = new ActivityLink(spanContext.ActivityContext, attributes);
this.ActivityLink = new ActivityLink(spanContext.ActivityContext, attributes.Attributes);
}

/// <summary>
Expand Down
10 changes: 7 additions & 3 deletions test/OpenTelemetry.Tests/Trace/LinkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class LinkTest : IDisposable
{
private readonly IDictionary<string, object> attributesMap = new Dictionary<string, object>();
private readonly SpanContext spanContext;
private readonly ActivityTagsCollection tags;
private readonly SpanAttributes tags;

public LinkTest()
{
Expand All @@ -34,7 +34,11 @@ public LinkTest()
this.attributesMap.Add("MyAttributeKey1", 10L);
this.attributesMap.Add("MyAttributeKey2", true);
this.attributesMap.Add("MyAttributeKey3", 0.005);
this.tags = new ActivityTagsCollection(this.attributesMap);
this.tags = new SpanAttributes();
this.tags.Add("MyAttributeKey0", "MyStringAttribute");
this.tags.Add("MyAttributeKey1", 10L);
this.tags.Add("MyAttributeKey2", true);
this.tags.Add("MyAttributeKey3", 0.005);
eddynaka marked this conversation as resolved.
Show resolved Hide resolved
}

[Fact]
Expand Down Expand Up @@ -91,7 +95,7 @@ public void NotEquality()
[Fact]
public void NotEquality_WithAttributes()
{
var tag1 = new ActivityTagsCollection(new Dictionary<string, object>());
var tag1 = new SpanAttributes();
var tag2 = this.tags;
var link1 = new Link(this.spanContext, tag1);
var link2 = new Link(this.spanContext, tag2);
Expand Down