(t *testing.T)
| 955 | } |
| 956 | |
| 957 | func TestProcessAttributes(t *testing.T) { |
| 958 | spanCount := 10 |
| 959 | batchCount := 3 |
| 960 | trace := test.MakeTraceWithSpanCount(batchCount, spanCount, []byte{0x0A, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}) |
| 961 | |
| 962 | maxAttrByte := 1000 |
| 963 | longString := strings.Repeat("t", 1100) |
| 964 | |
| 965 | // add long attributes to the resource level |
| 966 | trace.ResourceSpans[0].Resource.Attributes = append(trace.ResourceSpans[0].Resource.Attributes, |
| 967 | test.MakeAttribute("long value", longString), |
| 968 | ) |
| 969 | trace.ResourceSpans[0].Resource.Attributes = append(trace.ResourceSpans[0].Resource.Attributes, |
| 970 | test.MakeAttribute(longString, "long key"), |
| 971 | ) |
| 972 | |
| 973 | // add long attributes to the span level |
| 974 | trace.ResourceSpans[0].ScopeSpans[0].Spans[0].Attributes = append(trace.ResourceSpans[0].ScopeSpans[0].Spans[0].Attributes, |
| 975 | test.MakeAttribute("long value", longString), |
| 976 | ) |
| 977 | trace.ResourceSpans[0].ScopeSpans[0].Spans[0].Attributes = append(trace.ResourceSpans[0].ScopeSpans[0].Spans[0].Attributes, |
| 978 | test.MakeAttribute(longString, "long key"), |
| 979 | ) |
| 980 | |
| 981 | // add long attributes to the event level |
| 982 | trace.ResourceSpans[0].ScopeSpans[0].Spans[0].Events = append(trace.ResourceSpans[0].ScopeSpans[0].Spans[0].Events, |
| 983 | &v1.Span_Event{ |
| 984 | TimeUnixNano: 0, |
| 985 | Attributes: []*v1_common.KeyValue{ |
| 986 | test.MakeAttribute("long value", longString), |
| 987 | test.MakeAttribute(longString, "long key"), |
| 988 | }, |
| 989 | }, |
| 990 | ) |
| 991 | |
| 992 | // add long attributes to the link level |
| 993 | trace.ResourceSpans[0].ScopeSpans[0].Spans[0].Links = append(trace.ResourceSpans[0].ScopeSpans[0].Spans[0].Links, |
| 994 | &v1.Span_Link{ |
| 995 | TraceId: []byte{0x0A, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, |
| 996 | SpanId: []byte{0x0A, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, |
| 997 | Attributes: []*v1_common.KeyValue{ |
| 998 | test.MakeAttribute("long value", longString), |
| 999 | test.MakeAttribute(longString, "long key"), |
| 1000 | }, |
| 1001 | }, |
| 1002 | ) |
| 1003 | |
| 1004 | // add long attributes to scope level |
| 1005 | trace.ResourceSpans[0].ScopeSpans[0].Scope = &v1_common.InstrumentationScope{ |
| 1006 | Name: "scope scope", |
| 1007 | Version: "1.0", |
| 1008 | Attributes: []*v1_common.KeyValue{ |
| 1009 | test.MakeAttribute("long value", longString), |
| 1010 | test.MakeAttribute(longString, "long key"), |
| 1011 | }, |
| 1012 | } |
| 1013 | |
| 1014 | _, rebatchedTrace, truncatedCount, _, _ := requestsByTraceID(trace.ResourceSpans, "test", spanCount*batchCount, maxAttrByte) |
nothing calls this directly
no test coverage detected