Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Elastic.Apm/Model/Error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
Expand Down Expand Up @@ -66,13 +65,16 @@ private void CheckAndCaptureBaggage(Transaction transaction)

//if context was not set prior we set it now to ensure we capture baggage for errors
//occuring during unsampled transactions
Context ??= transaction.Context.DeepCopy();
Context ??= transaction?.Context.DeepCopy();
Comment thread
JeremyBessonElastic marked this conversation as resolved.

foreach (var baggage in Activity.Current.Baggage)
{
if (!WildcardMatcher.IsAnyMatch(Configuration.BaggageToAttach, baggage.Key))
continue;

// The context is created only if there is a baggage value to insert.
Context ??= new Context();

var newKey = $"baggage.{baggage.Key}";
var labels = Context.InternalLabels.Value;
labels[newKey] = baggage.Value;
Expand Down
Loading