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

Fix/config exporter endpoint panic #2653

Merged

Conversation

dexter0195
Copy link
Contributor

Description:
This PR fixes a CrashLoopBackoff caused by a panic occurring when, in the spec.config, the endpoint for the prometheus exporter is not valid.

I integrated a simple check in internal/manifests/collector/parser/exporter/exporter_prometheus.go on the function func (o *PrometheusExporterParser) Ports() ([]corev1.ServicePort, error) to check if singlePortFromConfigEndpoint is returning a nil pointer.

Link to tracking Issue(s): #2628

  • Resolves: 2628

Testing:

  • adds unit tests on the exporter package for Prometheus.

@dexter0195 dexter0195 requested a review from a team as a code owner February 21, 2024 13:39
Copy link

linux-foundation-easycla bot commented Feb 21, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@dexter0195 dexter0195 force-pushed the fix/config-exporter-endpoint-panic branch from ba757e2 to 2feb5ba Compare February 21, 2024 15:16
Copy link
Contributor

@swiatekm-sumo swiatekm-sumo left a comment

Choose a reason for hiding this comment

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

LGTM, minor quibble about test assertions aside. Thank you for your contribution!

@jaronoff97 jaronoff97 enabled auto-merge (squash) February 21, 2024 23:01
auto-merge was automatically disabled February 22, 2024 06:24

Head branch was pushed to by a user without write access

@dexter0195
Copy link
Contributor Author

Ready to merge whenever you want! Sorry for the hiccups on the CI 🙏

@jaronoff97 jaronoff97 merged commit 18e50b0 into open-telemetry:main Feb 22, 2024
29 checks passed
@dexter0195 dexter0195 deleted the fix/config-exporter-endpoint-panic branch February 22, 2024 17:20
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
* fix: exporter panic on malformed endpoint configuration

* feat: adds tests for Ports in exporter.go

* add chloggen file

* adds header + fix test

* Update internal/manifests/collector/parser/exporter/exporter_test.go

Co-authored-by: Mikołaj Świątek <mail+sumo@mikolajswiatek.com>

* fix: test exporter_test.go

---------

Co-authored-by: Mikołaj Świątek <mail+sumo@mikolajswiatek.com>
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.

None yet

3 participants