Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Support Jaeger agent export #518

Merged
merged 1 commit into from
Mar 19, 2018

Conversation

oiooj
Copy link
Contributor

@oiooj oiooj commented Mar 5, 2018

Almost users use jaeger agent to report trace data.

Copy link
Contributor

@rakyll rakyll left a comment

Choose a reason for hiding this comment

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

Thanks!

Left two high-level comments before reviewing further.

@@ -39,6 +39,10 @@ type Options struct {
// For example, http://localhost:14268.
Endpoint string

// LocalAgentHostPort instructs exporter to send spans to jaeger-agent at this address.
// For example, localhost:6831.
LocalAgentHostPort string
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we call this AgentEndpoint? As far as, I can understand, agent can work on UDP and TCP. Don't we need to give options to the user?

Maybe it might make sense to have a net.Conn field.

// ...
AgentConn *net.Conn

Then, user can dial it themselves:

conn, err := net.Dial("tcp", "endpoint:port")

and we can type cast conn to see whether we should use the UDP or TCP endpoint.

Copy link
Contributor Author

@oiooj oiooj Mar 6, 2018

Choose a reason for hiding this comment

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

@rakyll Updated, As far as I know, agent only works on UDP. http://jaeger.readthedocs.io/en/latest/deployment/

"go.opencensus.io/trace"
)

func main() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a full example is too much for the agent support, but we can add a godoc example demonstrating how to create an exporter that uses the agent.

@oiooj oiooj force-pushed the pr-jaeger-client branch 2 times, most recently from 84fc0a1 to 4d6ee27 Compare March 6, 2018 06:25
Copy link
Member

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

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

This is great, thank you @oiooj and welcome to OpenCensus! LGTM, but I'll let @rakyll merge this in.

@semistrict
Copy link
Contributor

@rakyll are you ok to merge this?

Copy link
Contributor

@rakyll rakyll left a comment

Choose a reason for hiding this comment

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

Left some comments.

)

// UDPPacketMaxLength is the max size of UDP packet we want to send, synced with jaeger-agent
const UDPPacketMaxLength = 65000
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't export.

udpPacketMaxLength.

const UDPPacketMaxLength = 65000

// AgentClientUDP is a UDP client to Jaeger agent that implements gen.Agent interface.
type AgentClientUDP struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't export this, these types should not be visible to the user.

agentClientUDP

}

// NewAgentClientUDP creates a client that sends spans to Jaeger Agent over UDP.
func NewAgentClientUDP(hostPort string, maxPacketSize int) (*AgentClientUDP, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto, newAgentClientUDP

// Register the Jaeger exporter to be able to retrieve
// the collected spans.
exporter, err := jaeger.NewExporter(jaeger.Options{
AgentEndpoint: "localhost:6831",
Copy link
Contributor

Choose a reason for hiding this comment

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

Agent can listen on TCP, right? Are we doing anything to allow user to depend on an TCP endpoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rakyll, As far as I know, agent only works on UDP. http://jaeger.readthedocs.io/en/latest/deployment/

@oiooj oiooj force-pushed the pr-jaeger-client branch 2 times, most recently from d6e0b0b to 054e41c Compare March 10, 2018 07:15
@rakyll rakyll changed the title support jaeger agent export Support Jaeger agent export Mar 19, 2018
@rakyll rakyll merged commit d1188f8 into census-instrumentation:master Mar 19, 2018
@rakyll
Copy link
Contributor

rakyll commented Mar 19, 2018

Thanks!

rakyll added a commit to rakyll/opencensus-go that referenced this pull request Mar 19, 2018
Build is broken due to a bad merge, census-instrumentation#518.
@rakyll rakyll mentioned this pull request Mar 19, 2018
rakyll added a commit that referenced this pull request Mar 19, 2018
Build is broken due to a bad merge, #518.
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.

None yet

4 participants