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

Remove dependency on Jaeger's cmd/agent from jaegerreceiver #38237

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

avinpy-255
Copy link

Description

This PR moves the jeager's internal cmd/agent dependencies

Link to tracking issue

Fixes jaegertracing/jaeger#6408,
This PR only removes this dependencies from -

/receiver/jaegerreceiver/trace_receiver.go

Dependencies are -

github.com/jaegertracing/jaeger/cmd/agent/app/processors
github.com/jaegertracing/jaeger/cmd/agent/app/servers
github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp

Testing

Not Done yet

Documentation

Signed-off-by: Avinash <avinashchowdhury81@gmail.com>
@avinpy-255 avinpy-255 requested review from yurishkuro and a team as code owners February 26, 2025 19:57
@avinpy-255 avinpy-255 requested a review from crobert-1 February 26, 2025 19:57
Copy link

linux-foundation-easycla bot commented Feb 26, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.


jr.settings.Logger.Info("Starting UDP server for Binary Thrift", zap.String("endpoint", jr.config.ThriftBinaryUDP.Endpoint))
}

if jr.config.ThriftCompactUDP != nil {
Copy link
Member

Choose a reason for hiding this comment

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

this was conditional before, keep it conditional

Copy link
Author

Choose a reason for hiding this comment

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

okay


package processor

type Processor interface {
Copy link
Member

Choose a reason for hiding this comment

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

Do you actually need this abstraction?

Copy link
Author

Choose a reason for hiding this comment

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

It might appear unnecessary. I initially created it to separate the core processing logic from the UDP server implementation

}

// Done returns a channel that's closed when the processor has stopped
func (p *ThriftProcessor) Done() <-chan struct{} {
Copy link
Member

Choose a reason for hiding this comment

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

Conceptually Thrift processor is just a handler that you need to pass to UDP Server. I recommend using more traditional setup for receivers

  • receiver creates Thrift Handler which is stateless, it only transforms the packet and hands it off to the next trace consumer in the pipeline. Thrift Handler needs no start/stop.
  • receiver creates UDP server which has start/stop and runs in a goroutine. The Thrift Handler is passed to server at construction

"go.uber.org/zap"
)

type PacketHandler interface {
Copy link
Member

Choose a reason for hiding this comment

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

Q: is this code mostly copied from Jaeger?

Copy link
Author

Choose a reason for hiding this comment

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

No, the code is not copied from Jaeger.

Copy link
Member

Choose a reason for hiding this comment

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

Why not? I'm not going to review brand new UDP code. The existing code is battle tested.

@yurishkuro yurishkuro requested a review from Copilot February 27, 2025 22:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR removes the dependency on Jaeger's cmd/agent by moving the internal agent processing to local packages within the receiver. Key changes include the introduction of a new UDP server implementation, a new Thrift processor that leverages the internal UDP server, and modifications in the trace receiver to use the new processor interface.

Reviewed Changes

File Description
receiver/jaegerreceiver/internal/udpserver/udp_server.go Introduces a new UDP server implementation with start/stop functionality and UDP packet handling.
receiver/jaegerreceiver/internal/processor/thrift_processor.go Adds a new Thrift processor using the internal UDP server and removes reliance on external Jaeger dependencies.
receiver/jaegerreceiver/internal/processor/processor.go Defines a new processor interface for consistency across processors.
receiver/jaegerreceiver/trace_receiver.go Updates the receiver to utilize the new processor and removes outdated Jaeger cmd/agent imports.

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

receiver/jaegerreceiver/internal/udpserver/udp_server.go:1

  • The new UDP server implementation is a core component but currently lacks dedicated unit tests. Please add tests to ensure proper error handling and graceful shutdown behavior.
// Copyright The OpenTelemetry Authors

}
if opErr, ok := err.(*net.OpError); ok {
if opErr.Op == "read" && opErr.Net == "udp" {
if opErr.Err.Error() == "use of closed network connection" {
Copy link
Preview

Copilot AI Feb 27, 2025

Choose a reason for hiding this comment

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

Instead of comparing error strings, consider using errors.Is(err, net.ErrClosed) (or a similar approach) for a more reliable and future-proof check.

Suggested change
if opErr.Err.Error() == "use of closed network connection" {
if errors.Is(opErr.Err, net.ErrClosed) {

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
avinpy-255 and others added 4 commits February 28, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove dependencies on Jaeger from opentelemetry-collector-contrib
3 participants