You've already forked opentelemetry-go
							
							
				mirror of
				https://github.com/open-telemetry/opentelemetry-go.git
				synced 2025-10-31 00:07:40 +02:00 
			
		
		
		
	Remove the otlp trace exporter limit of SpanEvents when exporting (#2616)
* remove the limit of SpanEvents when exporting * fix changelog * Update exporters/otlp/otlptrace/internal/tracetransform/span.go Co-authored-by: Sam Xie <xsambundy@gmail.com> * Update exporters/otlp/otlptrace/internal/tracetransform/span.go Co-authored-by: Sam Xie <xsambundy@gmail.com> * Update exporters/otlp/otlptrace/internal/tracetransform/span.go Co-authored-by: Sam Xie <xsambundy@gmail.com> * Update CHANGELOG.md Co-authored-by: Sam Xie <xsambundy@gmail.com> * fix unused param * fix changelog * Update CHANGELOG.md Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> * fix unittest * fix code format Co-authored-by: Sam Xie <xsambundy@gmail.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
		| @@ -22,6 +22,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm | ||||
|  | ||||
| - Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) | ||||
|  | ||||
| ### Fixed | ||||
|  | ||||
| - Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) | ||||
|  | ||||
| ## [1.4.1] - 2022-02-16 | ||||
|  | ||||
| ### Fixed | ||||
|   | ||||
| @@ -23,10 +23,6 @@ import ( | ||||
| 	tracepb "go.opentelemetry.io/proto/otlp/trace/v1" | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| 	maxEventsPerSpan = 128 | ||||
| ) | ||||
|  | ||||
| // Spans transforms a slice of OpenTelemetry spans into a slice of OTLP | ||||
| // ResourceSpans. | ||||
| func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { | ||||
| @@ -177,14 +173,9 @@ func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	evCount := len(es) | ||||
| 	if evCount > maxEventsPerSpan { | ||||
| 		evCount = maxEventsPerSpan | ||||
| 	} | ||||
| 	events := make([]*tracepb.Span_Event, evCount) | ||||
|  | ||||
| 	events := make([]*tracepb.Span_Event, len(es)) | ||||
| 	// Transform message events | ||||
| 	for i := 0; i < evCount; i++ { | ||||
| 	for i := 0; i < len(es); i++ { | ||||
| 		events[i] = &tracepb.Span_Event{ | ||||
| 			Name:                   es[i].Name, | ||||
| 			TimeUnixNano:           uint64(es[i].Time.UnixNano()), | ||||
| @@ -192,7 +183,6 @@ func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { | ||||
| 			DroppedAttributesCount: uint32(es[i].DroppedAttributeCount), | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return events | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -15,7 +15,6 @@ | ||||
| package tracetransform | ||||
|  | ||||
| import ( | ||||
| 	"strconv" | ||||
| 	"testing" | ||||
| 	"time" | ||||
|  | ||||
| @@ -102,18 +101,6 @@ func TestSpanEvent(t *testing.T) { | ||||
| 	assert.Equal(t, &tracepb.Span_Event{Name: "test 2", Attributes: KeyValues(attrs), TimeUnixNano: eventTimestamp, DroppedAttributesCount: 2}, got[1]) | ||||
| } | ||||
|  | ||||
| func TestExcessiveSpanEvents(t *testing.T) { | ||||
| 	e := make([]tracesdk.Event, maxEventsPerSpan+1) | ||||
| 	for i := 0; i < maxEventsPerSpan+1; i++ { | ||||
| 		e[i] = tracesdk.Event{Name: strconv.Itoa(i)} | ||||
| 	} | ||||
| 	assert.Len(t, e, maxEventsPerSpan+1) | ||||
| 	got := spanEvents(e) | ||||
| 	assert.Len(t, got, maxEventsPerSpan) | ||||
| 	// Ensure the drop order. | ||||
| 	assert.Equal(t, strconv.Itoa(maxEventsPerSpan-1), got[len(got)-1].Name) | ||||
| } | ||||
|  | ||||
| func TestNilLinks(t *testing.T) { | ||||
| 	assert.Nil(t, links(nil)) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user