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

feat: Introduce operational metrics in OpenTelemetry Collector #4860

Merged
merged 29 commits into from
Sep 28, 2023

Conversation

SpiritZhou
Copy link
Contributor

@SpiritZhou SpiritZhou commented Aug 4, 2023

Refactor the current Prometheus.go file by adding a middleware metriccollector.go to handle initialization and metrics collection for both Prometheus and OpenTelemetry.

About e2e test:

  1. Add opentelemetry install in setup_test.go. This opentelemetry has promethues exporter.
  2. Add env and flag when KEDA is running in e2e test env.
  3. Fecth metric from opentelemetry through promethues port to test

Checklist

Relates to #3078
Relates to kedacore/keda-docs#1215

Signed-off-by: SpiritZhou <[email protected]>
@github-actions
Copy link

github-actions bot commented Aug 4, 2023

Thank you for your contribution! 🙏 We will review your PR as soon as possible.

🏖️ Over the summer, the response time will be longer than usual due to maintainers taking time off so please bear with us.

While you are waiting, make sure to:

Learn more about:

Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
@SpiritZhou SpiritZhou marked this pull request as ready for review August 23, 2023 09:54
@SpiritZhou SpiritZhou requested a review from a team as a code owner August 23, 2023 09:54
Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

This is an awesome improvement!! 💪
I have left some comments inline, but apart from them:

As testing otel is a must, I'd move the Kustomization to config/e2e because it's the Kustomization file that we use for deploying e2e tests (for releases we use config/default). It makes easier to maintain the files and also ensures that always is deployed

We also have to document this new option in keda-docs 🙏

tests/helper/helper.go Outdated Show resolved Hide resolved
tests/opentelemetry_setup/otlp.yml Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@tomkerkhove tomkerkhove changed the title Add opentelemetry metric collection. feat: Introduce operational metrics in OpenTelemetry Collector Aug 24, 2023
@tomkerkhove
Copy link
Member

We also need to expose this in our Helm chart but that's a separate PR as well

SpiritZhou and others added 2 commits August 24, 2023 17:17
Co-authored-by: Tom Kerkhove <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
@JorTurFer
Copy link
Member

JorTurFer commented Aug 25, 2023

/run-e2e sequential
Update: You can check the progress here

Signed-off-by: SpiritZhou <[email protected]>
@JorTurFer
Copy link
Member

+1

Signed-off-by: SpiritZhou <[email protected]>
@SpiritZhou
Copy link
Contributor Author

@zroubalik @JorTurFer Just updated the code. Hope it can meet the ddl.

@zroubalik
Copy link
Member

@zroubalik @JorTurFer Just updated the code. Hope it can meet the ddl.

@SpiritZhou thanks! I am on it now, do you think you can update Helm charts as well?

@zroubalik
Copy link
Member

zroubalik commented Sep 27, 2023

/run-e2e sequential
Update: You can check the progress here

@zroubalik
Copy link
Member

zroubalik commented Sep 27, 2023

/run-e2e sequential
Update: You can check the progress here

Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

Unfortunately, prometheus tests is failing:

prometheus_metrics_test.go:336: --- testing scaled object errors ---
    helper.go:567: Deleting template: scaledObjectTemplate
    helper.go:5***9: Applying template: wrongScaledObjectTemplate
    prometheus_metrics_test.go:35***: 
        	Error Trace:	/__w/keda/keda/tests/sequential/prometheus_metrics/prometheus_metrics_test.go:35***
        	            				/__w/keda/keda/tests/sequential/prometheus_metrics/prometheus_metrics_test.go:***67
        	Error:      	Should not be: 0
        	Test:       	TestPrometheusMetrics

Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

@SpiritZhou one more thing, could you please make it an experimental feature? Marking it so in the docs and changelog?

There's nothing wrong with the feature itself. Just for us to be able to change the metrics or nomenclature if needed without the need to keep backwards compatibility.

@zroubalik zroubalik mentioned this pull request Sep 27, 2023
12 tasks
Signed-off-by: SpiritZhou <[email protected]>
Signed-off-by: SpiritZhou <[email protected]>
@SpiritZhou
Copy link
Contributor Author

@zroubalik I fixed the test and update the "experimental feature". Could you help to review them again?

@tomkerkhove
Copy link
Member

tomkerkhove commented Sep 27, 2023

/run-e2e sequential
Update: You can check the progress here

Copy link
Member

@zroubalik zroubalik left a 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 quick fix!

@tomkerkhove
Copy link
Member

Talked to @SpiritZhou and he'll start Helm chart PR, if he can't finish it today I'll take over tomorrow. That should allow us to merge this one in time

@SpiritZhou
Copy link
Contributor Author

It is strange. The prometheus_metrics_test can be passed in my local minikube env...

@zroubalik
Copy link
Member

zroubalik commented Sep 27, 2023

/run-e2e sequential
Update: You can check the progress here

Signed-off-by: SpiritZhou <[email protected]>
@SpiritZhou
Copy link
Contributor Author

@zroubalik @JorTurFer @tomkerkhove The failed e2e test may not be caused by OpenTelemetry PR. I found it happened in this PR before (https://github.com/kedacore/keda/actions/runs/6308971553). And I also found that the correct metric value can be retrieved after around 15s. I don't have any idea why it becomes slow.

@zroubalik
Copy link
Member

@zroubalik @JorTurFer @tomkerkhove The failed e2e test may not be caused by OpenTelemetry PR. I found it happened in this PR before (https://github.com/kedacore/keda/actions/runs/6308971553). And I also found that the correct metric value can be retrieved after around 15s. I don't have any idea why it becomes slow.

Right, it is failing on main as well. So it is not relevant to this PR. You can ignore it in this PR, great work, thanks!

Signed-off-by: SpiritZhou <[email protected]>
@tomkerkhove tomkerkhove merged commit 95a235b into kedacore:main Sep 28, 2023
20 checks passed
@tomkerkhove
Copy link
Member

I will pick up Helm chart later today

toniiiik pushed a commit to toniiiik/keda that referenced this pull request Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants