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

Divide assigned limits with replicas #725

Merged
merged 4 commits into from
Jan 8, 2024

Conversation

rafiramadhana
Copy link
Contributor

Resolves #721

@CLAassistant
Copy link

CLAassistant commented Dec 30, 2023

CLA assistant check
All committers have signed the CLA.

@rubenvp8510
Copy link
Collaborator

This looks good so far! Thanks for your contribution!

The reason CI is failing is because some unit tests regarding of how resources are calculated should be updated

@rafiramadhana
Copy link
Contributor Author

The reason CI is failing is because some unit tests regarding of how resources are calculated should be updated

ok, will take a look

@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0f178a8) 77.87% compared to head (856bcb8) 77.88%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #725      +/-   ##
==========================================
+ Coverage   77.87%   77.88%   +0.01%     
==========================================
  Files          67       67              
  Lines        5102     5106       +4     
==========================================
+ Hits         3973     3977       +4     
  Misses        937      937              
  Partials      192      192              
Flag Coverage Δ
unittests 77.88% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -49,6 +49,9 @@ func Resources(tempo v1alpha1.TempoStack, component string) corev1.ResourceRequi
if ok {
totalCpuInt := totalCpu.MilliValue()
cpu := float32(totalCpuInt) * componentResources.cpu
if r := tempo.Spec.Template.Compactor.Replicas; r != nil && *r > 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Resources() is called from every tempo component (compactor, distributor, ingester, etc). I'd suggest to add an additional function parameter replicas *int32 to Resources() and update all callers.

Copy link
Contributor Author

@rafiramadhana rafiramadhana Jan 4, 2024

Choose a reason for hiding this comment

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

Resources() is called from every tempo component (compactor, distributor, ingester, etc).

I see, but would there be any other possibilities for those components to have a replicas *int32 value other than tempo.Spec.Template.Compactor.Replicas?

because what I imagined is something like this

--- Resources:       manifestutils.Resources(tempo, manifestutils.CompactorComponentName),
+++ Resources:       manifestutils.Resources(tempo, manifestutils.CompactorComponentName, tempo.Spec.Template.Compactor.Replicas)

(file: compactor.go)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, each component can have individual replica settings - e.g. you can have 2 replicas of the compactor and 10 of the distributor.

Replicas: tempo.Spec.Template.Distributor.Replicas,

Replicas: tempo.Spec.Template.Ingester.Replicas,

etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i see, thanks for the pointers

i will do the update

Copy link
Contributor Author

@rafiramadhana rafiramadhana Jan 5, 2024

Choose a reason for hiding this comment

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

updated, ready to review

856bcb8

Update Resources interface to accept replicas.
@@ -231,7 +231,7 @@ func deployment(params manifestutils.Params) (*appsv1.Deployment, error) {
MountPath: manifestutils.TmpStoragePath,
},
},
Resources: manifestutils.Resources(tempo, manifestutils.QueryFrontendComponentName),
Resources: manifestutils.Resources(tempo, manifestutils.QueryFrontendComponentName, tempo.Spec.Template.QueryFrontend.Replicas),
Copy link
Collaborator

Choose a reason for hiding this comment

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

@rubenvp8510 looks like we currently assign the query-frontend resources to both the query-frontend and tempo-query containers, so we're using the resources allocated to the query-frontend component twice 😮

Copy link
Collaborator

@andreasgerstmayr andreasgerstmayr left a comment

Choose a reason for hiding this comment

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

Looks good, thank you for your contributions @rafiramadhana! 🚀

@rafiramadhana
Copy link
Contributor Author

it looks like the test was failing due to intermittent error @rubenvp8510 @andreasgerstmayr

@andreasgerstmayr
Copy link
Collaborator

it looks like the test was failing due to intermittent error @rubenvp8510 @andreasgerstmayr

you're right, this was caused by a flaky test (fixed in #728)

This PR is good to merge, thank you!

@andreasgerstmayr andreasgerstmayr merged commit 105a022 into grafana:main Jan 8, 2024
11 checks passed
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.

Replicas + resources.total.limits
5 participants