Minor improvement for the case that hashset is sufficient. (#2467)
This commit is contained in:
parent
32760fd47d
commit
c7a27dca06
|
|
@ -241,21 +241,21 @@ namespace OpenTelemetry.Trace
|
|||
}
|
||||
else
|
||||
{
|
||||
var activitySources = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
|
||||
var activitySources = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (var name in sources)
|
||||
{
|
||||
activitySources[name] = true;
|
||||
activitySources.Add(name);
|
||||
}
|
||||
|
||||
if (this.supportLegacyActivity)
|
||||
{
|
||||
activitySources[string.Empty] = true;
|
||||
activitySources.Add(string.Empty);
|
||||
}
|
||||
|
||||
// Function which takes ActivitySource and returns true/false to indicate if it should be subscribed to
|
||||
// or not.
|
||||
listener.ShouldListenTo = (activitySource) => activitySources.ContainsKey(activitySource.Name);
|
||||
listener.ShouldListenTo = (activitySource) => activitySources.Contains(activitySource.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue