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

feat: Add Get Token Metrics to GRPC server #3687

Merged
merged 3 commits into from
Oct 1, 2024

Conversation

siddimore
Copy link
Contributor

@siddimore siddimore commented Sep 29, 2024

Description

This PR creates a GRPC method to expose some of the Token Metrics

TODO
Add tests

Signed commits

  • Yes, I signed my commits.

Copy link

netlify bot commented Sep 29, 2024

Deploy Preview for localai ready!

Name Link
🔨 Latest commit b44218f
🔍 Latest deploy log https://app.netlify.com/sites/localai/deploys/66fad364e93a7c0008058471
😎 Deploy Preview https://deploy-preview-3687--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@siddimore siddimore changed the title (feat) Add Get Token Metrics to GRPC server feat: Add Get Token Metrics to GRPC server Sep 29, 2024
// Define the empty request
message MetricsRequest {}

message MetricsResponse {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

what other metrics are good to be exposed out?

Copy link
Owner

Choose a reason for hiding this comment

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

Maybe not related to the processing request, but could be useful also to expose infos like how many parallel requests can be served

@mudler
Copy link
Owner

mudler commented Sep 29, 2024

mmm I wonder if it would make sense to add a route also via http rest to leverage this, but shouldn't block merging this PR

@@ -374,3 +374,21 @@ func (c *Client) Rerank(ctx context.Context, in *pb.RerankRequest, opts ...grpc.
client := pb.NewBackendClient(conn)
return client.Rerank(ctx, in, opts...)
}

func (c *Client) GetTokenMetrics(ctx context.Context, in *pb.MetricsRequest, opts ...grpc.CallOption) (*pb.MetricsResponse, error) {
if !c.parallel {
Copy link
Owner

Choose a reason for hiding this comment

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

Code doesn't look formatted here - might need a go fmt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

forgot to fix this

@siddimore
Copy link
Contributor Author

siddimore commented Sep 29, 2024

mmm I wonder if it would make sense to add a route also via http rest to leverage this, but shouldn't block merging this PR

@mudler yup i already did make those changes just did not add it yet because i had to investigate some build issue

@mudler
Copy link
Owner

mudler commented Sep 29, 2024

mmm I wonder if it would make sense to add a route also via http rest to leverage this, but shouldn't block merging this PR

@mudler yup i already did make those changes just did not add it yet because i had to investigate some build issue

gotcha 👍 changes looks good here otherwise!

mudler
mudler previously approved these changes Sep 29, 2024
Signed-off-by: Siddharth More <[email protected]>
@siddimore
Copy link
Contributor Author

mmm I wonder if it would make sense to add a route also via http rest to leverage this, but shouldn't block merging this PR

@mudler added a route to http endpoints. I will update test and have this PR ready for review this week

@siddimore siddimore marked this pull request as ready for review September 30, 2024 16:35
@mudler mudler added the enhancement New feature or request label Oct 1, 2024
@mudler mudler merged commit f84b55d into mudler:master Oct 1, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants