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

RSDK-9876: Add counts for each {component, gRPC method} invocation. #4765

Merged
merged 4 commits into from
Feb 3, 2025

Conversation

dgottlieb
Copy link
Member

No description provided.

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 31, 2025
@dgottlieb dgottlieb requested review from abe-winter and removed request for abe-winter January 31, 2025 17:32
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 31, 2025
@dgottlieb dgottlieb requested a review from cheukt January 31, 2025 20:20
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 31, 2025
// Only count component APIs, for now.
var apiMethod string
switch {
case strings.HasPrefix(info.FullMethod, "/viam.component."):
Copy link
Member

Choose a reason for hiding this comment

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

is there a downside in adding services as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope -- just didn't want to deal with double checking all of the kinds of method names to do string parsing on.

robot/web/web.go Outdated

// UnaryInterceptor returns an incoming server interceptor that will pull method information and
// optionally resource information to bump the request counters.
func (mc *RequestCounter) UnaryInterceptor(
Copy link
Member

Choose a reason for hiding this comment

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

should we add a stream interceptor as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's worthwhile, but not necessarily a blocker for this.

A stream being opened is an interesting event for sure, but we might care more about the messages being sent within a stream. And I think most stream calls are for webrtc dialing, which isn't covered by the viam.components prefix right now.

robot/web/web.go Outdated

// UnaryInterceptor returns an incoming server interceptor that will pull method information and
// optionally resource information to bump the request counters.
func (mc *RequestCounter) UnaryInterceptor(
Copy link
Member

Choose a reason for hiding this comment

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

nit: mc -> rc

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, thanks. Was originally calling this "MethodCounter" and waffled.

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 3, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 3, 2025
@dgottlieb
Copy link
Member Author

I think the request to add services + streaming are good ideas. But I don't think it blocks this PR. If you're feeling motivated, I'd gladly welcome additional contributors!

@dgottlieb dgottlieb requested a review from cheukt February 3, 2025 15:49
@dgottlieb dgottlieb merged commit e5697fc into viamrobotics:main Feb 3, 2025
17 checks passed
@dgottlieb dgottlieb deleted the RSDK-9876 branch February 3, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants