- 
                Notifications
    You must be signed in to change notification settings 
- Fork 37
Use channels for metrics updates, added metrics tests #171
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
Conversation
Signed-off-by: Ira <[email protected]>
        
          
                pkg/llm-d-inference-sim/metrics.go
              
                Outdated
          
        
      |  | ||
| // reportWaitingRequests sets information about waiting completion requests | ||
| func (s *VllmSimulator) reportWaitingRequests() { | ||
| func (s *VllmSimulator) reportWaitingRequests(nWaitingReqs int64) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to pass the nWaitingReqs, the s.nWaitingReqs has an updated value
        
          
                pkg/llm-d-inference-sim/metrics.go
              
                Outdated
          
        
      |  | ||
| // reportRunningRequests sets information about running completion requests | ||
| func (s *VllmSimulator) reportRunningRequests() { | ||
| func (s *VllmSimulator) reportRunningRequests(nRunningReqs int64) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to pass the nRunningReqs, the s. nRunningReqs has an updated value
| // waitingReqChan is a channel to update nWaitingReqs | ||
| waitingReqChan chan int64 | ||
| // loraInfo is prometheus gauge | ||
| loraInfo *prometheus.GaugeVec | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we need a channel for loraInfos? please create an issue for this
        
          
                pkg/llm-d-inference-sim/simulator.go
              
                Outdated
          
        
      | kvcacheHelper: nil, // kvcache helper will be created only if required after reading configuration | ||
| namespace: os.Getenv(podNsEnv), | ||
| pod: os.Getenv(podNameEnv), | ||
| runReqChan: make(chan int64, 1000), | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can define a constant for metrics channels size or even expose it in the configuration?
        
          
                pkg/llm-d-inference-sim/simulator.go
              
                Outdated
          
        
      | case inc := <-s.waitingReqChan: | ||
| s.nWaitingReqs += inc | ||
| s.reportWaitingRequests(s.nWaitingReqs) | ||
| case inc := <-s.runReqChan: | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please create a separate loop for each metric
Signed-off-by: Ira <[email protected]>
| /lgtm /approve | 
| /lgtm | 
fixes #145
This PRs changes the way the metrics of number of running and waiting requests are updated. The current way of atomic increments and a separate Prometheus set is causing the metrics to be inconsistent. Therefore, a use of channels is added.
Also, this PR adds metrics tests, and reorganizes simulator tests a bit.