This commit is contained in:
vinothkumarr227 2025-08-18 20:10:35 +08:00 committed by GitHub
commit 1100531e1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 54 deletions

View File

@ -868,14 +868,6 @@ func (s) TestMetricsAndTracesOptionEnabled(t *testing.T) {
Key: "FailFast",
Value: attribute.BoolValue(false),
},
{
Key: "previous-rpc-attempts",
Value: attribute.IntValue(0),
},
{
Key: "transparent-retry",
Value: attribute.BoolValue(false),
},
},
events: []trace.Event{
{
@ -990,14 +982,6 @@ func (s) TestMetricsAndTracesOptionEnabled(t *testing.T) {
Key: "FailFast",
Value: attribute.BoolValue(false),
},
{
Key: "previous-rpc-attempts",
Value: attribute.IntValue(0),
},
{
Key: "transparent-retry",
Value: attribute.BoolValue(false),
},
},
events: nil,
},
@ -1092,14 +1076,6 @@ func (s) TestSpan(t *testing.T) {
Key: "FailFast",
Value: attribute.BoolValue(false),
},
{
Key: "previous-rpc-attempts",
Value: attribute.IntValue(0),
},
{
Key: "transparent-retry",
Value: attribute.BoolValue(false),
},
},
events: []trace.Event{
{
@ -1198,14 +1174,6 @@ func (s) TestSpan(t *testing.T) {
Key: "FailFast",
Value: attribute.BoolValue(false),
},
{
Key: "previous-rpc-attempts",
Value: attribute.IntValue(0),
},
{
Key: "transparent-retry",
Value: attribute.BoolValue(false),
},
},
events: nil,
},
@ -1302,14 +1270,6 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
Key: "FailFast",
Value: attribute.BoolValue(false),
},
{
Key: "previous-rpc-attempts",
Value: attribute.IntValue(0),
},
{
Key: "transparent-retry",
Value: attribute.BoolValue(false),
},
},
events: []trace.Event{
{
@ -1408,14 +1368,6 @@ func (s) TestSpan_WithW3CContextPropagator(t *testing.T) {
Key: "FailFast",
Value: attribute.BoolValue(false),
},
{
Key: "previous-rpc-attempts",
Value: attribute.IntValue(0),
},
{
Key: "transparent-retry",
Value: attribute.BoolValue(false),
},
},
events: nil,
},
@ -1766,8 +1718,6 @@ func (s) TestStreamingRPC_TraceSequenceNumbers(t *testing.T) {
attributes: []attribute.KeyValue{
attribute.Bool("Client", false),
attribute.Bool("FailFast", false),
attribute.Int("previous-rpc-attempts", 0),
attribute.Bool("transparent-retry", false),
},
},
{

View File

@ -44,12 +44,17 @@ func populateSpan(rs stats.RPCStats, ai *attemptInfo) {
// Note: Go always added Client and FailFast attributes even though they are not
// defined by the OpenCensus gRPC spec. Thus, they are unimportant for
// correctness.
span.SetAttributes(
attrs := []attribute.KeyValue{
attribute.Bool("Client", rs.Client),
attribute.Bool("FailFast", rs.FailFast),
attribute.Int64("previous-rpc-attempts", int64(ai.previousRPCAttempts)),
attribute.Bool("transparent-retry", rs.IsTransparentRetryAttempt),
)
}
if rs.Client {
attrs = append(attrs,
attribute.Int64("previous-rpc-attempts", int64(ai.previousRPCAttempts)),
attribute.Bool("transparent-retry", rs.IsTransparentRetryAttempt),
)
}
span.SetAttributes(attrs...)
// increment previous rpc attempts applicable for next attempt
atomic.AddUint32(&ai.previousRPCAttempts, 1)
case *stats.DelayedPickComplete: