@@ -17,60 +17,60 @@ private ProtobufOtlpTagWriter()
1717 protected override void WriteIntegralTag ( ref OtlpTagWriterState state , string key , long value )
1818 {
1919 // Write KeyValue tag
20- state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . KeyValue_Key , key ) ;
20+ state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Key , key ) ;
2121
2222 // Write KeyValue.Value tag, length and value.
2323 var size = ProtobufSerializer . ComputeVarInt64Size ( ( ulong ) value ) + 1 ; // ComputeVarint64Size(ulong) + TagSize
24- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , size , ProtobufOtlpFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ;
25- state . WritePosition = ProtobufSerializer . WriteInt64WithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . AnyValue_Int_Value , ( ulong ) value ) ;
24+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , size , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ;
25+ state . WritePosition = ProtobufSerializer . WriteInt64WithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . AnyValue_Int_Value , ( ulong ) value ) ;
2626 }
2727
2828 protected override void WriteFloatingPointTag ( ref OtlpTagWriterState state , string key , double value )
2929 {
3030 // Write KeyValue tag
31- state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . KeyValue_Key , key ) ;
31+ state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Key , key ) ;
3232
3333 // Write KeyValue.Value tag, length and value.
34- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 9 , ProtobufOtlpFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ; // 8 + TagSize
35- state . WritePosition = ProtobufSerializer . WriteDoubleWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . AnyValue_Double_Value , value ) ;
34+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 9 , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ; // 8 + TagSize
35+ state . WritePosition = ProtobufSerializer . WriteDoubleWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . AnyValue_Double_Value , value ) ;
3636 }
3737
3838 protected override void WriteBooleanTag ( ref OtlpTagWriterState state , string key , bool value )
3939 {
4040 // Write KeyValue tag
41- state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . KeyValue_Key , key ) ;
41+ state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Key , key ) ;
4242
4343 // Write KeyValue.Value tag, length and value.
44- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 2 , ProtobufOtlpFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ; // 1 + TagSize
45- state . WritePosition = ProtobufSerializer . WriteBoolWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . AnyValue_Bool_Value , value ) ;
44+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 2 , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ; // 1 + TagSize
45+ state . WritePosition = ProtobufSerializer . WriteBoolWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . AnyValue_Bool_Value , value ) ;
4646 }
4747
4848 protected override void WriteStringTag ( ref OtlpTagWriterState state , string key , ReadOnlySpan < char > value )
4949 {
5050 // Write KeyValue tag
51- state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . KeyValue_Key , key ) ;
51+ state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Key , key ) ;
5252
5353 // Write KeyValue.Value tag, length and value.
5454 var numberOfUtf8CharsInString = ProtobufSerializer . GetNumberOfUtf8CharsInString ( value ) ;
5555 var serializedLengthSize = ProtobufSerializer . ComputeVarInt64Size ( ( ulong ) numberOfUtf8CharsInString ) ;
5656
5757 // length = numberOfUtf8CharsInString + tagSize + length field size.
58- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , numberOfUtf8CharsInString + 1 + serializedLengthSize , ProtobufOtlpFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ;
59- state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . AnyValue_String_Value , numberOfUtf8CharsInString , value ) ;
58+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , numberOfUtf8CharsInString + 1 + serializedLengthSize , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ;
59+ state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . AnyValue_String_Value , numberOfUtf8CharsInString , value ) ;
6060 }
6161
6262 protected override void WriteArrayTag ( ref OtlpTagWriterState state , string key , ref OtlpTagWriterArrayState value )
6363 {
6464 // TODO: Expand OtlpTagWriterArrayState.Buffer on IndexOutOfRangeException.
6565 // Write KeyValue tag
66- state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . KeyValue_Key , key ) ;
66+ state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Key , key ) ;
6767
6868 // Write KeyValue.Value tag and length
6969 var serializedLengthSize = ProtobufSerializer . ComputeVarInt64Size ( ( ulong ) value . WritePosition ) ;
70- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , value . WritePosition + 1 + serializedLengthSize , ProtobufOtlpFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ; // Array content length + Array tag size + length field size
70+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , value . WritePosition + 1 + serializedLengthSize , ProtobufOtlpTraceFieldNumberConstants . KeyValue_Value , ProtobufWireType . LEN ) ; // Array content length + Array tag size + length field size
7171
7272 // Write Array tag and length
73- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , value . WritePosition , ProtobufOtlpFieldNumberConstants . AnyValue_Array_Value , ProtobufWireType . LEN ) ;
73+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , value . WritePosition , ProtobufOtlpTraceFieldNumberConstants . AnyValue_Array_Value , ProtobufWireType . LEN ) ;
7474 Buffer . BlockCopy ( value . Buffer , 0 , state . Buffer , state . WritePosition , value . WritePosition ) ;
7575 state . WritePosition += value . WritePosition ;
7676 }
@@ -111,26 +111,26 @@ public override OtlpTagWriterArrayState BeginWriteArray()
111111
112112 public override void WriteNullValue ( ref OtlpTagWriterArrayState state )
113113 {
114- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 0 , ProtobufOtlpFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
114+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 0 , ProtobufOtlpTraceFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
115115 }
116116
117117 public override void WriteIntegralValue ( ref OtlpTagWriterArrayState state , long value )
118118 {
119119 var size = ProtobufSerializer . ComputeVarInt64Size ( ( ulong ) value ) + 1 ;
120- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , size , ProtobufOtlpFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
121- state . WritePosition = ProtobufSerializer . WriteInt64WithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . AnyValue_Int_Value , ( ulong ) value ) ;
120+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , size , ProtobufOtlpTraceFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
121+ state . WritePosition = ProtobufSerializer . WriteInt64WithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . AnyValue_Int_Value , ( ulong ) value ) ;
122122 }
123123
124124 public override void WriteFloatingPointValue ( ref OtlpTagWriterArrayState state , double value )
125125 {
126- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 9 , ProtobufOtlpFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
127- state . WritePosition = ProtobufSerializer . WriteDoubleWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . AnyValue_Double_Value , value ) ;
126+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 9 , ProtobufOtlpTraceFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
127+ state . WritePosition = ProtobufSerializer . WriteDoubleWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . AnyValue_Double_Value , value ) ;
128128 }
129129
130130 public override void WriteBooleanValue ( ref OtlpTagWriterArrayState state , bool value )
131131 {
132- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 2 , ProtobufOtlpFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
133- state . WritePosition = ProtobufSerializer . WriteBoolWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . AnyValue_Bool_Value , value ) ;
132+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , 2 , ProtobufOtlpTraceFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
133+ state . WritePosition = ProtobufSerializer . WriteBoolWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . AnyValue_Bool_Value , value ) ;
134134 }
135135
136136 public override void WriteStringValue ( ref OtlpTagWriterArrayState state , ReadOnlySpan < char > value )
@@ -140,8 +140,8 @@ public override void WriteStringValue(ref OtlpTagWriterArrayState state, ReadOnl
140140 var serializedLengthSize = ProtobufSerializer . ComputeVarInt64Size ( ( ulong ) numberOfUtf8CharsInString ) ;
141141
142142 // length = numberOfUtf8CharsInString + tagSize + length field size.
143- state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , numberOfUtf8CharsInString + 1 + serializedLengthSize , ProtobufOtlpFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
144- state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpFieldNumberConstants . AnyValue_String_Value , numberOfUtf8CharsInString , value ) ;
143+ state . WritePosition = ProtobufSerializer . WriteTagAndLength ( state . Buffer , state . WritePosition , numberOfUtf8CharsInString + 1 + serializedLengthSize , ProtobufOtlpTraceFieldNumberConstants . ArrayValue_Value , ProtobufWireType . LEN ) ;
144+ state . WritePosition = ProtobufSerializer . WriteStringWithTag ( state . Buffer , state . WritePosition , ProtobufOtlpTraceFieldNumberConstants . AnyValue_String_Value , numberOfUtf8CharsInString , value ) ;
145145 }
146146
147147 public override void EndWriteArray ( ref OtlpTagWriterArrayState state )
0 commit comments