Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
Instead, `"go.opentelemetry.io/otel/trace".SpanContextFromContex` can be used to return the current Span.
If needed, that Span's `SpanContext.IsRemote()` can then be used to determine if it is remote or not. (#1731)

### Fixed

- Fixes the typo `testCollectorEnpoint` to `testCollectorEndpoint` and added assertion on `gen.Batch` process. (#TBD)

## [0.19.0] - 2021-03-18

### Added
Expand Down
21 changes: 14 additions & 7 deletions exporters/trace/jaeger/jaeger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,24 +277,24 @@ func TestNewRawExporterShouldFailIfCollectorUnset(t *testing.T) {
assert.Error(t, err)
}

type testCollectorEnpoint struct {
type testCollectorEndpoint struct {
batchesUploaded []*gen.Batch
}

func (c *testCollectorEnpoint) upload(batch *gen.Batch) error {
func (c *testCollectorEndpoint) upload(batch *gen.Batch) error {
c.batchesUploaded = append(c.batchesUploaded, batch)
return nil
}

var _ batchUploader = (*testCollectorEnpoint)(nil)
var _ batchUploader = (*testCollectorEndpoint)(nil)

func withTestCollectorEndpoint() func() (batchUploader, error) {
return func() (batchUploader, error) {
return &testCollectorEnpoint{}, nil
return &testCollectorEndpoint{}, nil
}
}

func withTestCollectorEndpointInjected(ce *testCollectorEnpoint) func() (batchUploader, error) {
func withTestCollectorEndpointInjected(ce *testCollectorEndpoint) func() (batchUploader, error) {
return func() (batchUploader, error) {
return ce, nil
}
Expand Down Expand Up @@ -330,7 +330,7 @@ func TestExporter_ExportSpan(t *testing.T) {
assert.True(t, span.SpanContext().IsValid())

exp.Flush()
tc := exp.uploader.(*testCollectorEnpoint)
tc := exp.uploader.(*testCollectorEndpoint)
assert.True(t, len(tc.batchesUploaded) == 1)
assert.True(t, len(tc.batchesUploaded[0].GetSpans()) == 1)
}
Expand Down Expand Up @@ -903,14 +903,17 @@ func TestNewExporterPipelineWithOptions(t *testing.T) {
const (
serviceName = "test-service"
eventCountLimit = 10
tagKey = "key"
tagVal = "val"
)

testCollector := &testCollectorEnpoint{}
testCollector := &testCollectorEndpoint{}
tp, spanFlush, err := NewExportPipeline(
withTestCollectorEndpointInjected(testCollector),
WithSDKOptions(
sdktrace.WithResource(resource.NewWithAttributes(
semconv.ServiceNameKey.String(serviceName),
attribute.String(tagKey, tagVal),
)),
sdktrace.WithSpanLimits(sdktrace.SpanLimits{
EventCountLimit: eventCountLimit,
Expand All @@ -936,4 +939,8 @@ func TestNewExporterPipelineWithOptions(t *testing.T) {
assert.True(t, len(uploadedBatch.GetSpans()) == 1)
uploadedSpan := uploadedBatch.GetSpans()[0]
assert.Equal(t, eventCountLimit, len(uploadedSpan.GetLogs()))

assert.Equal(t, 1, len(uploadedBatch.GetProcess().GetTags()))
assert.Equal(t, tagKey, uploadedBatch.GetProcess().GetTags()[0].GetKey())
assert.Equal(t, tagVal, uploadedBatch.GetProcess().GetTags()[0].GetVStr())
}