Adding files with blank space (#600)
This commit is contained in:
parent
48dbba3304
commit
fbcd1a0244
|
|
@ -284,7 +284,7 @@ namespace OpenTelemetry.Context.Propagation
|
|||
private static void LogTooManyItemsInTracestate()
|
||||
{
|
||||
#if API
|
||||
OpenTelemetryApiEventSource.Log.TooManyItemsInTracestate();
|
||||
OpenTelemetryApiEventSource.Log.TooManyItemsInTracestate();
|
||||
#else
|
||||
OpenTelemetrySdkEventSource.Log.TooManyItemsInTracestate();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ namespace OpenTelemetry.Exporter.LightStep.Implementation
|
|||
var sc = new SpanContext { SpanId = data.ParentSpanId.ToLSSpanId() };
|
||||
span.References.Add(new Reference
|
||||
{
|
||||
Relationship = "CHILD_OF", SpanContext = sc,
|
||||
Relationship = "CHILD_OF",
|
||||
SpanContext = sc,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +42,8 @@ namespace OpenTelemetry.Exporter.LightStep.Implementation
|
|||
|
||||
span.SpanContext = new SpanContext
|
||||
{
|
||||
SpanId = spanId, TraceId = traceId,
|
||||
SpanId = spanId,
|
||||
TraceId = traceId,
|
||||
};
|
||||
span.StartTimestamp = data.StartTimestamp.UtcDateTime;
|
||||
span.DurationMicros = Convert.ToUInt64(Math.Abs(duration.Ticks) / 10);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// <copyright file="DiagnosticSourceListener.cs" company="OpenTelemetry Authors">
|
||||
// <copyright file="DiagnosticSourceListener.cs" company="OpenTelemetry Authors">
|
||||
// Copyright 2018, OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ namespace OpenTelemetry.Collector.Dependencies.Tests
|
|||
parent.TraceStateString = "k1=v1,k2=v2";
|
||||
parent.ActivityTraceFlags = ActivityTraceFlags.Recorded;
|
||||
|
||||
using (new HttpClientCollector(tracer, new HttpClientCollectorOptions {TextFormat = textFormat.Object}))
|
||||
using (new HttpClientCollector(tracer, new HttpClientCollectorOptions { TextFormat = textFormat.Object }))
|
||||
{
|
||||
using var c = new HttpClient();
|
||||
await c.SendAsync(request);
|
||||
|
|
|
|||
|
|
@ -1478,7 +1478,7 @@ namespace OpenTelemetry.Exporter.ApplicationInsights.Tests
|
|||
});
|
||||
|
||||
var span = CreateSpanData(name, traceId, parentSpanId, traceOptions,
|
||||
tracestate, kind, status, new SpanCreationOptions { Links = new [] { parentLink }});
|
||||
tracestate, kind, status, new SpanCreationOptions { Links = new[] { parentLink } });
|
||||
|
||||
var sentItems = ConvertSpan(span);
|
||||
|
||||
|
|
@ -1738,7 +1738,7 @@ namespace OpenTelemetry.Exporter.ApplicationInsights.Tests
|
|||
};
|
||||
|
||||
var span = CreateSpanData(name, traceId, parentSpanId, traceOptions,
|
||||
tracestate, spanKind, status, null, default, new[] {new Event("test message1")},
|
||||
tracestate, spanKind, status, null, default, new[] { new Event("test message1") },
|
||||
new Resource(resource));
|
||||
var sentItems = ConvertSpan(span);
|
||||
|
||||
|
|
@ -1866,14 +1866,14 @@ namespace OpenTelemetry.Exporter.ApplicationInsights.Tests
|
|||
var link1Enqueued = startTimestamp.AddMilliseconds(-200).ToUnixTimeMilliseconds();
|
||||
var link2Enqueued = startTimestamp.AddMilliseconds(-300).ToUnixTimeMilliseconds();
|
||||
|
||||
var link0 = new Link(RandomContext(), new Dictionary<string, object> {["enqueuedTime"] = link0Enqueued });
|
||||
var link0 = new Link(RandomContext(), new Dictionary<string, object> { ["enqueuedTime"] = link0Enqueued });
|
||||
var link1 = new Link(RandomContext(), new Dictionary<string, object> { ["enqueuedTime"] = link1Enqueued });
|
||||
var link2 = new Link(RandomContext(), new Dictionary<string, object> {["enqueuedTime"] = link2Enqueued });
|
||||
var link2 = new Link(RandomContext(), new Dictionary<string, object> { ["enqueuedTime"] = link2Enqueued });
|
||||
|
||||
var options = new SpanCreationOptions
|
||||
{
|
||||
StartTimestamp = startTimestamp,
|
||||
Links = new List<Link> {link0, link1, link2},
|
||||
Links = new List<Link> { link0, link1, link2 },
|
||||
Attributes = new Dictionary<string, object>
|
||||
{
|
||||
["az.namespace"] = "Microsoft.EventHub",
|
||||
|
|
@ -2278,7 +2278,7 @@ namespace OpenTelemetry.Exporter.ApplicationInsights.Tests
|
|||
|
||||
processor.Setup(p => p.OnEnd(It.IsAny<SpanData>()));
|
||||
|
||||
var tracer = TracerFactory.Create(b =>b
|
||||
var tracer = TracerFactory.Create(b => b
|
||||
.SetResource(resource)
|
||||
.AddProcessorPipeline(p => p.AddProcessor(_ => processor.Object)))
|
||||
.GetTracer(null);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ using Xunit;
|
|||
|
||||
namespace OpenTelemetry.Exporter.Jaeger.Tests.Implementation
|
||||
{
|
||||
public class ThriftUdpClientTransportTests: IDisposable
|
||||
public class ThriftUdpClientTransportTests : IDisposable
|
||||
{
|
||||
private MemoryStream testingMemoryStream = new MemoryStream();
|
||||
private readonly Mock<IJaegerClient> mockClient = new Mock<IJaegerClient>();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
using System.Diagnostics;
|
||||
|
||||
using System.Diagnostics;
|
||||
using Moq;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using Moq;
|
||||
using OpenTelemetry.Trace;
|
||||
using Xunit;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using OpenTelemetry.Trace;
|
||||
using Xunit;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// </copyright>
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using global::OpenTracing.Tag;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace OpenTelemetry.Tests
|
|||
[Fact]
|
||||
public void NoEviction()
|
||||
{
|
||||
var eq = new EvictingQueue<int>(4) {0, 1, 2};
|
||||
var eq = new EvictingQueue<int>(4) { 0, 1, 2 };
|
||||
|
||||
var items = eq.ToArray();
|
||||
Assert.Equal(3, items.Length);
|
||||
|
|
@ -65,7 +65,7 @@ namespace OpenTelemetry.Tests
|
|||
[Fact]
|
||||
public void Eviction()
|
||||
{
|
||||
var eq = new EvictingQueue<int>(4) {0, 1, 2, 3, 4};
|
||||
var eq = new EvictingQueue<int>(4) { 0, 1, 2, 3, 4 };
|
||||
Assert.Equal(4, eq.Count);
|
||||
Assert.Equal(1, eq.DroppedItems);
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ namespace OpenTelemetry.Tests
|
|||
[Fact]
|
||||
public void MaxItems0()
|
||||
{
|
||||
var eq = new EvictingQueue<int>(0) {0};
|
||||
var eq = new EvictingQueue<int>(0) { 0 };
|
||||
Assert.Equal(0, eq.Count);
|
||||
Assert.Equal(1, eq.DroppedItems);
|
||||
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ namespace OpenTelemetry.Context.Test
|
|||
public async void TestContextInheritance()
|
||||
{
|
||||
DistributedContext.Carrier = AsyncLocalDistributedContextCarrier.Instance;
|
||||
var list1 = new List<CorrelationContextEntry>(1) {new CorrelationContextEntry(KEY_1, VALUE_1)};
|
||||
var list2 = new List<CorrelationContextEntry>(2) {new CorrelationContextEntry(KEY_1, VALUE_1), new CorrelationContextEntry(KEY_2, VALUE_2)};
|
||||
var list1 = new List<CorrelationContextEntry>(1) { new CorrelationContextEntry(KEY_1, VALUE_1) };
|
||||
var list2 = new List<CorrelationContextEntry>(2) { new CorrelationContextEntry(KEY_1, VALUE_1), new CorrelationContextEntry(KEY_2, VALUE_2) };
|
||||
|
||||
DistributedContext.SetCurrent(DistributedContext.Empty);
|
||||
await Task.Run(() => Assert.Equal(DistributedContext.Empty, DistributedContext.Current));
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
var dc = serializer.FromByteArray(serializer.ToByteArray(DistributedContext.Empty));
|
||||
Assert.Empty(dc.CorrelationContext.Entries);
|
||||
|
||||
dc = serializer.FromByteArray(new byte[] {SerializationUtils.VersionId}); // One byte that represents Version ID.
|
||||
dc = serializer.FromByteArray(new byte[] { SerializationUtils.VersionId }); // One byte that represents Version ID.
|
||||
Assert.Empty(dc.CorrelationContext.Entries);
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
EncodeTagToOutPut("Key2", "Value2", output);
|
||||
|
||||
var expected = DistributedContextBuilder.CreateContext(
|
||||
new List<CorrelationContextEntry>(2) {new CorrelationContextEntry("Key1", "Value1"), new CorrelationContextEntry("Key2", "Value2")}
|
||||
new List<CorrelationContextEntry>(2) { new CorrelationContextEntry("Key1", "Value1"), new CorrelationContextEntry("Key2", "Value2") }
|
||||
);
|
||||
Assert.Equal(expected, serializer.FromByteArray(output.ToArray()));
|
||||
}
|
||||
|
|
@ -204,7 +204,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
|
||||
// Write unknown field ID 1.
|
||||
output.WriteByte(1);
|
||||
output.Write(new byte[] {1, 2, 3, 4}, 0, 4);
|
||||
output.Write(new byte[] { 1, 2, 3, 4 }, 0, 4);
|
||||
|
||||
EncodeTagToOutPut("Key3", "Value3", output);
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
|
||||
// Write unknown field ID 1.
|
||||
output.WriteByte(1);
|
||||
output.Write(new byte[] {1, 2, 3, 4}, 0, 4);
|
||||
output.Write(new byte[] { 1, 2, 3, 4 }, 0, 4);
|
||||
|
||||
EncodeTagToOutPut("Key", "Value", output);
|
||||
Assert.Equal(DistributedContext.Empty, serializer.FromByteArray(output.ToArray()));
|
||||
|
|
@ -242,13 +242,13 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
[Fact]
|
||||
public void TestDeserializeWrongVersionId()
|
||||
{
|
||||
Assert.Equal(DistributedContext.Empty, serializer.FromByteArray(new byte[] {SerializationUtils.VersionId + 1}));
|
||||
Assert.Equal(DistributedContext.Empty, serializer.FromByteArray(new byte[] { SerializationUtils.VersionId + 1 }));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestDeserializeNegativeVersionId()
|
||||
{
|
||||
Assert.Equal(DistributedContext.Empty, serializer.FromByteArray(new byte[] {0xff}));
|
||||
Assert.Equal(DistributedContext.Empty, serializer.FromByteArray(new byte[] { 0xff }));
|
||||
}
|
||||
|
||||
// <tag_encoding> ==
|
||||
|
|
@ -270,7 +270,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
var bytes = new byte[VarInt.VarIntSize(length)];
|
||||
VarInt.PutVarInt(length, bytes, 0);
|
||||
output.Write(bytes, 0, bytes.Length);
|
||||
var inPutBytes= Encoding.UTF8.GetBytes(input);
|
||||
var inPutBytes = Encoding.UTF8.GetBytes(input);
|
||||
output.Write(inPutBytes, 0, inPutBytes.Length);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,12 +94,12 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
|
||||
var actual = serializer.ToByteArray(DistributedContextBuilder.CreateContext(list));
|
||||
var tagsList = tags.ToList();
|
||||
var tagPermutation= Permutate(tagsList, tagsList.Count);
|
||||
var tagPermutation = Permutate(tagsList, tagsList.Count);
|
||||
ISet<string> possibleOutPuts = new HashSet<string>();
|
||||
|
||||
foreach (var distributedContextEntries in tagPermutation)
|
||||
{
|
||||
var l = (List<CorrelationContextEntry>) distributedContextEntries;
|
||||
var l = (List<CorrelationContextEntry>)distributedContextEntries;
|
||||
var expected = new MemoryStream();
|
||||
expected.WriteByte(SerializationUtils.VersionId);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace OpenTelemetry.Metrics.Test
|
|||
{
|
||||
public class CounterAggregatorTest
|
||||
{
|
||||
private class UpdateThreadArguments<T> where T: struct
|
||||
private class UpdateThreadArguments<T> where T : struct
|
||||
{
|
||||
public ManualResetEvent mreToBlockUpdateThread;
|
||||
public ManualResetEvent mreToEnsureAllThreadsStart;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace OpenTelemetry.Metrics.Test
|
|||
{
|
||||
public class MinMaxSumCountAggregatorTest
|
||||
{
|
||||
private class UpdateThreadArguments<T> where T: struct
|
||||
private class UpdateThreadArguments<T> where T : struct
|
||||
{
|
||||
public ManualResetEvent mreToBlockUpdateThread;
|
||||
public ManualResetEvent mreToEnsureAllThreadsStart;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace OpenTelemetry.Metrics.Test
|
|||
Assert.Equal(3, testProcessor.longMetrics.Count);
|
||||
Assert.Equal(3, testProcessor.longMetrics.Count(m => m.MetricName == "testCounter"));
|
||||
|
||||
Assert.Single(testProcessor.longMetrics.Where(m => (m.Data as SumData<long>).Sum == 110 ));
|
||||
Assert.Single(testProcessor.longMetrics.Where(m => (m.Data as SumData<long>).Sum == 110));
|
||||
Assert.Single(testProcessor.longMetrics.Where(m => (m.Data as SumData<long>).Sum == 200));
|
||||
Assert.Single(testProcessor.longMetrics.Where(m => (m.Data as SumData<long>).Sum == 210));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace OpenTelemetry.Impl.Resources
|
|||
public void CreateResource_EmptyAttributeValue()
|
||||
{
|
||||
// Arrange
|
||||
var attributes = new Dictionary<string, object> {{"EmptyValue", string.Empty}};
|
||||
var attributes = new Dictionary<string, object> { { "EmptyValue", string.Empty } };
|
||||
|
||||
// does not throw
|
||||
var resource = new Resource(attributes);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace OpenTelemetry.Tests.Impl.Resources
|
|||
{
|
||||
var resource = OpenTelemetry.Resources.Resources.CreateServiceResource("my-service");
|
||||
Assert.Equal(2, resource.Attributes.Count());
|
||||
Assert.Contains(new KeyValuePair<string ,object>(Resource.ServiceNameKey, "my-service"), resource.Attributes);
|
||||
Assert.Contains(new KeyValuePair<string, object>(Resource.ServiceNameKey, "my-service"), resource.Attributes);
|
||||
Assert.Single(resource.Attributes.Where(kvp => kvp.Key == Resource.ServiceNameKey));
|
||||
Assert.True(Guid.TryParse((string)resource.Attributes.Single(kvp => kvp.Key == Resource.ServiceInstanceIdKey).Value, out _));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace OpenTelemetry.Tests.Impl.Trace.Config
|
|||
|
||||
});
|
||||
|
||||
var broadcastProcessor = new BroadcastProcessor(new []{ processor1, processor2 });
|
||||
var broadcastProcessor = new BroadcastProcessor(new[] { processor1, processor2 });
|
||||
|
||||
var tracer = TracerFactory.Create(_ => { }).GetTracer(null);
|
||||
var span = (SpanSdk)tracer.StartSpan("foo");
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace OpenTelemetry.Trace.Config.Test
|
|||
[Fact]
|
||||
public void UpdateTraceParams_NonPositiveMaxNumberOfAttributes()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new TracerConfiguration(0 ,1, 1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new TracerConfiguration(0, 1, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
|
||||
var testExporter = new TestExporter(spans =>
|
||||
{
|
||||
exporterCalledCount ++;
|
||||
exporterCalledCount++;
|
||||
Assert.Single(spans);
|
||||
Assert.IsType<SpanData>(spans.Single());
|
||||
});
|
||||
|
|
@ -136,7 +136,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
var processCalledCount = 0;
|
||||
|
||||
TestProcessor testProcessor1 = null;
|
||||
var testProcessor2 = new TestProcessor(_ => processCalledCount ++);
|
||||
var testProcessor2 = new TestProcessor(_ => processCalledCount++);
|
||||
|
||||
var tracerFactory = TracerFactory.Create(b => b
|
||||
.AddProcessorPipeline(p => p
|
||||
|
|
@ -210,9 +210,11 @@ namespace OpenTelemetry.Trace.Test
|
|||
[Fact]
|
||||
public void GetTracerReturnsTracerWithResourceOverriddenBySetResource()
|
||||
{
|
||||
var tracerFactory = TracerFactory.Create(b => {
|
||||
var tracerFactory = TracerFactory.Create(b =>
|
||||
{
|
||||
b.SetResource(new Resource(new Dictionary<string, object>() { { "a", "b" } }))
|
||||
.SetResource(new Resource(new Dictionary<string, object>() { { "a", "c" } })); });
|
||||
.SetResource(new Resource(new Dictionary<string, object>() { { "a", "c" } }));
|
||||
});
|
||||
var tracer = (TracerSdk)tracerFactory.GetTracer("foo", "semver:1.2.3");
|
||||
Assert.Equal("c", tracer.LibraryResource.Attributes.Single(kvp => kvp.Key == "a").Value);
|
||||
}
|
||||
|
|
@ -270,7 +272,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
public override void OnEnd(SpanData span)
|
||||
{
|
||||
this.onEnd?.Invoke(span);
|
||||
exporter?.ExportAsync(new[] {span}, default);
|
||||
exporter?.ExportAsync(new[] { span }, default);
|
||||
}
|
||||
|
||||
public override Task ShutdownAsync(CancellationToken cancellationToken)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ using Xunit;
|
|||
|
||||
namespace OpenTelemetry.Trace.Test
|
||||
{
|
||||
public class CurrentSpanTests: IDisposable
|
||||
public class CurrentSpanTests : IDisposable
|
||||
{
|
||||
private readonly Tracer tracer;
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
{
|
||||
var span = (SpanSdk)tracer.StartRootSpan("foo");
|
||||
|
||||
using(var scope1 = this.tracer.WithSpan(span))
|
||||
using (var scope1 = this.tracer.WithSpan(span))
|
||||
{
|
||||
using var scope2 = this.tracer.WithSpan(span);
|
||||
Assert.IsNotType<NoopDisposable>(scope1);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace OpenTelemetry.Trace.Export.Test
|
|||
[Fact]
|
||||
public void ProcessorDoesNotBlockOnExporter()
|
||||
{
|
||||
spanExporter = new TestExporter( async _ => await Task.Delay(500));
|
||||
spanExporter = new TestExporter(async _ => await Task.Delay(500));
|
||||
tracer = TracerFactory.Create(b => b
|
||||
.AddProcessorPipeline(p => p
|
||||
.SetExporter(spanExporter)
|
||||
|
|
@ -104,7 +104,7 @@ namespace OpenTelemetry.Trace.Export.Test
|
|||
|
||||
Assert.InRange(sw.Elapsed, TimeSpan.Zero, TimeSpan.FromMilliseconds(100));
|
||||
|
||||
var exported = WaitForSpans(spanExporter, 1, TimeSpan.FromMilliseconds(600));
|
||||
var exported = WaitForSpans(spanExporter, 1, TimeSpan.FromMilliseconds(600));
|
||||
|
||||
Assert.Single(exported);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
[Fact]
|
||||
public void ParseMissingTraceId()
|
||||
{
|
||||
var invalidHeaders = new Dictionary<string, string> {{B3Format.XB3SpanId, SpanIdBase16},};
|
||||
var invalidHeaders = new Dictionary<string, string> { { B3Format.XB3SpanId, SpanIdBase16 }, };
|
||||
Assert.Equal(SpanContext.BlankRemote, b3Format.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
[Fact]
|
||||
public void ParseMissingSpanId()
|
||||
{
|
||||
var invalidHeaders = new Dictionary<string, string> {{B3Format.XB3TraceId, TraceIdBase16}};
|
||||
var invalidHeaders = new Dictionary<string, string> { { B3Format.XB3TraceId, TraceIdBase16 } };
|
||||
Assert.Equal(SpanContext.BlankRemote, b3Format.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
[Fact]
|
||||
public void ParseMissingTraceId_SingleHeader()
|
||||
{
|
||||
var invalidHeaders = new Dictionary<string, string> {{B3Format.XB3Combined, $"-{SpanIdBase16}"}};
|
||||
var invalidHeaders = new Dictionary<string, string> { { B3Format.XB3Combined, $"-{SpanIdBase16}" } };
|
||||
Assert.Equal(SpanContext.BlankRemote, b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ namespace OpenTelemetry.Context.Propagation.Test
|
|||
[Fact]
|
||||
public void ParseMissingSpanId_SingleHeader()
|
||||
{
|
||||
var invalidHeaders = new Dictionary<string, string> {{B3Format.XB3Combined, $"{TraceIdBase16}-"}};
|
||||
var invalidHeaders = new Dictionary<string, string> { { B3Format.XB3Combined, $"{TraceIdBase16}-" } };
|
||||
Assert.Equal(SpanContext.BlankRemote, b3FormatSingleHeader.Extract(invalidHeaders, Getter));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace OpenTelemetry.Impl.Trace.Propagation
|
|||
{
|
||||
if (headers.TryGetValue(name, out var value))
|
||||
{
|
||||
return new [] { value };
|
||||
return new[] { value };
|
||||
}
|
||||
|
||||
return Empty;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace OpenTelemetry.Tests.Impl.Trace
|
|||
var startTime = DateTimeOffset.UtcNow.AddSeconds(-2);
|
||||
var endTime = DateTimeOffset.UtcNow.AddSeconds(-1);
|
||||
var span = tracer.StartSpan("name", parentContext, SpanKind.Producer,
|
||||
new SpanCreationOptions {Attributes = attributes, Links = new[] { link }, StartTimestamp = startTime,});
|
||||
new SpanCreationOptions { Attributes = attributes, Links = new[] { link }, StartTimestamp = startTime, });
|
||||
|
||||
span.AddEvent(evnt);
|
||||
span.Status = Status.FailedPrecondition;
|
||||
|
|
@ -135,8 +135,8 @@ namespace OpenTelemetry.Tests.Impl.Trace
|
|||
ActivityTraceFlags.Recorded, true, tracestate);
|
||||
|
||||
var attributes = new Dictionary<string, object> { ["key"] = "value", };
|
||||
var links = new [] { new Link(context) };
|
||||
var events = new [] { new Event("event") };
|
||||
var links = new[] { new Link(context) };
|
||||
var events = new[] { new Event("event") };
|
||||
|
||||
var startTime = DateTimeOffset.UtcNow.AddSeconds(-2);
|
||||
var endTime = DateTimeOffset.UtcNow.AddSeconds(-1);
|
||||
|
|
@ -220,7 +220,7 @@ namespace OpenTelemetry.Tests.Impl.Trace
|
|||
|
||||
var spanData1 = new SpanData("name", context, parentSpanId, SpanKind.Client, startTime, attributes, events, links, resource, Status.DataLoss, endTime);
|
||||
var spanData2 = new SpanData("name1", context, parentSpanId, SpanKind.Client, startTime, attributes, events, links, resource, Status.DataLoss, endTime);
|
||||
var spanData3 = new SpanData("name", otherContext, parentSpanId, SpanKind.Client, startTime, attributes, events, links, resource, Status.DataLoss, endTime);
|
||||
var spanData3 = new SpanData("name", otherContext, parentSpanId, SpanKind.Client, startTime, attributes, events, links, resource, Status.DataLoss, endTime);
|
||||
var spanData4 = new SpanData("name", context, default, SpanKind.Client, startTime, attributes, events, links, resource, Status.DataLoss, endTime);
|
||||
var spanData5 = new SpanData("name", context, parentSpanId, SpanKind.Server, startTime, attributes, events, links, resource, Status.DataLoss, endTime);
|
||||
var spanData6 = new SpanData("name", context, parentSpanId, SpanKind.Client, otherStartTime, attributes, events, links, resource, Status.DataLoss, endTime);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
{
|
||||
var tracer = (TracerSdk)tracerFactory.GetTracer("foo", "semver:1.0.0");
|
||||
|
||||
var traceState = new List<KeyValuePair<string, string>> {new KeyValuePair<string, string>("k1", "v1")};
|
||||
var traceState = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("k1", "v1") };
|
||||
var grandParentContext = new SpanContext(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom(), ActivityTraceFlags.Recorded, false, traceState);
|
||||
var parentSpan = (SpanSdk)tracer.StartSpan(SpanName, grandParentContext);
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
var parentContext = new SpanContext(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom(), ActivityTraceFlags.Recorded);
|
||||
|
||||
var startTimestamp = DateTimeOffset.Now.AddSeconds(-1);
|
||||
var span = (SpanSdk)tracer.StartSpan(SpanName, parentContext, SpanKind.Server, new SpanCreationOptions { StartTimestamp = startTimestamp } );
|
||||
var span = (SpanSdk)tracer.StartSpan(SpanName, parentContext, SpanKind.Server, new SpanCreationOptions { StartTimestamp = startTimestamp });
|
||||
|
||||
Assert.True(span.IsRecording);
|
||||
Assert.Equal(SpanKind.Server, span.Kind);
|
||||
|
|
@ -361,7 +361,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
var linkContext = new SpanContext(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom(), ActivityTraceFlags.Recorded);
|
||||
|
||||
var startTimestamp = PreciseTimestamp.GetUtcNow();
|
||||
var span = (SpanSdk)tracer.StartSpan(SpanName, parentContext, SpanKind.Server, new SpanCreationOptions { LinksFactory = () => new[] { new Link(linkContext) }} );
|
||||
var span = (SpanSdk)tracer.StartSpan(SpanName, parentContext, SpanKind.Server, new SpanCreationOptions { LinksFactory = () => new[] { new Link(linkContext) } });
|
||||
|
||||
Assert.True(span.IsRecording);
|
||||
Assert.Equal(SpanKind.Server, span.Kind);
|
||||
|
|
@ -490,7 +490,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
var firstLinkContext = new SpanContext(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom(), ActivityTraceFlags.Recorded);
|
||||
var secondLinkContext = new SpanContext(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom(), ActivityTraceFlags.None);
|
||||
|
||||
var span = (SpanSdk)tracer.StartSpanFromActivity(SpanName, activity, SpanKind.Server, new[] { new Link(firstLinkContext), new Link(secondLinkContext), });
|
||||
var span = (SpanSdk)tracer.StartSpanFromActivity(SpanName, activity, SpanKind.Server, new[] { new Link(firstLinkContext), new Link(secondLinkContext), });
|
||||
|
||||
Assert.True(span.IsRecording);
|
||||
Assert.Equal(SpanKind.Server, span.Kind);
|
||||
|
|
@ -874,7 +874,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
var link = new Link(contextLink);
|
||||
var tracer = tracerFactory.GetTracer(null);
|
||||
var startTime = DateTimeOffset.UtcNow.AddSeconds(-1);
|
||||
var span = (SpanSdk)tracer.StartRootSpan(SpanName, SpanKind.Client, new SpanCreationOptions { StartTimestamp = startTime, LinksFactory = () => new[] { link }});
|
||||
var span = (SpanSdk)tracer.StartRootSpan(SpanName, SpanKind.Client, new SpanCreationOptions { StartTimestamp = startTime, LinksFactory = () => new[] { link } });
|
||||
span.SetAttribute(
|
||||
"MySingleStringAttributeKey",
|
||||
"MySingleStringAttributeValue");
|
||||
|
|
@ -1019,17 +1019,17 @@ namespace OpenTelemetry.Trace.Test
|
|||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(new[] {true, false, true})]
|
||||
[InlineData(new[] {1L, 2L, 3L})]
|
||||
[InlineData(new[] {1UL, 2UL, 3UL})]
|
||||
[InlineData(new[] {1U, 2U, 3U})]
|
||||
[InlineData(new[] {1, 2, 3})]
|
||||
[InlineData(new sbyte[] {1, 2, 3})]
|
||||
[InlineData(new byte[] {1, 2, 3})]
|
||||
[InlineData(new short[] {1, 2, 3})]
|
||||
[InlineData(new ushort[] {1, 2, 3})]
|
||||
[InlineData(new[] {1.1d,2.2d,3.3d})]
|
||||
[InlineData(new[] {1.1f,2.2f,3.3f})]
|
||||
[InlineData(new[] { true, false, true })]
|
||||
[InlineData(new[] { 1L, 2L, 3L })]
|
||||
[InlineData(new[] { 1UL, 2UL, 3UL })]
|
||||
[InlineData(new[] { 1U, 2U, 3U })]
|
||||
[InlineData(new[] { 1, 2, 3 })]
|
||||
[InlineData(new sbyte[] { 1, 2, 3 })]
|
||||
[InlineData(new byte[] { 1, 2, 3 })]
|
||||
[InlineData(new short[] { 1, 2, 3 })]
|
||||
[InlineData(new ushort[] { 1, 2, 3 })]
|
||||
[InlineData(new[] { 1.1d, 2.2d, 3.3d })]
|
||||
[InlineData(new[] { 1.1f, 2.2f, 3.3f })]
|
||||
public void SetAttribute_Array(object array)
|
||||
{
|
||||
var tracer = tracerFactory.GetTracer(null);
|
||||
|
|
@ -1049,7 +1049,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
var tracer = tracerFactory.GetTracer(null);
|
||||
var span = (SpanSdk)tracer.StartRootSpan(SpanName);
|
||||
|
||||
var array = new[] {"1","2","3"};
|
||||
var array = new[] { "1", "2", "3" };
|
||||
span.SetAttribute("array", array);
|
||||
|
||||
Assert.Single(span.Attributes);
|
||||
|
|
@ -1065,7 +1065,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
var tracer = tracerFactory.GetTracer(null);
|
||||
var span = (SpanSdk)tracer.StartRootSpan(SpanName);
|
||||
|
||||
var array = new[] {1.1M, 2.2M, 3.3M};
|
||||
var array = new[] { 1.1M, 2.2M, 3.3M };
|
||||
span.SetAttribute("array", array);
|
||||
|
||||
Assert.Single(span.Attributes);
|
||||
|
|
@ -1080,7 +1080,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
var tracer = tracerFactory.GetTracer(null);
|
||||
var span = (SpanSdk)tracer.StartRootSpan(SpanName);
|
||||
|
||||
IEnumerable<int> array = new List<int> {1,2,3};
|
||||
IEnumerable<int> array = new List<int> { 1, 2, 3 };
|
||||
span.SetAttribute("array", array);
|
||||
|
||||
Assert.Single(span.Attributes);
|
||||
|
|
@ -1095,7 +1095,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
var tracer = tracerFactory.GetTracer(null);
|
||||
var span = (SpanSdk)tracer.StartRootSpan(SpanName);
|
||||
|
||||
var array = new object[] {1, "2", false};
|
||||
var array = new object[] { 1, "2", false };
|
||||
span.SetAttribute("array", array);
|
||||
|
||||
Assert.Single(span.Attributes);
|
||||
|
|
@ -1259,7 +1259,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
Assert.Same(ispan, span);
|
||||
Assert.NotNull(span);
|
||||
Assert.True(span.Context.IsValid);
|
||||
Assert.Equal(parentSpan.Context.SpanId,((SpanSdk)span).ParentSpanId);
|
||||
Assert.Equal(parentSpan.Context.SpanId, ((SpanSdk)span).ParentSpanId);
|
||||
}
|
||||
|
||||
Assert.False(tracer.CurrentSpan.Context.IsValid);
|
||||
|
|
@ -1579,7 +1579,7 @@ namespace OpenTelemetry.Trace.Test
|
|||
|
||||
var linkContext = new SpanContext(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom(), ActivityTraceFlags.Recorded);
|
||||
var activity = new Activity(SpanName).SetIdFormat(ActivityIdFormat.W3C).Start();
|
||||
using (var scope = tracer.StartActiveSpanFromActivity(SpanName, activity, SpanKind.Consumer, new [] { new Link(linkContext), }, out var ispan))
|
||||
using (var scope = tracer.StartActiveSpanFromActivity(SpanName, activity, SpanKind.Consumer, new[] { new Link(linkContext), }, out var ispan))
|
||||
{
|
||||
Assert.NotNull(scope);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace TestApp.AspNetCore._3._1
|
|||
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
if (_impl== null || await _impl.ProcessAsync(context))
|
||||
if (_impl == null || await _impl.ProcessAsync(context))
|
||||
{
|
||||
await _next(context);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue