Skip to content

Move smart agent config validation from unmarshal#6187

Merged
dmitryax merged 1 commit intomainfrom
fix-smartagent-receiver-creation
May 2, 2025
Merged

Move smart agent config validation from unmarshal#6187
dmitryax merged 1 commit intomainfrom
fix-smartagent-receiver-creation

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	receivercreator@v0.124.1-0.20250415150511-f840bdff19ca/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	receivercreator@v0.124.1-0.20250415150511-f840bdff19ca/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/receivercreator@v0.124.1-0.20250415150511-f840bdff19ca/observerhandler.go:217
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator.(*observerHandler).OnAdd
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator@v0.124.1-0.20250415150511-f840bdff19ca/observerhandler.go:105
github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/endpointswatcher.(*EndpointsWatcher).updateAndNotifyOfEndpoints
	github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer@v0.124.1/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
@codecov
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	receivercreator@v0.124.1-0.20250415150511-f840bdff19ca/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	receivercreator@v0.124.1-0.20250415150511-f840bdff19ca/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/receivercreator@v0.124.1-0.20250415150511-f840bdff19ca/observerhandler.go:217
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator.(*observerHandler).OnAdd
	github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator@v0.124.1-0.20250415150511-f840bdff19ca/observerhandler.go:105
github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer/endpointswatcher.(*EndpointsWatcher).updateAndNotifyOfEndpoints
	github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer@v0.124.1/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