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

[Feature request] Pod metrics #26

Open
NeQuissimus opened this issue Sep 29, 2022 · 3 comments
Open

[Feature request] Pod metrics #26

NeQuissimus opened this issue Sep 29, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@NeQuissimus
Copy link

NeQuissimus commented Sep 29, 2022

Similar to idea of the PodsHealth trait:
If there was a trait PodsMetrics or similar, which requires a way to define a load factor (maybe define it to be 0.0 <= x <= 1.0) for a Pod.

trait PodsMetrics {
  def loadFactor(podAddress: PodAddress): UIO[Float]
}

By using this load factor, a pod would report how "busy" it is (it could simply report the underlying machine's CPU usage or take into account other metrics).
Such a load factor could then be exposed further and, for example, be used to implement a Kubernetes HPA.
This would enable pods (in both the Kubernetes and Shardcake sense) to be added and removed automatically.

@NeQuissimus
Copy link
Author

In addition, I could see logic that would implement this trait in such a way that communicates with pre-defined types of entities (maybe those extending an additional trait). Imagine my entity is a Kafka consumer and I would like to trigger starting up more pods when it falls behind (or reduce the number of consumers when everything is caught up).

@ghostdogpr
Copy link
Collaborator

I understand the need but I wonder if that needs to be in shardcake at all. Adding or removing pods is controlled by Kubernetes and it can already use metrics such as CPU. If application metrics need to be used, they can be exposed by an API. What would the shard manager do about it if it was exposed to it?

Btw we use HPA in production based on metrics like CPU usage, works exactly as you described.

@NeQuissimus
Copy link
Author

I think I would mostly consider it a convenience feature, a way to standardize collecting and exposing load metrics.
I can see why it may not be necessary in Shardcake itself. A pod may want to be able to collect metrics from entities in order to expose some form of aggregation as a custom metrics (which can then become an input to the HPA).

@ghostdogpr ghostdogpr added the enhancement New feature or request label Oct 1, 2022
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

No branches or pull requests

2 participants