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

Support histogram metrics from engine in cache #424

Merged
merged 4 commits into from
Nov 24, 2024
Merged

Conversation

Jeffwan
Copy link
Collaborator

@Jeffwan Jeffwan commented Nov 21, 2024

Pull Request Description

Support histogram metrics from engine in cache

Related Issues

Resolves: phase I of #423

Important: Before submitting, please complete the description above and review the checklist below.


Contribution Guidelines (Expand for Details)

We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:

Pull Request Title Format

Your PR title should start with one of these prefixes to indicate the nature of the change:

  • [Bug]: Corrections to existing functionality
  • [CI]: Changes to build process or CI pipeline
  • [Docs]: Updates or additions to documentation
  • [API]: Modifications to aibrix's API or interface
  • [CLI]: Changes or additions to the Command Line Interface
  • [Misc]: For changes not covered above (use sparingly)

Note: For changes spanning multiple categories, use multiple prefixes in order of importance.

Submission Checklist

  • PR title includes appropriate prefix(es)
  • Changes are clearly explained in the PR description
  • New and existing tests pass successfully
  • Code adheres to project style and best practices
  • Documentation updated to reflect changes (if applicable)
  • Thorough testing completed, no regressions introduced

By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.

1. Refactor the metric fetcher in the cache to support histogram metrics
2. Support histogram metrics fetching way.
3. Add a few histogram metrics like ITL, TTFT, TPOT,E2E etc
@Jeffwan Jeffwan requested review from kr11 and brosoul November 21, 2024 23:10
1. Use separate const file to host available metrics names
2. Use metrics vs engine metrics name 1:1
@Jeffwan Jeffwan force-pushed the jiaxin/routing-support branch from 4658c5e to ffe5d08 Compare November 21, 2024 23:20
totalthroughput := 2*promptThroughput + generationThroughput
klog.V(4).Infof("pod: %v, podIP: %v, promptThroughput: %v, generationThroughput: %v, totalthroughput: %v",
pod.Name, pod.Status.PodIP, promptThroughput, generationThroughput, totalthroughput)
total_throughput := 2*promptThroughput.Value + generationThroughput.Value
Copy link
Collaborator

Choose a reason for hiding this comment

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

In autoscaler and the gateway, there exist two similar parts of metrics codes. Is this a good design? Shall we need to extract a set of common Metrics?

Copy link
Collaborator

Choose a reason for hiding this comment

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

minor, it is better to use camel Case naming (totalThroughput) for variable total_throughput

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, golang should use camel Case. my careless.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this a good design? Shall we need to extract a set of common Metrics?

Good point. We should provide an unified solution for both metric consumers.

@brosoul
Copy link
Collaborator

brosoul commented Nov 22, 2024

In the current logic of parseMetricFromBody, it seems that only the first row metrics of Gauge type matching will be processed. Can the following gauge which has multiple lines be processed correctly?
image

Maybe the function TextToMetricFamilies of github.com/prometheus/common/expfmt could be the parser choice? (the result data struct could be more complex)

@Jeffwan
Copy link
Collaborator Author

Jeffwan commented Nov 24, 2024

Maybe the function TextToMetricFamilies of github.com/prometheus/common/expfmt could be the parser choice? (the result data struct could be more complex)

that's a very good point. some complex cases are not covered yet. different model labels etc. We should definitely find some existing tools to replace the manual parsing. we actually already have such case because lora model and base model are from same pod and it will create multiple records. Let me cut a separate Pr to improve it. I will merge this one first to meet a basic scenario.

@Jeffwan Jeffwan merged commit ca0cc64 into main Nov 24, 2024
10 checks passed
@Jeffwan Jeffwan deleted the jiaxin/routing-support branch November 24, 2024 05:53
gangmuk pushed a commit that referenced this pull request Jan 25, 2025
* Refactor the metrics support in mocked app

* Support histogram metrics in cache

1. Refactor the metric fetcher in the cache to support histogram metrics
2. Support histogram metrics fetching way.
3. Add a few histogram metrics like ITL, TTFT, TPOT,E2E etc

* Add license headers

* Refactor the metric names and files

1. Use separate const file to host available metrics names
2. Use metrics vs engine metrics name 1:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants