Skip to content

Conversation

@zasweq
Copy link
Contributor

@zasweq zasweq commented Sep 29, 2022

This PR adds a binary logger option for client and server. This is needed due to the observability config iteration of a partition between client and server events.

RELEASE NOTES: N/A

@zasweq zasweq added the Type: Feature New features or improvements in behavior label Sep 29, 2022
@zasweq zasweq added this to the 1.50 Release milestone Sep 29, 2022
@zasweq zasweq requested a review from dfawley September 29, 2022 01:08
@zasweq zasweq force-pushed the binary-logger-options branch from ad8e520 to 074c7da Compare September 29, 2022 01:39
Comment on lines 8265 to 8276
rpcDone := make(chan struct{})
go func() {
for {
_, err := stream.Recv()
if err == io.EOF {
close(rpcDone)
return
}
}
}()
stream.CloseSend()
<-rpcDone
Copy link
Member

Choose a reason for hiding this comment

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

Does this not work?

stream.CloseSend()
var err error 
for err != io.EOF {
  _, err = stream.Recv()
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched. You don't even need the for err != io.EOF {}, I just added if _, err = stream.Recv(); err != io.EOF { t.Fatal(...) }

Copy link
Member

Choose a reason for hiding this comment

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

CloseSend shouldn't be returning any error here anyway, right? Not sure what I was thinking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well it'll return an EOF (through ending of the stream with no error in the streams lifetime as you explained to me Tues).

Comment on lines +8277 to +8282
if csbl.mml.events != 9 {
t.Fatalf("want 9 client side binary logging events, got %v", csbl.mml.events)
}
if ssbl.mml.events != 8 {
t.Fatalf("want 8 server side binary logging events, got %v", ssbl.mml.events)
}
Copy link
Member

Choose a reason for hiding this comment

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

Why aren't these the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is WAI. I looked over my diff (and found some correctness issues - which you can see in the diff of the commit I'm about to push out). However, my diff from master really keeps the exact same number of logging calls in each operation/over the stream lifetime.

Copy link
Member

Choose a reason for hiding this comment

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

Can you explain the difference, though? It doesn't block this PR, but we need to understand this and make sure it's correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'm testing this exact scenario in o11y e2e, and writing out the exact atoms of events emitted that we expect like we discussed, hopefully if there's any glaring correctness issues it'll show up then, or we can see it's WAI, and we can look into it further.

Copy link
Member

Choose a reason for hiding this comment

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

We can also print them here really easily, right? Why not just add a couple t.Logs and let's see what it is.

@dfawley dfawley assigned zasweq and unassigned dfawley Sep 30, 2022
@dfawley dfawley modified the milestones: 1.50 Release, 1.51 Release Oct 4, 2022
Copy link
Contributor Author

@zasweq zasweq left a comment

Choose a reason for hiding this comment

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

Thanks for the comments boss man :D! Hope your ankle isn't too messed up.

Comment on lines 8265 to 8276
rpcDone := make(chan struct{})
go func() {
for {
_, err := stream.Recv()
if err == io.EOF {
close(rpcDone)
return
}
}
}()
stream.CloseSend()
<-rpcDone
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched. You don't even need the for err != io.EOF {}, I just added if _, err = stream.Recv(); err != io.EOF { t.Fatal(...) }

Comment on lines +8277 to +8282
if csbl.mml.events != 9 {
t.Fatalf("want 9 client side binary logging events, got %v", csbl.mml.events)
}
if ssbl.mml.events != 8 {
t.Fatalf("want 8 server side binary logging events, got %v", ssbl.mml.events)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is WAI. I looked over my diff (and found some correctness issues - which you can see in the diff of the commit I'm about to push out). However, my diff from master really keeps the exact same number of logging calls in each operation/over the stream lifetime.

@zasweq zasweq assigned dfawley and unassigned zasweq Oct 5, 2022
@dfawley dfawley assigned zasweq and unassigned dfawley Oct 6, 2022
@zasweq zasweq merged commit 5fc798b into grpc:master Oct 6, 2022
zasweq added a commit to zasweq/grpc-go that referenced this pull request Oct 14, 2022
* Add binary logger option for client and server
zasweq added a commit that referenced this pull request Oct 14, 2022
…ersion to 1.50.1 (#5722)

* Add binary logger option for client and server (#5675)

* Add binary logger option for client and server

* gcp/observability: implement public preview config syntax, logging schema, and exposed metrics (#5704)

* Fix o11y typo (#5719)

* o11y: Fixed o11y bug (#5720)

* update version to 1.50.1
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Type: Feature New features or improvements in behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants