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

Service exposes ports for receivers which are not enabled #257

Closed
bhiravabhatla opened this issue Apr 28, 2021 · 6 comments · Fixed by #778
Closed

Service exposes ports for receivers which are not enabled #257

bhiravabhatla opened this issue Apr 28, 2021 · 6 comments · Fixed by #778
Assignees
Labels
area:collector Issues for deploying collector bug Something isn't working

Comments

@bhiravabhatla
Copy link
Contributor

bhiravabhatla commented Apr 28, 2021

If I understand open-telemetry config correctly, a receiver is enabled only if its mentioned in service section of config

Configuring a receiver does not enable it. Receivers are enabled via pipelines within the service section.

Reference - https://opentelemetry.io/docs/collector/configuration/

In our current implementation of service reconciliation, while fetching inferred Ports - I do not see this check.

func ConfigToReceiverPorts(logger logr.Logger, config map[interface{}]interface{}) ([]corev1.ServicePort, error) {

ports, err := adapters.ConfigToReceiverPorts(params.Log, config)
if err != nil {
params.Log.Error(err, "couldn't build the service for this instance")
return nil
}

This would imply that we would have disabled receiver ports in service spec. Is this expected. Or am I missing something?

@jpkrohling
Copy link
Member

You are absolutely correct. Our logic should indeed check if the receiver is being used in any pipelines before deciding to open the port.

@jpkrohling jpkrohling added the bug Something isn't working label Apr 28, 2021
@bhiravabhatla
Copy link
Contributor Author

I can work on this once I am done with unit test cases

@bhiravabhatla
Copy link
Contributor Author

@jpkrohling - started working on this. Have a question, as of now in operator we are not umarshalling collector config to a struct. We are unmarshalling it to map[interface]interface{}.

To get the list of enabled receivers it would be easier to unmarshall the config into a Config struct - rather than recursively parsing through a map[interface]interface{}. opentelemetry-collector code base already has logic to unmarshall the config. Can we reuse it?

@jpkrohling
Copy link
Member

I think @pavolloffay, @rubenvp8510, and now you have proposed that. While I think that not having a dependency on the otel-collector API is advantageous, as the interface the collector has with its users is indeed the config as a string (and we are one of such users), I do see the benefits of reusing their config structs.

If both @pavolloffay and @rubenvp8510 are still of this opinion, I'm OK with merging a PR dedicated to introducing this new pattern.

@yuriolisa
Copy link
Contributor

@bhiravabhatla are you still working on that issue?

@pavolloffay pavolloffay added the area:collector Issues for deploying collector label Feb 15, 2022
@yuriolisa
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:collector Issues for deploying collector bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants