Skip to content

Move smart agent config validation from unmarshal #6187

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

Merged
merged 1 commit into from
May 2, 2025

Conversation

dmitryax
Copy link
Contributor

@dmitryax dmitryax commented May 2, 2025

This fixes receiver_creator failing to start smartagent receivers since 0.124.0 with the following error:

2025-05-01T09:35:43.989Z	info	[email protected]/observerhandler.go:201	starting receiver	{"name": "smartagent/coredns", "endpoint": "10.42.0.8", "endpoint_id": "k8s_observer/c7a1646a-969d-4e5d-9bbd-a95574b903b3", "config": {"extraDimensions":{"metric_source":"k8s-coredns"},"port":9153,"type":"coredns"}}
2025-05-01T09:35:43.991Z	error	[email protected]/observerhandler.go:217	failed to start receiver	{"receiver": "smartagent/coredns", "error": "failed creating endpoint-derived receiver: Validation error in field 'Config.host': host is a required field (got '')"}
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator.(*observerHandler).startReceiver
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/observerhandler.go:217
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator.(*observerHandler).OnAdd
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/observerhandler.go:105
github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/endpointswatcher.(*EndpointsWatcher).updateAndNotifyOfEndpoints
	github.com/open-telemetry/opentelemetry-collector-contrib/extension/[email protected]/endpointswatcher/endpointswatcher.go:114

@dmitryax dmitryax requested review from a team as code owners May 2, 2025 18:03
@dmitryax dmitryax force-pushed the fix-smartagent-receiver-creation branch from 473c9f6 to e596c6c Compare May 2, 2025 18:09
Copy link

codecov bot commented May 2, 2025

Codecov Report

Attention: Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 34.16%. Comparing base (454dff5) to head (e596c6c).

Files with missing lines Patch % Lines
pkg/receiver/smartagentreceiver/config.go 87.50% 1 Missing and 1 partial ⚠️

❌ Your project check has failed because the head coverage (34.16%) is below the target coverage (40.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (454dff5) and HEAD (e596c6c). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (454dff5) HEAD (e596c6c)
35 30
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6187       +/-   ##
===========================================
- Coverage   44.52%   34.16%   -10.37%     
===========================================
  Files         390      390               
  Lines       27014    26993       -21     
===========================================
- Hits        12028     9221     -2807     
- Misses      14148    17152     +3004     
+ Partials      838      620      -218     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This fixes receiver_creator failing to start smartagent receivers since 0.124.0 with the following error:
```
2025-05-01T09:35:43.989Z	info	[email protected]/observerhandler.go:201	starting receiver	{"name": "smartagent/coredns", "endpoint": "10.42.0.8", "endpoint_id": "k8s_observer/c7a1646a-969d-4e5d-9bbd-a95574b903b3", "config": {"extraDimensions":{"metric_source":"k8s-coredns"},"port":9153,"type":"coredns"}}
2025-05-01T09:35:43.991Z	error	[email protected]/observerhandler.go:217	failed to start receiver	{"receiver": "smartagent/coredns", "error": "failed creating endpoint-derived receiver: Validation error in field 'Config.host': host is a required field (got '')"}
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator.(*observerHandler).startReceiver
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/observerhandler.go:217
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator.(*observerHandler).OnAdd
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/observerhandler.go:105
github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/endpointswatcher.(*EndpointsWatcher).updateAndNotifyOfEndpoints
	github.com/open-telemetry/opentelemetry-collector-contrib/extension/[email protected]/endpointswatcher/endpointswatcher.go:114
```
454dff
@dmitryax dmitryax force-pushed the fix-smartagent-receiver-creation branch from e596c6c to 5109a48 Compare May 2, 2025 18:35
@dmitryax dmitryax merged commit ba39576 into main May 2, 2025
1 check passed
@dmitryax dmitryax deleted the fix-smartagent-receiver-creation branch May 2, 2025 19:07
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants