-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: adding influxdb scaler #1326
Conversation
7d44d5d
to
d93b82a
Compare
I will be working to update the docs by submitting a PR |
pkg/scalers/influxdb_scaler.go
Outdated
return false, err | ||
} | ||
|
||
return value > s.metadata.thresholdValue, nil |
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.
value >0 ?
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.
Have questions about the value of IsActive?
pkg/scalers/influxdb_scaler.go
Outdated
targetMetricValue := resource.NewQuantity(int64(s.metadata.thresholdValue), resource.DecimalSI) | ||
externalMetric := &v2beta2.ExternalMetricSource{ | ||
Metric: v2beta2.MetricIdentifier{ | ||
Name: kedautil.NormalizeString(fmt.Sprintf("%s-%s", "influxdb", s.metadata.organizationName)), |
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.
The metric name should be unique enough, to allow specify multiple triggers in one Scaler and it should be possible to distinguish between those individual metric names.
I wonder wheter is s.metadata.organizationName
enough?
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.
I think that could be enough.
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.
What if I want to create two (or more) triggers that use the same organization name? I am not an InfluxDB expert, but I suppose this could be possible?
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.
@zroubalik Yes that definitely could be possible
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.
So in this case (when I define two or more influxdb scalers in ScaledObject, that will use the same organization) the generated metric name will be same, right? And that's not ideal :)
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.
@zroubalik Agreed. There is no passed in info that would make this name unique enough. Would using a timestamp suffice?
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.
- Could you please add an entry to the Changelog? (Unreleased sectin)
- Do you think you can add e2e tests for this scaler? https://github.com/kedacore/keda/tree/main/tests
Thanks for all of the feedback. |
I want to create a client instance that will write data to my influxdb server in kubernetes. Is it okay if I use my own docker image for a job that will write data to server? Or should I port-forward the service (influxdb server) and run a script that will write data to the server? This is for the e2e tests. |
@yquansah yeah, it is completely ok to use your Docker image, we have started to collect these kind of client apps in the separate repo https://github.com/kedacore/test-tools/tree/master/e2e/images, but you can start with your client first. |
@zroubalik Looks like there is a lot of moving parts here. I think i'd rather wait till influxdb 2.0 becomes released on docker hub to reference a stable version of it. Can the e2e tests wait, or is it a requirement for this to get merged? |
@yquansah so influxdb 2.0 is not released yet? So you would like to wait with this PR for a stable influxdb version? If so, convert this PR to the draft please. For the e2e test, it is not a hard requirement, but we would like to see it coming in this PR or in a separate one, but as soon as possible after merging the first one. e2e tests are important and even more with the growing list of supported scalers in KEDA :) Thanks! |
@zroubalik I found an official release candidate version I can use of influxdb v2. Will be getting a e2e test out. Sorry for the back and forth!! |
@yquansah no worries and thanks for update! :) |
7b34f13
to
d4bfcea
Compare
@zroubalik e2e tests, and changes to CHANGELOG section added 😄 |
Any news on te docs @yquansah? |
@tomkerkhove Yeah I will get that in. I just wanted to get eyes on these last bits here code-wise. |
@tomkerkhove As requested here is the documentation PR: kedacore/keda-docs#315 |
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.
Looking good, but still have the concern on metricName uniqueness
pkg/scalers/influxdb_scaler.go
Outdated
targetMetricValue := resource.NewQuantity(int64(s.metadata.thresholdValue), resource.DecimalSI) | ||
externalMetric := &v2beta2.ExternalMetricSource{ | ||
Metric: v2beta2.MetricIdentifier{ | ||
Name: kedautil.NormalizeString(fmt.Sprintf("%s-%s", "influxdb", s.metadata.organizationName)), |
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.
So in this case (when I define two or more influxdb scalers in ScaledObject, that will use the same organization) the generated metric name will be same, right? And that's not ideal :)
Added a remark on the docs but moving it here - Is the org name purely for InfluxDB Cloud? If so, can the scaler work with other servers as well? |
@tomkerkhove No, org name is used in open source version as well |
Ok, thanks! |
50298c1
to
b4a024c
Compare
@yquansah you will need to fix the linter errors in Static Checks, see the errors. to fix the cyclomatic problem, we can ignore this check for the - path: scale_handler.go
linters:
- gocyclo to this line: Line 56 in 29cedc7 And then there is the other problem, that you need to fix in your code. |
@zroubalik Static check errors fixed. Thank you!
There is still this issue here. What would you suggest? |
We should use the similar approach that's being used for Prometheus and Postgresql (change coming in this PR: #1381). |
Signed-off-by: Yoofi Quansah <[email protected]>
Signed-off-by: Yoofi Quansah <[email protected]>
Signed-off-by: Yoofi Quansah <[email protected]>
Signed-off-by: Yoofi Quansah <[email protected]>
Signed-off-by: Yoofi Quansah <[email protected]>
Signed-off-by: Yoofi Quansah <[email protected]>
Signed-off-by: Yoofi Quansah <[email protected]>
Signed-off-by: Yoofi Quansah <[email protected]>
Signed-off-by: Yoofi Quansah <[email protected]>
be9d65f
to
d95dccf
Compare
@zroubalik Awesome. I pushed a commit, let me know if this suffices. d95dccf |
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.
LGTM, thanks for the contribution!
This PR seeks to add the
influxdb
scaler and relevant tests. InfluxDB is a time series database, which has a tried-and-true use case for application monitoring supporting a wide range of user defined metrics. The scaler gives the user the flexibility to define a threshold value, and that threshold value is compared against the actual queried value.Checklist
Relates to #1239