Skip to content

Commit

Permalink
ConsoleExporter to print Activity(Span) Links (#2849)
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas authored Feb 2, 2022
1 parent 3833a4f commit 5a9d564
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/OpenTelemetry.Exporter.Console/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

Fix MetricExporter to respect Console and Debug flags.
Added `Activity.Links` support to `ConsoleActivityExporter`.

## 1.2.0-rc1

Expand Down
9 changes: 9 additions & 0 deletions src/OpenTelemetry.Exporter.Console/ConsoleActivityExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ public override ExportResult Export(in Batch<Activity> batch)
}
}

if (activity.Links.Any())
{
this.WriteLine("Activity.Links:");
foreach (var activityLink in activity.Links)
{
this.WriteLine($" {activityLink.Context.TraceId} {activityLink.Context.SpanId}");
}
}

var resource = this.ParentProvider.GetResource();
if (resource != Resource.Empty)
{
Expand Down

0 comments on commit 5a9d564

Please sign in to comment.