Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New A72 changes for OpenTelemetry #8216 #8226

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

vinothkumarr227
Copy link
Contributor

@vinothkumarr227 vinothkumarr227 commented Apr 4, 2025

Fixes: #8216

RELEASE NOTES: None

Copy link

codecov bot commented Apr 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.06%. Comparing base (732f3f3) to head (ed45ee7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8226      +/-   ##
==========================================
- Coverage   82.09%   82.06%   -0.04%     
==========================================
  Files         412      412              
  Lines       40491    40497       +6     
==========================================
- Hits        33242    33233       -9     
- Misses       5876     5891      +15     
  Partials     1373     1373              
Files with missing lines Coverage Δ
stats/opentelemetry/client_tracing.go 84.00% <100.00%> (ø)
stats/opentelemetry/server_tracing.go 100.00% <100.00%> (ø)
stats/opentelemetry/trace.go 88.88% <100.00%> (+1.38%) ⬆️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@purnesh42H purnesh42H left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was there no change needed for Attempt? Is it already following grpc/proposal#474 ?

@@ -14,6 +14,10 @@
* limitations under the License.
*/

// OpenCensus's binary format for grpc-trace-bin:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to add this. This was only for grfc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@purnesh42H purnesh42H added this to the 1.73 Release milestone Apr 8, 2025
@purnesh42H purnesh42H added Type: Internal Cleanup Refactors, etc Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability labels Apr 8, 2025
@vinothkumarr227
Copy link
Contributor Author

was there no change needed for Attempt? Is it already following grpc/proposal#474 ?

The Attempt span name already follows the grpc/proposal#474 naming convention.
https://github.com/grpc/grpc-go/blob/master/stats/opentelemetry/client_tracing.go#L47

Copy link
Contributor

@purnesh42H purnesh42H left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@purnesh42H purnesh42H assigned dfawley and unassigned vinothkumarr227 Apr 8, 2025
@purnesh42H
Copy link
Contributor

@dfawley for second review

attribute.Int64("sequence-number", int64(ai.countRecvMsg)),
attribute.Int64("message-size", int64(rs.Length)),
attribute.Int64("message-size-compressed", int64(rs.CompressedLength)),
))
case *stats.OutPayload:
ai.countSentMsg++
span.AddEvent("Outbound compressed message", trace.WithAttributes(
span.AddEvent("Outbound message", trace.WithAttributes(
attribute.Int64("sequence-number", int64(ai.countSentMsg)),
attribute.Int64("message-size", int64(rs.Length)),
attribute.Int64("message-size-compressed", int64(rs.CompressedLength)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the grfc says to only add this if the message is actually compressed

@@ -58,14 +58,14 @@ func populateSpan(rs stats.RPCStats, ai *attemptInfo) {
// message id - "must be calculated as two different counters starting
// from one for sent messages and one for received messages."
ai.countRecvMsg++
span.AddEvent("Inbound compressed message", trace.WithAttributes(
span.AddEvent("Inbound message", trace.WithAttributes(
attribute.Int64("sequence-number", int64(ai.countRecvMsg)),
attribute.Int64("message-size", int64(rs.Length)),
attribute.Int64("message-size-compressed", int64(rs.CompressedLength)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the grfc says to only add this if the message is actually compressed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gRFC says if compression is not a separate event, just add the key message-size-compressed in the same event "Inbound Message" and "Outbound Message". For go implementation, if compression is not enabled message-size-compressed is same as actual message. So, i guess what we have as of now is fine? or should we only add if compressed and actual are not equal?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text says -
If compression needed, add key message-size-compressed with integer value of compressed message size.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. @vinothkumarr227 could you do similar to what Java has https://github.com/grpc/grpc-java/blob/f79ab2f16f7e037da0e8c9985e917eca552c22cb/opentelemetry/src/main/java/io/grpc/opentelemetry/OpenTelemetryTracingModule.java#L439 which is to add message-size-compressed only if compression was enabled.

Do for both inbound and outbound. For compression enabled, check if message-size is not equal to compressed length

// CompressedLength is the size of the compressed payload data. Does not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@purnesh42H I have added both inbound and outbound. For compression to be considered enabled

@yashykt
Copy link
Member

yashykt commented Apr 8, 2025

We also need tests for streaming, but that can be added in a subsequent PR

@purnesh42H
Copy link
Contributor

purnesh42H commented Apr 9, 2025

message-size-compressed

the e2e tests contains tests for both unary and streaming RPCs. Are you referring to anything else?

@purnesh42H
Copy link
Contributor

@vinothkumarr227 please resolve the conflicts from #8237

@vinothkumarr227
Copy link
Contributor Author

@vinothkumarr227 please resolve the conflicts from #8237

I have resolved the conflicts

@yashykt
Copy link
Member

yashykt commented Apr 9, 2025

the e2e tests contains tests for both unary and streaming RPCs. Are you referring to anything else?

In all of the tests, I see only a single message being sent/received, which means that the logic on the sequence numbers incremented is untested.

@purnesh42H
Copy link
Contributor

In all of the tests, I see only a single message being sent/received, which means that the logic on the sequence numbers incremented is untested.

okay. Filed the issue #8240

attribute.Int64("message-size-compressed", int64(rs.CompressedLength)),
))
}
if rs.CompressedLength > 0 && rs.CompressedLength != rs.Length {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no need to check > 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

attribute.Int64("message-size-compressed", int64(rs.CompressedLength)),
))
}
if rs.CompressedLength > 0 && rs.CompressedLength != rs.Length {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no need to check > 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability Type: Internal Cleanup Refactors, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New A72 changes for OpenTelemetry
4 participants