Skip to content

Commit 0f9f507

Browse files
authored
Update project OpenTelemetry.Exporter.Jaeger to use file scoped namespaces (#4684)
1 parent 8de6e69 commit 0f9f507

26 files changed

+2589
-2615
lines changed

src/OpenTelemetry.Exporter.Jaeger/Implementation/Batch.cs

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,67 +17,66 @@
1717
using Thrift.Protocol;
1818
using Thrift.Protocol.Entities;
1919

20-
namespace OpenTelemetry.Exporter.Jaeger.Implementation
20+
namespace OpenTelemetry.Exporter.Jaeger.Implementation;
21+
22+
internal sealed class Batch
2123
{
22-
internal sealed class Batch
24+
public Batch(Process process, TProtocol protocol)
2325
{
24-
public Batch(Process process, TProtocol protocol)
25-
{
26-
this.BatchBeginMessage = GenerateBeginMessage(process, protocol, out int spanCountPosition);
27-
this.SpanCountPosition = spanCountPosition;
28-
this.BatchEndMessage = GenerateEndMessage(protocol);
29-
}
26+
this.BatchBeginMessage = GenerateBeginMessage(process, protocol, out int spanCountPosition);
27+
this.SpanCountPosition = spanCountPosition;
28+
this.BatchEndMessage = GenerateEndMessage(protocol);
29+
}
3030

31-
public byte[] BatchBeginMessage { get; }
31+
public byte[] BatchBeginMessage { get; }
3232

33-
public int SpanCountPosition { get; set; }
33+
public int SpanCountPosition { get; set; }
3434

35-
public byte[] BatchEndMessage { get; }
35+
public byte[] BatchEndMessage { get; }
3636

37-
public int MinimumMessageSize => this.BatchBeginMessage.Length
38-
+ this.BatchEndMessage.Length;
37+
public int MinimumMessageSize => this.BatchBeginMessage.Length
38+
+ this.BatchEndMessage.Length;
3939

40-
private static byte[] GenerateBeginMessage(Process process, TProtocol oprot, out int spanCountPosition)
41-
{
42-
var struc = new TStruct("Batch");
40+
private static byte[] GenerateBeginMessage(Process process, TProtocol oprot, out int spanCountPosition)
41+
{
42+
var struc = new TStruct("Batch");
4343

44-
oprot.WriteStructBegin(struc);
44+
oprot.WriteStructBegin(struc);
4545

46-
var field = new TField
47-
{
48-
Name = "process",
49-
Type = TType.Struct,
50-
ID = 1,
51-
};
46+
var field = new TField
47+
{
48+
Name = "process",
49+
Type = TType.Struct,
50+
ID = 1,
51+
};
5252

53-
oprot.WriteFieldBegin(field);
54-
process.Write(oprot);
55-
oprot.WriteFieldEnd();
53+
oprot.WriteFieldBegin(field);
54+
process.Write(oprot);
55+
oprot.WriteFieldEnd();
5656

57-
field.Name = "spans";
58-
field.Type = TType.List;
59-
field.ID = 2;
57+
field.Name = "spans";
58+
field.Type = TType.List;
59+
field.ID = 2;
6060

61-
oprot.WriteFieldBegin(field);
61+
oprot.WriteFieldBegin(field);
6262

63-
oprot.WriteListBegin(new TList(TType.Struct, 0), out spanCountPosition);
63+
oprot.WriteListBegin(new TList(TType.Struct, 0), out spanCountPosition);
6464

65-
byte[] beginMessage = oprot.WrittenData.ToArray();
66-
oprot.Clear();
67-
return beginMessage;
68-
}
65+
byte[] beginMessage = oprot.WrittenData.ToArray();
66+
oprot.Clear();
67+
return beginMessage;
68+
}
6969

70-
private static byte[] GenerateEndMessage(TProtocol oprot)
71-
{
72-
oprot.WriteListEnd();
70+
private static byte[] GenerateEndMessage(TProtocol oprot)
71+
{
72+
oprot.WriteListEnd();
7373

74-
oprot.WriteFieldEnd();
75-
oprot.WriteFieldStop();
76-
oprot.WriteStructEnd();
74+
oprot.WriteFieldEnd();
75+
oprot.WriteFieldStop();
76+
oprot.WriteStructEnd();
7777

78-
byte[] endMessage = oprot.WrittenData.ToArray();
79-
oprot.Clear();
80-
return endMessage;
81-
}
78+
byte[] endMessage = oprot.WrittenData.ToArray();
79+
oprot.Clear();
80+
return endMessage;
8281
}
8382
}

src/OpenTelemetry.Exporter.Jaeger/Implementation/EmitBatchArgs.cs

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,58 +17,57 @@
1717
using Thrift.Protocol;
1818
using Thrift.Protocol.Entities;
1919

20-
namespace OpenTelemetry.Exporter.Jaeger.Implementation
20+
namespace OpenTelemetry.Exporter.Jaeger.Implementation;
21+
22+
internal sealed class EmitBatchArgs
2123
{
22-
internal sealed class EmitBatchArgs
24+
public EmitBatchArgs(TProtocol protocol)
2325
{
24-
public EmitBatchArgs(TProtocol protocol)
25-
{
26-
this.EmitBatchArgsBeginMessage = GenerateBeginMessage(protocol, out int seqIdPosition);
27-
this.SeqIdPosition = seqIdPosition;
28-
this.EmitBatchArgsEndMessage = GenerateEndMessage(protocol);
29-
}
26+
this.EmitBatchArgsBeginMessage = GenerateBeginMessage(protocol, out int seqIdPosition);
27+
this.SeqIdPosition = seqIdPosition;
28+
this.EmitBatchArgsEndMessage = GenerateEndMessage(protocol);
29+
}
3030

31-
public byte[] EmitBatchArgsBeginMessage { get; }
31+
public byte[] EmitBatchArgsBeginMessage { get; }
3232

33-
public int SeqIdPosition { get; }
33+
public int SeqIdPosition { get; }
3434

35-
public byte[] EmitBatchArgsEndMessage { get; }
35+
public byte[] EmitBatchArgsEndMessage { get; }
3636

37-
public int MinimumMessageSize => this.EmitBatchArgsBeginMessage.Length
38-
+ this.EmitBatchArgsEndMessage.Length;
37+
public int MinimumMessageSize => this.EmitBatchArgsBeginMessage.Length
38+
+ this.EmitBatchArgsEndMessage.Length;
3939

40-
private static byte[] GenerateBeginMessage(TProtocol oprot, out int seqIdPosition)
41-
{
42-
oprot.WriteMessageBegin(new TMessage("emitBatch", TMessageType.Oneway, 0), out seqIdPosition);
40+
private static byte[] GenerateBeginMessage(TProtocol oprot, out int seqIdPosition)
41+
{
42+
oprot.WriteMessageBegin(new TMessage("emitBatch", TMessageType.Oneway, 0), out seqIdPosition);
4343

44-
var struc = new TStruct("emitBatch_args");
45-
oprot.WriteStructBegin(struc);
44+
var struc = new TStruct("emitBatch_args");
45+
oprot.WriteStructBegin(struc);
4646

47-
var field = new TField
48-
{
49-
Name = "batch",
50-
Type = TType.Struct,
51-
ID = 1,
52-
};
47+
var field = new TField
48+
{
49+
Name = "batch",
50+
Type = TType.Struct,
51+
ID = 1,
52+
};
5353

54-
oprot.WriteFieldBegin(field);
54+
oprot.WriteFieldBegin(field);
5555

56-
byte[] beginMessage = oprot.WrittenData.ToArray();
57-
oprot.Clear();
58-
return beginMessage;
59-
}
56+
byte[] beginMessage = oprot.WrittenData.ToArray();
57+
oprot.Clear();
58+
return beginMessage;
59+
}
6060

61-
private static byte[] GenerateEndMessage(TProtocol oprot)
62-
{
63-
oprot.WriteFieldEnd();
64-
oprot.WriteFieldStop();
65-
oprot.WriteStructEnd();
61+
private static byte[] GenerateEndMessage(TProtocol oprot)
62+
{
63+
oprot.WriteFieldEnd();
64+
oprot.WriteFieldStop();
65+
oprot.WriteStructEnd();
6666

67-
oprot.WriteMessageEnd();
67+
oprot.WriteMessageEnd();
6868

69-
byte[] endMessage = oprot.WrittenData.ToArray();
70-
oprot.Clear();
71-
return endMessage;
72-
}
69+
byte[] endMessage = oprot.WrittenData.ToArray();
70+
oprot.Clear();
71+
return endMessage;
7372
}
7473
}

src/OpenTelemetry.Exporter.Jaeger/Implementation/IJaegerClient.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414
// limitations under the License.
1515
// </copyright>
1616

17-
namespace OpenTelemetry.Exporter.Jaeger.Implementation
17+
namespace OpenTelemetry.Exporter.Jaeger.Implementation;
18+
19+
internal interface IJaegerClient : IDisposable
1820
{
19-
internal interface IJaegerClient : IDisposable
20-
{
21-
bool Connected { get; }
21+
bool Connected { get; }
2222

23-
void Connect();
23+
void Connect();
2424

25-
void Close();
25+
void Close();
2626

27-
int Send(byte[] buffer, int offset, int count);
28-
}
27+
int Send(byte[] buffer, int offset, int count);
2928
}

src/OpenTelemetry.Exporter.Jaeger/Implementation/Int128.cs

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,46 @@
1717
using System.Diagnostics;
1818
using System.Runtime.InteropServices;
1919

20-
namespace OpenTelemetry.Exporter.Jaeger.Implementation
21-
{
22-
internal readonly struct Int128
23-
{
24-
public static Int128 Empty;
20+
namespace OpenTelemetry.Exporter.Jaeger.Implementation;
2521

26-
private const int SpanIdBytes = 8;
27-
private const int TraceIdBytes = 16;
22+
internal readonly struct Int128
23+
{
24+
public static Int128 Empty;
2825

29-
public Int128(ActivitySpanId spanId)
30-
{
31-
Span<byte> bytes = stackalloc byte[SpanIdBytes];
32-
spanId.CopyTo(bytes);
26+
private const int SpanIdBytes = 8;
27+
private const int TraceIdBytes = 16;
3328

34-
if (BitConverter.IsLittleEndian)
35-
{
36-
bytes.Reverse();
37-
}
29+
public Int128(ActivitySpanId spanId)
30+
{
31+
Span<byte> bytes = stackalloc byte[SpanIdBytes];
32+
spanId.CopyTo(bytes);
3833

39-
var longs = MemoryMarshal.Cast<byte, long>(bytes);
40-
this.High = 0;
41-
this.Low = longs[0];
34+
if (BitConverter.IsLittleEndian)
35+
{
36+
bytes.Reverse();
4237
}
4338

44-
public Int128(ActivityTraceId traceId)
45-
{
46-
Span<byte> bytes = stackalloc byte[TraceIdBytes];
47-
traceId.CopyTo(bytes);
39+
var longs = MemoryMarshal.Cast<byte, long>(bytes);
40+
this.High = 0;
41+
this.Low = longs[0];
42+
}
4843

49-
if (BitConverter.IsLittleEndian)
50-
{
51-
bytes.Reverse();
52-
}
44+
public Int128(ActivityTraceId traceId)
45+
{
46+
Span<byte> bytes = stackalloc byte[TraceIdBytes];
47+
traceId.CopyTo(bytes);
5348

54-
var longs = MemoryMarshal.Cast<byte, long>(bytes);
55-
this.High = BitConverter.IsLittleEndian ? longs[1] : longs[0];
56-
this.Low = BitConverter.IsLittleEndian ? longs[0] : longs[1];
49+
if (BitConverter.IsLittleEndian)
50+
{
51+
bytes.Reverse();
5752
}
5853

59-
public long High { get; }
60-
61-
public long Low { get; }
54+
var longs = MemoryMarshal.Cast<byte, long>(bytes);
55+
this.High = BitConverter.IsLittleEndian ? longs[1] : longs[0];
56+
this.Low = BitConverter.IsLittleEndian ? longs[0] : longs[1];
6257
}
58+
59+
public long High { get; }
60+
61+
public long Low { get; }
6362
}

0 commit comments

Comments
 (0)