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

Jaeger Receiver enable all protocols even if configured for just one #158

Closed
pjanotti opened this issue Jul 16, 2019 · 8 comments
Closed

Comments

@pjanotti
Copy link
Contributor

The Jaeger receiver enables all protocols for collector and agent no matter the configuration protocol. This is a bug that needs to be fixed: each receiver/protocol specification should enable only the corresponding endpoint.

@pjanotti pjanotti added this to the 0.1.0 milestone Jul 16, 2019
@tigrannajaryan
Copy link
Member

This is likely due to #113

@pjanotti
Copy link
Contributor Author

Yes, but it is more than that: the receiver code assumes one configuration and all protocols. We need to take out the common code and actually make separate receivers for each protocol.

@tigrannajaryan
Copy link
Member

tigrannajaryan commented Jul 16, 2019

Looking at the code I see that protocols specified in the config are checked and only the specified protocol port is passed: https://github.com/open-telemetry/opentelemetry-service/blob/8721e3beaf1c449d88c2f6f78517cd03d6b2c7f3/receiver/jaegerreceiver/factory.go#L100-L114

The problem seems to be because of not checking the Enabled field of each proto, but I may be wrong.

We need to take out the common code and actually make separate receivers for each protocol.

Is this required? Is there a reason the current code will not work once Enabled flag is correctly taken into account?

@pjanotti
Copy link
Contributor Author

You can make it work just taking into account the enabled flag and it seems acceptable in the short run, but, the we should do a proper refactor. At minimum we need to not enable the agent until we have configurations for it.

@ccaraman
Copy link
Contributor

By refactoring, we can modify the receiver to use the configmodels.ReceiverSettings like the rest of the receivers(even make it a requirement maybe?) resulting in a consistent way to enable a receiver and making it easier for us and our customers to work with.

@tigrannajaryan
Copy link
Member

@ccaraman I do not see how it can be done. configmodels.ReceiverSettings the way it is defined currently is intended to specify a single protocol. Some receivers support multiple protocols so they need plurality of such settings.

The config format was defined and approved with multiple stakeholders (https://docs.google.com/document/d/1GWOzV0H0RTN1adiwo7fTmkjfCATDDFGuOB4jp3ldCc8/edit#heading=h.g6rvvz3l271i). We can change the format if there is a better proposal but it will have to pass through review and approval process again.

If you have improvement suggestions it is best to target them post 0.1.0 milestone and before the first stable release (date TBD).

@pjanotti pjanotti removed this from the 0.1.0 milestone Jul 31, 2019
@ccaraman
Copy link
Contributor

From further reading the code - it is more than just respecting the enabled flag the code itself doesn't expect there to be protocols not enabled.

When the Receiver is started
https://github.com/open-telemetry/opentelemetry-service/blob/master/receiver/jaegerreceiver/trace_receiver.go#L185-L204
(lets ignore the agent part for now)
The collector component ends up starting all of the protocols

The following ends up using the default tchannel port if no tchannel port was set during the factory methods.
Ex:
https://github.com/open-telemetry/opentelemetry-service/blob/master/receiver/jaegerreceiver/trace_receiver.go#L381-L395

	tch, terr := tchannel.NewChannel("jaeger-collector", new(tchannel.ChannelOptions))
	if terr != nil {
		return fmt.Errorf("failed to create NewTChannel: %v", terr)
	}

	server := thrift.NewServer(tch)
	server.Register(jaeger.NewTChanCollectorServer(jr))

	taddr := jr.tchannelAddr()
	tln, terr := net.Listen("tcp", taddr)

where https://github.com/open-telemetry/opentelemetry-service/blob/master/receiver/jaegerreceiver/trace_receiver.go#L137-L146

func (jr *jReceiver) tchannelAddr() string {
	var port int
	if jr.config != nil {
		port = jr.config.CollectorThriftPort
	}
	if port <= 0 {
		port = defaultTChannelPort
	}
	return fmt.Sprintf(":%d", port)
}

Resulting in the ThriftPort being started even if a config specified otherwise.

The same thing for the Thrift HTTP port and the gRPC port.

tigrannajaryan pushed a commit that referenced this issue Jan 14, 2020
Fixes #445, #158 

This PR addresses some Jaeger receiver config cleanup as well as makes some breaking changes to the way the config is handled.   See below for details.

**Fixes/Updates**
- Disabled flag is respected per protocol
- Unspecified protocols will no longer be started
- Empty protocol configs can now be specified to start the protocol with defaults. e.g.
  ```
  jaeger:
    protocols:
      grpc:
  ```
- Updated readmes
- Naming and behavior of per protocol Addr/Enabled functions in `trace_reciever.go` has been standardized.
- Added thrift tchannel test to meet code coverage

**Breaking Change**
Changed the way an empty `jaeger:` config is handled.  An empty/default config does not start any jaeger protocols.  Previously it started all three collector protocols.  This is a consequence of not starting unspecified protocols.
@pjanotti
Copy link
Contributor Author

pjanotti commented Feb 3, 2020

Fixed via #490

@pjanotti pjanotti closed this as completed Feb 3, 2020
MovieStoreGuy pushed a commit to atlassian-forks/opentelemetry-collector that referenced this issue Nov 11, 2021
hughesjj pushed a commit to hughesjj/opentelemetry-collector that referenced this issue Apr 27, 2023
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

No branches or pull requests

3 participants