Skip to content

Commit

Permalink
update to proto v0.3.0 (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
rghetia authored Mar 24, 2020
1 parent a485d0e commit 6f881b4
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 74 deletions.
4 changes: 2 additions & 2 deletions exporters/otlp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ replace go.opentelemetry.io/otel => ../..
require (
github.com/golang/protobuf v1.3.4
github.com/google/go-cmp v0.4.0
github.com/open-telemetry/opentelemetry-proto v0.0.0-20200313210948-2e3afbfffa38
github.com/grpc-ecosystem/grpc-gateway v1.14.3 // indirect
github.com/open-telemetry/opentelemetry-proto v0.3.0
github.com/stretchr/testify v1.4.0
go.opentelemetry.io/otel v0.3.0
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/grpc v1.27.1
)
Expand Down
16 changes: 12 additions & 4 deletions exporters/otlp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7 h1:qELHH0AWCvf98Yf+CNIJx9vOZOfHFDDzgDRYsnNk/vs=
github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7/go.mod h1:Q5DbzQ+3AkgGwymQO7aZFNP7ns2lZKGtvRBzRXfdi60=
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
github.com/benbjohnson/clock v1.0.0 h1:78Jk/r6m4wCi6sndMpty7A//t4dw/RW5fV4ZgDVfX1w=
github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=
Expand All @@ -12,6 +13,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
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=
Expand All @@ -27,17 +29,20 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/grpc-ecosystem/grpc-gateway v1.14.3 h1:OCJlWkOUoTnl0neNGlf4fUm3TmbEtguw7vR+nGtnDjY=
github.com/grpc-ecosystem/grpc-gateway v1.14.3/go.mod h1:6CwZWGDSPRJidgKAtJVvND6soZe6fT7iteq8wDPdhb0=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/open-telemetry/opentelemetry-proto v0.0.0-20200313210948-2e3afbfffa38 h1:oZ81PzQp61MRZ7acgKZIbJlyzcCSUSQGvK+d8mgZuf0=
github.com/open-telemetry/opentelemetry-proto v0.0.0-20200313210948-2e3afbfffa38/go.mod h1:PMR5GI0F7BSpio+rBGFxNm6SLzg3FypDTcFuQZnO+F8=
github.com/open-telemetry/opentelemetry-proto v0.3.0 h1:+ASAtcayvoELyCF40+rdCMlBOhZIn5TPDez85zSYc30=
github.com/open-telemetry/opentelemetry-proto v0.3.0/go.mod h1:PMR5GI0F7BSpio+rBGFxNm6SLzg3FypDTcFuQZnO+F8=
github.com/opentracing/opentracing-go v1.1.1-0.20190913142402-a7454ce5950e/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
Expand All @@ -51,8 +56,8 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191002035440-2ec189313ef0 h1:2mqDk8w/o6UmeUCu5Qiq2y7iMf6anbx+YA8d1JFoFrs=
golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -78,16 +83,19 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03 h1:4HYDjxeNXAOTv3o1N2tjo8UUSlhQgAD52FVkwxnWgM8=
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
21 changes: 18 additions & 3 deletions exporters/otlp/mock_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (mts *mockTraceService) getSpans() []*tracepb.Span {
defer mts.mu.RUnlock()
spans := []*tracepb.Span{}
for _, rs := range mts.rsm {
spans = append(spans, rs.Spans...)
spans = append(spans, rs.InstrumentationLibrarySpans[0].Spans...)
}
return spans
}
Expand All @@ -77,8 +77,20 @@ func (mts *mockTraceService) Export(ctx context.Context, exp *coltracepb.ExportT
existingRs, ok := mts.rsm[rstr]
if !ok {
mts.rsm[rstr] = rs
// TODO (rghetia): Add support for library Info.
if len(rs.InstrumentationLibrarySpans) == 0 {
rs.InstrumentationLibrarySpans = []*tracepb.InstrumentationLibrarySpans{
{
Spans: []*tracepb.Span{},
},
}
}
} else {
existingRs.Spans = append(existingRs.Spans, rs.GetSpans()...)
if len(rs.InstrumentationLibrarySpans) > 0 {
existingRs.InstrumentationLibrarySpans[0].Spans =
append(existingRs.InstrumentationLibrarySpans[0].Spans,
rs.InstrumentationLibrarySpans[0].GetSpans()...)
}
}
}
return &coltracepb.ExportTraceServiceResponse{}, nil
Expand Down Expand Up @@ -117,7 +129,10 @@ func (mms *mockMetricService) getMetrics() []*metricpb.Metric {
func (mms *mockMetricService) Export(ctx context.Context, exp *colmetricpb.ExportMetricsServiceRequest) (*colmetricpb.ExportMetricsServiceResponse, error) {
mms.mu.Lock()
for _, rm := range exp.GetResourceMetrics() {
mms.metrics = append(mms.metrics, rm.Metrics...)
// TODO (rghetia) handle multiple resource and library info.
if len(rm.InstrumentationLibraryMetrics) > 0 {
mms.metrics = append(mms.metrics, rm.InstrumentationLibraryMetrics[0].Metrics...)
}
}
mms.mu.Unlock()
return &colmetricpb.ExportMetricsServiceResponse{}, nil
Expand Down
15 changes: 12 additions & 3 deletions exporters/otlp/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,11 @@ func (e *Exporter) uploadMetrics(ctx context.Context, in <-chan *metricpb.Metric
rm := []*metricpb.ResourceMetrics{
{
Resource: nil,
Metrics: protoMetrics,
InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{
{
Metrics: protoMetrics,
},
},
},
}

Expand Down Expand Up @@ -357,11 +361,16 @@ func otSpanDataToPbSpans(sdl []*tracesdk.SpanData) []*tracepb.ResourceSpans {
if !ok {
rs = &tracepb.ResourceSpans{
Resource: otResourceToProtoResource(sd.Resource),
Spans: []*tracepb.Span{},
InstrumentationLibrarySpans: []*tracepb.InstrumentationLibrarySpans{
{
Spans: []*tracepb.Span{},
},
},
}
rsm[sd.Resource] = rs
}
rs.Spans = append(rs.Spans, otSpanToProtoSpan(sd))
rs.InstrumentationLibrarySpans[0].Spans =
append(rs.InstrumentationLibrarySpans[0].Spans, otSpanToProtoSpan(sd))
}
}
rss := make([]*tracepb.ResourceSpans, 0, len(rsm))
Expand Down
7 changes: 5 additions & 2 deletions exporters/otlp/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,14 @@ func newExporterEndToEndTest(t *testing.T, additionalOpts []otlp.ExporterOption)

// Now verify spans and attributes for each resource span.
for _, rs := range rss {
if got, want := len(rs.Spans), m; got != want {
if len(rs.InstrumentationLibrarySpans) == 0 {
t.Fatalf("zero Instrumentation Library Spans")
}
if got, want := len(rs.InstrumentationLibrarySpans[0].Spans), m; got != want {
t.Fatalf("span counts: got %d, want %d", got, want)
}
attrMap := map[int64]bool{}
for _, s := range rs.Spans {
for _, s := range rs.InstrumentationLibrarySpans[0].Spans {
if gotName, want := s.Name, "AlwaysSample"; gotName != want {
t.Fatalf("span name: got %s, want %s", gotName, want)
}
Expand Down
6 changes: 3 additions & 3 deletions exporters/otlp/transform_spans.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func otSpanToProtoSpan(sd *export.SpanData) *tracepb.Span {
SpanId: sd.SpanContext.SpanID[:],
ParentSpanId: sd.ParentSpanID[:],
Status: otStatusToProtoStatus(sd.StatusCode, sd.StatusMessage),
StartTimeUnixnano: uint64(sd.StartTime.Nanosecond()),
EndTimeUnixnano: uint64(sd.EndTime.Nanosecond()),
StartTimeUnixNano: uint64(sd.StartTime.Nanosecond()),
EndTimeUnixNano: uint64(sd.EndTime.Nanosecond()),
Links: otLinksToProtoLinks(sd.Links),
Kind: otSpanKindToProtoSpanKind(sd.SpanKind),
Name: sd.Name,
Expand Down Expand Up @@ -155,7 +155,7 @@ func otTimeEventsToProtoTimeEvents(es []export.Event) []*tracepb.Span_Event {
messageEvents++
events = append(events,
&tracepb.Span_Event{
TimeUnixnano: uint64(e.Time.Nanosecond()),
TimeUnixNano: uint64(e.Time.Nanosecond()),
Attributes: otAttributesToProtoAttributes(e.Attributes),
// TODO (rghetia) : Add Drop Counts when supported.
},
Expand Down
126 changes: 69 additions & 57 deletions exporters/otlp/transform_spans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,75 +108,79 @@ func TestOtSpanToOtlpSpan_Basic(t *testing.T) {
},
},
otlpResSpan: &tracepb.ResourceSpans{
Spans: []*tracepb.Span{
InstrumentationLibrarySpans: []*tracepb.InstrumentationLibrarySpans{
{
TraceId: []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F},
SpanId: []byte{0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8},
ParentSpanId: []byte{0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8},
Name: "End-To-End Here",
Kind: tracepb.Span_SERVER,
StartTimeUnixnano: uint64(startTime.Nanosecond()),
EndTimeUnixnano: uint64(endTime.Nanosecond()),
Status: &tracepb.Status{
Code: 13,
Message: "utterly unrecognized",
},
Events: []*tracepb.Span_Event{
Spans: []*tracepb.Span{
{
TimeUnixnano: uint64(startTime.Nanosecond()),
Attributes: []*commonpb.AttributeKeyValue{
TraceId: []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F},
SpanId: []byte{0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8},
ParentSpanId: []byte{0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8},
Name: "End-To-End Here",
Kind: tracepb.Span_SERVER,
StartTimeUnixNano: uint64(startTime.Nanosecond()),
EndTimeUnixNano: uint64(endTime.Nanosecond()),
Status: &tracepb.Status{
Code: 13,
Message: "utterly unrecognized",
},
Events: []*tracepb.Span_Event{
{
Key: "CompressedByteSize",
Type: commonpb.AttributeKeyValue_INT,
IntValue: 512,
TimeUnixNano: uint64(startTime.Nanosecond()),
Attributes: []*commonpb.AttributeKeyValue{
{
Key: "CompressedByteSize",
Type: commonpb.AttributeKeyValue_INT,
IntValue: 512,
},
},
},
},
},
{
TimeUnixnano: uint64(endTime.Nanosecond()),
Attributes: []*commonpb.AttributeKeyValue{
{
Key: "MessageEventType",
Type: commonpb.AttributeKeyValue_STRING,
StringValue: "Recv",
TimeUnixNano: uint64(endTime.Nanosecond()),
Attributes: []*commonpb.AttributeKeyValue{
{
Key: "MessageEventType",
Type: commonpb.AttributeKeyValue_STRING,
StringValue: "Recv",
},
},
},
},
},
},
Links: []*tracepb.Span_Link{
{
TraceId: []byte{0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF},
SpanId: []byte{0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7},
Attributes: []*commonpb.AttributeKeyValue{
Links: []*tracepb.Span_Link{
{
TraceId: []byte{0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF},
SpanId: []byte{0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7},
Attributes: []*commonpb.AttributeKeyValue{
{
Key: "LinkType",
Type: commonpb.AttributeKeyValue_STRING,
StringValue: "Parent",
},
},
},
{
Key: "LinkType",
Type: commonpb.AttributeKeyValue_STRING,
StringValue: "Parent",
TraceId: []byte{0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF},
SpanId: []byte{0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7},
Attributes: []*commonpb.AttributeKeyValue{
{
Key: "LinkType",
Type: commonpb.AttributeKeyValue_STRING,
StringValue: "Child",
},
},
},
},
},
{
TraceId: []byte{0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF},
SpanId: []byte{0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7},
Attributes: []*commonpb.AttributeKeyValue{
{
Key: "LinkType",
Type: commonpb.AttributeKeyValue_STRING,
StringValue: "Child",
Key: "timeout_ns",
Type: commonpb.AttributeKeyValue_INT,
IntValue: 12e9,
},
},
DroppedAttributesCount: 1,
DroppedEventsCount: 2,
DroppedLinksCount: 3,
},
},
Attributes: []*commonpb.AttributeKeyValue{
{
Key: "timeout_ns",
Type: commonpb.AttributeKeyValue_INT,
IntValue: 12e9,
},
},
DroppedAttributesCount: 1,
DroppedEventsCount: 2,
DroppedLinksCount: 3,
},
},
Resource: &resourcepb.Resource{
Expand Down Expand Up @@ -244,7 +248,11 @@ func TestOtSpanToOtlpSpan_SpanKind(t *testing.T) {
otSpan: otSpans,
otlpResSpan: &tracepb.ResourceSpans{
Resource: nil,
Spans: otlpSpans,
InstrumentationLibrarySpans: []*tracepb.InstrumentationLibrarySpans{
{
Spans: otlpSpans,
},
},
},
}
return tc
Expand Down Expand Up @@ -342,7 +350,11 @@ func TestOtSpanToOtlpSpan_Attribute(t *testing.T) {
otSpan: otSpans,
otlpResSpan: &tracepb.ResourceSpans{
Resource: nil,
Spans: otlpSpans,
InstrumentationLibrarySpans: []*tracepb.InstrumentationLibrarySpans{
{
Spans: otlpSpans,
},
},
},
}
return tc
Expand Down Expand Up @@ -370,8 +382,8 @@ func getSpan() (*export.SpanData, *tracepb.Span) {
ParentSpanId: []byte{0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8},
Name: "Test Span",
Kind: tracepb.Span_SERVER,
StartTimeUnixnano: uint64(startTime.Nanosecond()),
EndTimeUnixnano: uint64(endTime.Nanosecond()),
StartTimeUnixNano: uint64(startTime.Nanosecond()),
EndTimeUnixNano: uint64(endTime.Nanosecond()),
Status: &tracepb.Status{
Code: 0,
},
Expand Down

0 comments on commit 6f881b4

Please sign in to comment.