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

Commit

Permalink
Remove gen-go files and import jaeger-go client instead. (#7)
Browse files Browse the repository at this point in the history
* Remove gen-go files and import jaeger-go client instead.

* Small fix.
  • Loading branch information
songy23 authored Apr 30, 2019
1 parent 55c5b8d commit e8b5594
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 2,929 deletions.
19 changes: 13 additions & 6 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@ import (
"io"
"net"

gen "contrib.go.opencensus.io/exporter/jaeger/internal/gen-go/jaeger"
"github.com/apache/thrift/lib/go/thrift"
"github.com/uber/jaeger-client-go/thrift"
"github.com/uber/jaeger-client-go/thrift-gen/agent"
"github.com/uber/jaeger-client-go/thrift-gen/jaeger"
"github.com/uber/jaeger-client-go/thrift-gen/zipkincore"
)

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

// agentClientUDP is a UDP client to Jaeger agent that implements gen.Agent interface.
type agentClientUDP struct {
gen.Agent
agent.Agent
io.Closer

connUDP *net.UDPConn
client *gen.AgentClient
client *agent.AgentClient
maxPacketSize int // max size of datagram in bytes
thriftBuffer *thrift.TMemoryBuffer // buffer used to calculate byte size of a span
}
Expand All @@ -45,7 +47,7 @@ func newAgentClientUDP(hostPort string, maxPacketSize int) (*agentClientUDP, err

thriftBuffer := thrift.NewTMemoryBufferLen(maxPacketSize)
protocolFactory := thrift.NewTCompactProtocolFactory()
client := gen.NewAgentClientFactory(thriftBuffer, protocolFactory)
client := agent.NewAgentClientFactory(thriftBuffer, protocolFactory)

destAddr, err := net.ResolveUDPAddr("udp", hostPort)
if err != nil {
Expand All @@ -69,7 +71,7 @@ func newAgentClientUDP(hostPort string, maxPacketSize int) (*agentClientUDP, err
}

// EmitBatch implements EmitBatch() of Agent interface
func (a *agentClientUDP) EmitBatch(batch *gen.Batch) error {
func (a *agentClientUDP) EmitBatch(batch *jaeger.Batch) error {
a.thriftBuffer.Reset()
a.client.SeqId = 0 // we have no need for distinct SeqIds for our one-way UDP messages
if err := a.client.EmitBatch(batch); err != nil {
Expand All @@ -83,6 +85,11 @@ func (a *agentClientUDP) EmitBatch(batch *gen.Batch) error {
return err
}

// EmitZipkinBatch implements EmitZipkinBatch() of Agent interface
func EmitZipkinBatch(spans []*zipkincore.Span) (err error) {
return fmt.Errorf("not implemented")
}

// Close implements Close() of io.Closer and closes the underlying UDP connection.
func (a *agentClientUDP) Close() error {
return a.connUDP.Close()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module contrib.go.opencensus.io/exporter/jaeger

require (
github.com/apache/thrift v0.12.0
github.com/uber/jaeger-client-go v2.15.0+incompatible
go.opencensus.io v0.21.0
google.golang.org/api v0.4.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/apache/thrift v0.12.0 h1:pODnxUFNcjP9UTLZGTdeh+j16A8lJbRvD3rOtrk/7bs=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/uber/jaeger-client-go v2.15.0+incompatible h1:NP3qsSqNxh8VYr956ur1N/1C1PjvOJnJykCzcD5QHbk=
github.com/uber/jaeger-client-go v2.15.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
2 changes: 0 additions & 2 deletions internal/gen-go/README

This file was deleted.

6 changes: 0 additions & 6 deletions internal/gen-go/jaeger/GoUnusedProtection__.go

This file was deleted.

244 changes: 0 additions & 244 deletions internal/gen-go/jaeger/agent.go

This file was deleted.

Loading

0 comments on commit e8b5594

Please sign in to comment.