Skip to content

Commit

Permalink
move concurrent http transport to exist file
Browse files Browse the repository at this point in the history
  • Loading branch information
tandysun committed Nov 8, 2023
1 parent cf1a0fe commit bf53a92
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 31 deletions.
1 change: 0 additions & 1 deletion idl
Submodule idl deleted from 3471ff
29 changes: 0 additions & 29 deletions transport/concurrent_http.go

This file was deleted.

25 changes: 24 additions & 1 deletion transport/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"github.com/uber/jaeger-client-go/thrift"

"github.com/uber/jaeger-client-go"
j "github.com/uber/jaeger-client-go/thrift-gen/jaeger"
)

Expand Down Expand Up @@ -172,3 +171,27 @@ func serializeThrift(obj thrift.TStruct) (*bytes.Buffer, error) {
}
return t.Buffer, nil
}

type ConcurrentHttpTransport struct {
*HTTPTransport
pool chan int
}

func NewConcurrentHttpTransport(httpTransport *HTTPTransport) *ConcurrentHttpTransport {
ctp := &ConcurrentHttpTransport{
HTTPTransport: httpTransport,
}
ctp.pool = make(chan int, 100)
for i := 0; i < 100; i++ {
ctp.pool <- 0
}
return ctp
}

func (c *ConcurrentHttpTransport) send(spans []*j.Span) error {
<-c.pool
defer func() {
c.pool <- 0
}()
return c.HTTPTransport.send(spans)
}

0 comments on commit bf53a92

Please sign in to comment.