Skip to content

Commit 79ca174

Browse files
authored
stats/opentelemetry: fix trace attributes message sequence numbers to start from 0 (#8237) (#8252)
1 parent 57a2605 commit 79ca174

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

stats/opentelemetry/e2e_test.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ func (s) TestMetricsAndTracesOptionEnabled(t *testing.T) {
869869
Attributes: []attribute.KeyValue{
870870
{
871871
Key: "sequence-number",
872-
Value: attribute.IntValue(1),
872+
Value: attribute.IntValue(0),
873873
},
874874
{
875875
Key: "message-size",
@@ -886,7 +886,7 @@ func (s) TestMetricsAndTracesOptionEnabled(t *testing.T) {
886886
Attributes: []attribute.KeyValue{
887887
{
888888
Key: "sequence-number",
889-
Value: attribute.IntValue(1),
889+
Value: attribute.IntValue(0),
890890
},
891891
{
892892
Key: "message-size",
@@ -927,7 +927,7 @@ func (s) TestMetricsAndTracesOptionEnabled(t *testing.T) {
927927
Attributes: []attribute.KeyValue{
928928
{
929929
Key: "sequence-number",
930-
Value: attribute.IntValue(1),
930+
Value: attribute.IntValue(0),
931931
},
932932
{
933933
Key: "message-size",
@@ -944,7 +944,7 @@ func (s) TestMetricsAndTracesOptionEnabled(t *testing.T) {
944944
Attributes: []attribute.KeyValue{
945945
{
946946
Key: "sequence-number",
947-
Value: attribute.IntValue(1),
947+
Value: attribute.IntValue(0),
948948
},
949949
{
950950
Key: "message-size",
@@ -1093,7 +1093,7 @@ func (s) TestSpan(t *testing.T) {
10931093
Attributes: []attribute.KeyValue{
10941094
{
10951095
Key: "sequence-number",
1096-
Value: attribute.IntValue(1),
1096+
Value: attribute.IntValue(0),
10971097
},
10981098
{
10991099
Key: "message-size",
@@ -1110,7 +1110,7 @@ func (s) TestSpan(t *testing.T) {
11101110
Attributes: []attribute.KeyValue{
11111111
{
11121112
Key: "sequence-number",
1113-
Value: attribute.IntValue(1),
1113+
Value: attribute.IntValue(0),
11141114
},
11151115
{
11161116
Key: "message-size",
@@ -1151,7 +1151,7 @@ func (s) TestSpan(t *testing.T) {
11511151
Attributes: []attribute.KeyValue{
11521152
{
11531153
Key: "sequence-number",
1154-
Value: attribute.IntValue(1),
1154+
Value: attribute.IntValue(0),
11551155
},
11561156
{
11571157
Key: "message-size",
@@ -1168,7 +1168,7 @@ func (s) TestSpan(t *testing.T) {
11681168
Attributes: []attribute.KeyValue{
11691169
{
11701170
Key: "sequence-number",
1171-
Value: attribute.IntValue(1),
1171+
Value: attribute.IntValue(0),
11721172
},
11731173
{
11741174
Key: "message-size",
@@ -1319,7 +1319,7 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
13191319
Attributes: []attribute.KeyValue{
13201320
{
13211321
Key: "sequence-number",
1322-
Value: attribute.IntValue(1),
1322+
Value: attribute.IntValue(0),
13231323
},
13241324
{
13251325
Key: "message-size",
@@ -1336,7 +1336,7 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
13361336
Attributes: []attribute.KeyValue{
13371337
{
13381338
Key: "sequence-number",
1339-
Value: attribute.IntValue(1),
1339+
Value: attribute.IntValue(0),
13401340
},
13411341
{
13421342
Key: "message-size",
@@ -1377,7 +1377,7 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
13771377
Attributes: []attribute.KeyValue{
13781378
{
13791379
Key: "sequence-number",
1380-
Value: attribute.IntValue(1),
1380+
Value: attribute.IntValue(0),
13811381
},
13821382
{
13831383
Key: "message-size",
@@ -1394,7 +1394,7 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
13941394
Attributes: []attribute.KeyValue{
13951395
{
13961396
Key: "sequence-number",
1397-
Value: attribute.IntValue(1),
1397+
Value: attribute.IntValue(0),
13981398
},
13991399
{
14001400
Key: "message-size",

stats/opentelemetry/trace.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ func populateSpan(rs stats.RPCStats, ai *attemptInfo) {
5757
case *stats.InPayload:
5858
// message id - "must be calculated as two different counters starting
5959
// from one for sent messages and one for received messages."
60-
ai.countRecvMsg++
6160
span.AddEvent("Inbound compressed message", trace.WithAttributes(
6261
attribute.Int64("sequence-number", int64(ai.countRecvMsg)),
6362
attribute.Int64("message-size", int64(rs.Length)),
6463
attribute.Int64("message-size-compressed", int64(rs.CompressedLength)),
6564
))
65+
ai.countRecvMsg++
6666
case *stats.OutPayload:
67-
ai.countSentMsg++
6867
span.AddEvent("Outbound compressed message", trace.WithAttributes(
6968
attribute.Int64("sequence-number", int64(ai.countSentMsg)),
7069
attribute.Int64("message-size", int64(rs.Length)),
7170
attribute.Int64("message-size-compressed", int64(rs.CompressedLength)),
7271
))
72+
ai.countSentMsg++
7373
case *stats.End:
7474
if rs.Error != nil {
7575
s := status.Convert(rs.Error)

0 commit comments

Comments
 (0)