-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
refactor(blooms): Add RPC service for bloom-planner #13015
Conversation
pkg/bloombuild/planner/metrics.go
Outdated
taskLost: promauto.With(r).NewCounter(prometheus.CounterOpts{ | ||
Namespace: metricsNamespace, | ||
Subsystem: metricsSubsystem, | ||
Name: "task_lost_total", |
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.
Shouldn't this be named tasks_lost_total
?
if err := services.StartManagerAndAwaitHealthy(ctx, p.subservices); err != nil { | ||
return fmt.Errorf("error starting planner subservices: %w", err) | ||
} | ||
|
||
p.metrics.running.Set(1) |
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.
nit: How meaningful is the running
metric?
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.
We use it for other components and in the original bloom compactor.
Even though you may use a k82 metric to check if the pod is running:
- That won't work in non- k82 envs
- This is set to 1 only when the component is actually ready to start working
So I think that's the usefulness of this metric.
pkg/bloombuild/planner/planner.go
Outdated
p.pendingTasksMu.Lock() | ||
inflight := len(p.pendingTasks) | ||
p.pendingTasksMu.Unlock() |
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.
nit: Since we use this pendingTasks every time we use the queue, would it make sense to implement a reusable sync map for pending tasks?
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.
Good idea. Done
// Start planner | ||
err = planner.StartAsync(context.Background()) | ||
require.NoError(t, err) | ||
require.Eventually(t, func() bool { | ||
return planner.State() == services.Running | ||
}, 15*time.Second, 10*time.Millisecond) | ||
defer func() { | ||
planner.StopAsync() | ||
require.Eventually(t, func() bool { | ||
return planner.State() != services.Running | ||
}, 1*time.Minute, 100*time.Millisecond) | ||
}() |
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.
You can use functions from the services
package for starting and stopping:
err := services.StartAndAwaitRunning(context.Background(), planner)
require.NoError(t, err)
t.Cleanup(func() {
err := services.StopAndAwaitTerminated(context.Background(), planner)
require.NoError(t, err)
})
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.
Oh nice, TIL! Thank you 👍
What this PR does / why we need it:
This PR adds a new RPC service implemented by the planner to communicate the planner and the builder. The implementation is pretty similar top the query scheduler.
Special notes for your reviewer:
Checklist
CONTRIBUTING.md
guide (required)feat
PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.docs/sources/setup/upgrade/_index.md
production/helm/loki/Chart.yaml
and updateproduction/helm/loki/CHANGELOG.md
andproduction/helm/loki/README.md
. Example PRdeprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR