fix: bump thrift to 0.14.2 and zipkin-go-opentracing 0.4.5 (#9700)
This commit is contained in:
parent
5a71f761dc
commit
7de9c5ff27
|
|
@ -173,7 +173,6 @@ following works:
|
|||
- github.com/opencontainers/go-digest [Apache License 2.0](https://github.com/opencontainers/go-digest/blob/master/LICENSE)
|
||||
- github.com/opencontainers/image-spec [Apache License 2.0](https://github.com/opencontainers/image-spec/blob/master/LICENSE)
|
||||
- github.com/opentracing/opentracing-go [Apache License 2.0](https://github.com/opentracing/opentracing-go/blob/master/LICENSE)
|
||||
- github.com/openzipkin/zipkin-go-opentracing [MIT License](https://github.com/openzipkin/zipkin-go-opentracing/blob/master/LICENSE)
|
||||
- github.com/philhofer/fwd [MIT License](https://github.com/philhofer/fwd/blob/master/LICENSE.md)
|
||||
- github.com/pierrec/lz4 [BSD 3-Clause "New" or "Revised" License](https://github.com/pierrec/lz4/blob/master/LICENSE)
|
||||
- github.com/pion/dtls [MIT License](https://github.com/pion/dtls/blob/master/LICENSE)
|
||||
|
|
|
|||
7
go.mod
7
go.mod
|
|
@ -42,7 +42,7 @@ require (
|
|||
github.com/antchfx/xmlquery v1.3.5
|
||||
github.com/antchfx/xpath v1.1.11
|
||||
github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230 // indirect
|
||||
github.com/apache/thrift v0.13.0
|
||||
github.com/apache/thrift v0.14.2
|
||||
github.com/aristanetworks/glog v0.0.0-20191112221043-67e8567f59f3 // indirect
|
||||
github.com/aristanetworks/goarista v0.0.0-20190325233358-a123909ec740
|
||||
github.com/armon/go-metrics v0.3.3 // indirect
|
||||
|
|
@ -205,8 +205,9 @@ require (
|
|||
github.com/opencontainers/image-spec v1.0.1 // indirect
|
||||
github.com/opencontainers/runc v1.0.0-rc95 // indirect
|
||||
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/openzipkin/zipkin-go-opentracing v0.3.4
|
||||
github.com/opentracing/opentracing-go v1.2.0
|
||||
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5
|
||||
github.com/openzipkin/zipkin-go v0.2.5
|
||||
github.com/philhofer/fwd v1.1.1 // indirect
|
||||
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
|
||||
github.com/pion/dtls/v2 v2.0.9
|
||||
|
|
|
|||
8
go.sum
8
go.sum
|
|
@ -221,8 +221,9 @@ github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VT
|
|||
github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230 h1:5ultmol0yeX75oh1hY78uAFn3dupBQ/QUNxERCkiaUQ=
|
||||
github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0=
|
||||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI=
|
||||
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/apache/thrift v0.14.2 h1:hY4rAyg7Eqbb27GB6gkhUKrRAuc8xRjlNtJq+LseKeY=
|
||||
github.com/apache/thrift v0.14.2/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
|
||||
github.com/aristanetworks/glog v0.0.0-20191112221043-67e8567f59f3 h1:Bmjk+DjIi3tTAU0wxGaFbfjGUqlxxSXARq9A96Kgoos=
|
||||
github.com/aristanetworks/glog v0.0.0-20191112221043-67e8567f59f3/go.mod h1:KASm+qXFKs/xjSoWn30NrWBBvdTTQq+UjkhjEJHfSFA=
|
||||
github.com/aristanetworks/goarista v0.0.0-20190325233358-a123909ec740 h1:FD4/ikKOFxwP8muWDypbmBWc634+YcAs3eBrYAmRdZY=
|
||||
|
|
@ -1291,12 +1292,13 @@ github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mo
|
|||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
|
||||
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
|
||||
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5 h1:ZCnq+JUrvXcDVhX/xRolRBZifmabN1HcS1wrPSvxhrU=
|
||||
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
github.com/openzipkin/zipkin-go-opentracing v0.3.4 h1:x/pBv/5VJNWkcHF1G9xqhug8Iw7X1y1zOMzDmyuvP2g=
|
||||
github.com/openzipkin/zipkin-go-opentracing v0.3.4/go.mod h1:js2AbwmHW0YD9DwIw2JhQWmbfFi/UnWyYwdVhqbCDOE=
|
||||
github.com/openzipkin/zipkin-go v0.2.5 h1:UwtQQx2pyPIgWYHRg+epgdx1/HnBQTgN3/oIYEJTQzU=
|
||||
github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE=
|
||||
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
|
||||
|
|
|
|||
|
|
@ -24,7 +24,10 @@ import (
|
|||
"log"
|
||||
"time"
|
||||
|
||||
zipkin "github.com/openzipkin/zipkin-go-opentracing"
|
||||
otlog "github.com/opentracing/opentracing-go/log"
|
||||
zipkinot "github.com/openzipkin-contrib/zipkin-go-opentracing"
|
||||
"github.com/openzipkin/zipkin-go"
|
||||
zipkinhttp "github.com/openzipkin/zipkin-go/reporter/http"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -46,27 +49,30 @@ func init() {
|
|||
func main() {
|
||||
flag.Parse()
|
||||
var hostname = fmt.Sprintf("http://%s:9411/api/v1/spans", ZipkinServerHost)
|
||||
collector, err := zipkin.NewHTTPCollector(
|
||||
reporter := zipkinhttp.NewReporter(
|
||||
hostname,
|
||||
zipkin.HTTPBatchSize(BatchSize),
|
||||
zipkin.HTTPMaxBacklog(MaxBackLog),
|
||||
zipkin.HTTPBatchInterval(time.Duration(BatchTimeInterval)*time.Second))
|
||||
if err != nil {
|
||||
log.Fatalf("Error initializing zipkin http collector: %v\n", err)
|
||||
}
|
||||
defer collector.Close()
|
||||
|
||||
tracer, err := zipkin.NewTracer(
|
||||
zipkin.NewRecorder(collector, false, "127.0.0.1:0", "Trivial"))
|
||||
zipkinhttp.BatchSize(BatchSize),
|
||||
zipkinhttp.MaxBacklog(MaxBackLog),
|
||||
zipkinhttp.BatchInterval(time.Duration(BatchTimeInterval)*time.Second),
|
||||
)
|
||||
defer reporter.Close()
|
||||
|
||||
endpoint, err := zipkin.NewEndpoint("Trivial", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
log.Fatalf("Error: %v\n", err)
|
||||
}
|
||||
|
||||
nativeTracer, err := zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(endpoint))
|
||||
if err != nil {
|
||||
log.Fatalf("Error: %v\n", err)
|
||||
}
|
||||
|
||||
tracer := zipkinot.Wrap(nativeTracer)
|
||||
|
||||
log.Printf("Writing %d spans to zipkin server at %s\n", SpanCount, hostname)
|
||||
for i := 0; i < SpanCount; i++ {
|
||||
parent := tracer.StartSpan("Parent")
|
||||
parent.LogEvent(fmt.Sprintf("Trace%d", i))
|
||||
parent.LogFields(otlog.Message(fmt.Sprintf("Trace%d", i)))
|
||||
parent.Finish()
|
||||
}
|
||||
log.Println("Done. Flushing remaining spans...")
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ Otherwise, the input file will be interpreted as json, and the output will be en
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"flag"
|
||||
|
|
@ -32,7 +33,7 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/codec/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -100,20 +101,20 @@ func jsonToZipkinThrift(jsonRaw []byte) ([]byte, error) {
|
|||
zspans = append(zspans, spans...)
|
||||
|
||||
buf := thrift.NewTMemoryBuffer()
|
||||
transport := thrift.NewTBinaryProtocolTransport(buf)
|
||||
transport := thrift.NewTBinaryProtocolConf(buf, nil)
|
||||
|
||||
if err = transport.WriteListBegin(thrift.STRUCT, len(spans)); err != nil {
|
||||
if err = transport.WriteListBegin(context.Background(), thrift.STRUCT, len(spans)); err != nil {
|
||||
return nil, fmt.Errorf("error in beginning thrift write: %v", err)
|
||||
}
|
||||
|
||||
for _, span := range zspans {
|
||||
err = span.Write(transport)
|
||||
err = span.Write(context.Background(), transport)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error converting zipkin struct to thrift: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err = transport.WriteListEnd(); err != nil {
|
||||
if err = transport.WriteListEnd(context.Background()); err != nil {
|
||||
return nil, fmt.Errorf("error finishing thrift write: %v", err)
|
||||
}
|
||||
|
||||
|
|
@ -127,8 +128,8 @@ func thriftToJSONSpans(thriftData []byte) ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
transport := thrift.NewTBinaryProtocolTransport(buffer)
|
||||
_, size, err := transport.ReadListBegin()
|
||||
transport := thrift.NewTBinaryProtocolConf(buffer, nil)
|
||||
_, size, err := transport.ReadListBegin(context.Background())
|
||||
if err != nil {
|
||||
err = fmt.Errorf("error in ReadListBegin: %v", err)
|
||||
return nil, err
|
||||
|
|
@ -137,14 +138,14 @@ func thriftToJSONSpans(thriftData []byte) ([]byte, error) {
|
|||
var spans []*zipkincore.Span
|
||||
for i := 0; i < size; i++ {
|
||||
zs := &zipkincore.Span{}
|
||||
if err = zs.Read(transport); err != nil {
|
||||
if err = zs.Read(context.Background(), transport); err != nil {
|
||||
err = fmt.Errorf("Error reading into zipkin struct: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
spans = append(spans, zs)
|
||||
}
|
||||
|
||||
err = transport.ReadListEnd()
|
||||
err = transport.ReadListEnd(context.Background())
|
||||
if err != nil {
|
||||
err = fmt.Errorf("error ending thrift read: %v", err)
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package codec
|
|||
import (
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/codec/thrift/gen-go/zipkincore"
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/trace"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
//now is a mockable time for now
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/codec"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/codec/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
// JSON decodes spans from bodies `POST`ed to the spans endpoint
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
// Code generated by Thrift Compiler (0.14.2). DO NOT EDIT.
|
||||
|
||||
package zipkincore
|
||||
|
||||
var GoUnusedProtection__ int
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
// Code generated by Thrift Compiler (0.14.2). DO NOT EDIT.
|
||||
|
||||
package zipkincore
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"time"
|
||||
)
|
||||
|
||||
// (needed to ensure safety because of naive import list construction.)
|
||||
var _ = thrift.ZERO
|
||||
var _ = fmt.Printf
|
||||
var _ = context.Background
|
||||
var _ = time.Now
|
||||
var _ = bytes.Equal
|
||||
|
||||
const CLIENT_SEND = "cs"
|
||||
const CLIENT_RECV = "cr"
|
||||
const SERVER_SEND = "ss"
|
||||
const SERVER_RECV = "sr"
|
||||
const MESSAGE_SEND = "ms"
|
||||
const MESSAGE_RECV = "mr"
|
||||
const WIRE_SEND = "ws"
|
||||
const WIRE_RECV = "wr"
|
||||
const CLIENT_SEND_FRAGMENT = "csf"
|
||||
const CLIENT_RECV_FRAGMENT = "crf"
|
||||
const SERVER_SEND_FRAGMENT = "ssf"
|
||||
const SERVER_RECV_FRAGMENT = "srf"
|
||||
const HTTP_HOST = "http.host"
|
||||
const HTTP_METHOD = "http.method"
|
||||
const HTTP_PATH = "http.path"
|
||||
const HTTP_ROUTE = "http.route"
|
||||
const HTTP_URL = "http.url"
|
||||
const HTTP_STATUS_CODE = "http.status_code"
|
||||
const HTTP_REQUEST_SIZE = "http.request.size"
|
||||
const HTTP_RESPONSE_SIZE = "http.response.size"
|
||||
const LOCAL_COMPONENT = "lc"
|
||||
const ERROR = "error"
|
||||
const CLIENT_ADDR = "ca"
|
||||
const SERVER_ADDR = "sa"
|
||||
const MESSAGE_ADDR = "ma"
|
||||
|
||||
func init() {
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,16 +1,16 @@
|
|||
package thrift
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/codec"
|
||||
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/codec"
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/codec/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
// UnmarshalThrift converts raw bytes in thrift format to a slice of spans
|
||||
|
|
@ -20,8 +20,8 @@ func UnmarshalThrift(body []byte) ([]*zipkincore.Span, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
transport := thrift.NewTBinaryProtocolTransport(buffer)
|
||||
_, size, err := transport.ReadListBegin()
|
||||
transport := thrift.NewTBinaryProtocolConf(buffer, nil)
|
||||
_, size, err := transport.ReadListBegin(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -29,13 +29,13 @@ func UnmarshalThrift(body []byte) ([]*zipkincore.Span, error) {
|
|||
spans := make([]*zipkincore.Span, size)
|
||||
for i := 0; i < size; i++ {
|
||||
zs := &zipkincore.Span{}
|
||||
if err = zs.Read(transport); err != nil {
|
||||
if err = zs.Read(context.Background(), transport); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
spans[i] = zs
|
||||
}
|
||||
|
||||
if err = transport.ReadListEnd(); err != nil {
|
||||
if err = transport.ReadListEnd(context.Background()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return spans, nil
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore"
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/codec/thrift/gen-go/zipkincore"
|
||||
)
|
||||
|
||||
func Test_endpointHost(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue