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

Custom Attributes on Annotations are dropped #11

@sargun

Description

@sargun

Please answer these questions before submitting a bug report.

What version of the Exporter are you using?

v0.1.1

What version of OpenCensus are you using?

N/A

What version of Go are you using?

1.12

What did you do?

If possible, provide a recipe for reproducing the error.

package main

import (
	"contrib.go.opencensus.io/exporter/zipkin"
	"encoding/json"
	"fmt"
	openzipkin "github.com/openzipkin/zipkin-go"
	"github.com/openzipkin/zipkin-go/model"
	"github.com/pkg/errors"
	"go.opencensus.io/trace"
)

const data = `
{"TraceID":[23,48,151,88,7,209,158,104,49,218,184,62,143,65,233,81],"SpanID":[35,104,45,31,172,237,90,193],"TraceOptions":1,"Tracestate":null,"ParentSpanID":[238,234,134,4,39,144,219,48],"SpanKind":0,"Name":"GC","StartTime":"2019-06-26T09:14:43.32114626Z","EndTime":"2019-06-26T09:14:43.4255574Z","Attributes":{"instance":"i-dwadaw"},"Annotations":[{"Time":"2019-06-26T09:14:43.32116275Z","Message":"Performing GC on Interface","Attributes":{"deviceIdx":11,"instance":"i-dwadaw"}}],"MessageEvents":null,"Code":0,"Message":"","Links":null,"HasRemoteParent":false,"DroppedAttributeCount":0,"DroppedAnnotationCount":0,"DroppedMessageEventCount":0,"DroppedLinkCount":0,"ChildSpanCount":2}
`

type fakeReporter struct {

}

func (fakeReporter) Send(m model.SpanModel) {
	fmt.Printf("%+v\n", m)
}

func (fakeReporter) Close() error {
	panic("implement me")
}

func main() {
	var spanData trace.SpanData
	err := json.Unmarshal([]byte(data), &spanData)
	if err != nil {
		panic(err)

	}

	fmt.Printf("Input Data: %+v\n", spanData)
	endpoint, err := openzipkin.NewEndpoint("titus-vpc-service", "localhost")
	if err != nil {
		panic( errors.Wrap(err, "Failed to create the local zipkinEndpoint"))
	}

	exporter := zipkin.NewExporter(&fakeReporter{}, endpoint)
	if err != nil {
		panic(err)
	}
	exporter.ExportSpan(&spanData)

}

What did you expect to see?

Input data to printed, with attributes, and those attributes to show up in the spandata that gets sent to the zipkin HTTP reporter.

What did you see instead?

Input Data: {SpanContext:{TraceID:1730975807d19e6831dab83e8f41e951 SpanID:23682d1faced5ac1 TraceOptions:1 Tracestate:<nil>} ParentSpanID:eeea86042790db30 SpanKind:0 Name:GC StartTime:2019-06-26 09:14:43.32114626 +0000 UTC EndTime:2019-06-26 09:14:43.4255574 +0000 UTC Attributes:map[instance:i-0eaf7266fd2e06c60] Annotations:[{Time:2019-06-26 09:14:43.32116275 +0000 UTC Message:Performing GC on Interface Attributes:map[deviceIdx:11 instance:i-0eaf7266fd2e06c60]}] MessageEvents:[] Status:{Code:0 Message:} Links:[] HasRemoteParent:false DroppedAttributeCount:0 DroppedAnnotationCount:0 DroppedMessageEventCount:0 DroppedLinkCount:0 ChildSpanCount:2}
{SpanContext:{TraceID:1730975807d19e6831dab83e8f41e951 ID:23682d1faced5ac1 ParentID:eeea86042790db30 Debug:false Sampled:0x12af280 Err:<nil>} Name:GC Kind: Timestamp:2019-06-26 09:14:43.32114626 +0000 UTC Duration:104.41114ms Shared:false LocalEndpoint:0xc00022e000 RemoteEndpoint:<nil> Annotations:[{Timestamp:2019-06-26 09:14:43.32116275 +0000 UTC Value:Performing GC on Interface}] Tags:map[instance:i-0eaf7266fd2e06c60]}

Additional context

The custom annotations attributes "deviceIdx", and "instance" are getting dropped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions