diff --git a/src/OpenTelemetry.Abstractions/Trace/Export/LinkList.cs b/src/OpenTelemetry.Abstractions/Trace/Export/LinkList.cs index e5c8e26a688..cee0da7f608 100644 --- a/src/OpenTelemetry.Abstractions/Trace/Export/LinkList.cs +++ b/src/OpenTelemetry.Abstractions/Trace/Export/LinkList.cs @@ -22,7 +22,7 @@ namespace OpenTelemetry.Trace.Export public sealed class LinkList : ILinks { - public static readonly LinkList Empty = new LinkList(new ILink[0], 0); + public static readonly LinkList Empty = new LinkList(Enumerable.Empty(), 0); internal LinkList(IEnumerable links, int droppedLinksCount) { diff --git a/src/OpenTelemetry.Abstractions/Trace/Export/TimedEvents.cs b/src/OpenTelemetry.Abstractions/Trace/Export/TimedEvents.cs index 6d7a20e7656..aa0f3b3865c 100644 --- a/src/OpenTelemetry.Abstractions/Trace/Export/TimedEvents.cs +++ b/src/OpenTelemetry.Abstractions/Trace/Export/TimedEvents.cs @@ -22,11 +22,11 @@ namespace OpenTelemetry.Trace.Export public sealed class TimedEvents : ITimedEvents { - public static readonly ITimedEvents Empty = new TimedEvents(new ITimedEvent[0], 0); + public static readonly ITimedEvents Empty = new TimedEvents(Enumerable.Empty>(), 0); internal TimedEvents(IEnumerable> events, int droppedEventsCount) { - this.Events = events ?? throw new ArgumentNullException("Null events"); + this.Events = events ?? throw new ArgumentNullException(nameof(events), "Null events"); this.DroppedEventsCount = droppedEventsCount; } diff --git a/src/OpenTelemetry.Exporter.Stackdriver/Implementation/MetricsConversions.cs b/src/OpenTelemetry.Exporter.Stackdriver/Implementation/MetricsConversions.cs index 7bed6c09936..be08f394a26 100644 --- a/src/OpenTelemetry.Exporter.Stackdriver/Implementation/MetricsConversions.cs +++ b/src/OpenTelemetry.Exporter.Stackdriver/Implementation/MetricsConversions.cs @@ -248,8 +248,7 @@ public static List CreateTimeSeriesList( timeSeries.Metric = GetMetric(view, labels, metricDescriptor, domain); var point = ExtractPointInInterval(viewData.Start, viewData.End, view.Aggregation, points); - var timeSeriesPoints = new List { point }; - timeSeries.Points.AddRange(timeSeriesPoints); + timeSeries.Points.Add(point); timeSeriesList.Add(timeSeries); } diff --git a/src/OpenTelemetry.Exporter.Zipkin/Implementation/ZipkinSpan.cs b/src/OpenTelemetry.Exporter.Zipkin/Implementation/ZipkinSpan.cs index 07691a5c077..5872bd165b0 100644 --- a/src/OpenTelemetry.Exporter.Zipkin/Implementation/ZipkinSpan.cs +++ b/src/OpenTelemetry.Exporter.Zipkin/Implementation/ZipkinSpan.cs @@ -52,7 +52,7 @@ internal class ZipkinSpan public ZipkinEndpoint RemoteEndpoint { get; set; } [JsonProperty("annotations")] - public List Annotations { get; set; } + public IList Annotations { get; set; } [JsonProperty("tags")] public Dictionary Tags { get; set; } diff --git a/src/OpenTelemetry/Stats/MutableViewData.cs b/src/OpenTelemetry/Stats/MutableViewData.cs index 3ea7de72faf..9666228bee8 100644 --- a/src/OpenTelemetry/Stats/MutableViewData.cs +++ b/src/OpenTelemetry/Stats/MutableViewData.cs @@ -53,7 +53,7 @@ protected MutableViewData(IView view) private static Func CreateDistributionData { get; } = (s) => { - var boxedBucketCounts = new List(); + var boxedBucketCounts = new List(s.BucketCounts.Length); foreach (var bucketCount in s.BucketCounts) { boxedBucketCounts.Add(bucketCount);