Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump go.opentelemetry.io/collector/semconv from 0.54.1-0.20220705210223-9f0d97ca5741 to 0.82.0 in /receiver/dockerstatsreceiver #5602

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
10 changes: 10 additions & 0 deletions processor/spanmetricsprocessor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,16 @@ func (p *processorImp) aggregateMetricsForServiceSpans(rspans ptrace.ResourceSpa
func (p *processorImp) aggregateMetricsForSpan(serviceName string, span ptrace.Span, resourceAttr pcommon.Map) {
latencyInMilliseconds := float64(span.EndTimestamp()-span.StartTimestamp()) / float64(time.Millisecond.Nanoseconds())

if latencyInMilliseconds > maxDurationMs {
p.logger.Warn("Latency exceeds max of int64",
zap.String("service.name", serviceName),
zap.Uint64("startTimeUnixNano", uint64(span.StartTimestamp().AsTime().UnixNano())),
zap.Uint64("endTimeUnixNano", uint64(span.EndTimestamp().AsTime().UnixNano())),
zap.String("span.kind", span.Kind().String()),
zap.String("operation", span.Name()))
return
}

// Binary search to find the latencyInMilliseconds bucket index.
index := sort.SearchFloat64s(p.latencyBounds, latencyInMilliseconds)

Expand Down
47 changes: 47 additions & 0 deletions processor/spanmetricsprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -842,3 +842,50 @@ func TestProcessorResetExemplarData(t *testing.T) {
assert.NoError(t, err)
assert.Empty(t, p.latencyExemplarsData[key])
}

// ------------------------------------------------------- start of additional block of tests -------------------------------------------------------

func TestTraceLatencyExceedsMaxInt64(t *testing.T) {
mexp := &mocks.MetricsExporter{}
tcon := &mocks.TracesConsumer{}

mexp.On("ConsumeMetrics", mock.Anything, mock.Anything).Return(nil)
tcon.On("ConsumeTraces", mock.Anything, mock.Anything).Return(nil)

defaultNullValue := "defaultNullValue"
p := newProcessorImp(mexp, tcon, &defaultNullValue, cumulative, t)

traces := buildTraceWithHighLatency()

// Test
ctx := metadata.NewIncomingContext(context.Background(), nil)

err := p.ConsumeTraces(ctx, traces)
// Validate
require.NoError(t, err)
}

func buildTraceWithHighLatency() pdata.Traces {
traces := pdata.NewTraces()
rs := traces.ResourceSpans().AppendEmpty()
rs.Resource().Attributes().
InsertString(conventions.AttributeServiceName, "test-service")
ils := rs.InstrumentationLibrarySpans().AppendEmpty()
span := ils.Spans().AppendEmpty()
span.SetName("/test")
span.SetKind(pdata.SpanKindClient)
span.Status().SetCode(pdata.StatusCodeOk)
span.SetStartTimestamp(0)
span.SetEndTimestamp(18446744073709551615)
span.Attributes().InsertString(stringAttrName, "stringAttrValue")
span.Attributes().InsertInt(intAttrName, 99)
span.Attributes().InsertDouble(doubleAttrName, 99.99)
span.Attributes().InsertBool(boolAttrName, true)
span.Attributes().InsertNull(nullAttrName)
span.Attributes().Insert(mapAttrName, pdata.NewAttributeValueMap())
span.Attributes().Insert(arrayAttrName, pdata.NewAttributeValueArray())
span.SetTraceID(pdata.NewTraceID([16]byte{byte(42)}))
return traces
}

// ------------------------------------------------------- end of additional block of tests -------------------------------------------------------
7 changes: 3 additions & 4 deletions receiver/dockerstatsreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ require (
github.com/docker/docker v20.10.17+incompatible
github.com/open-telemetry/opentelemetry-collector-contrib/internal/containertest v0.54.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/docker v0.54.0
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector v0.54.1-0.20220705210223-9f0d97ca5741
go.opentelemetry.io/collector/pdata v0.54.1-0.20220705210223-9f0d97ca5741
go.opentelemetry.io/collector/semconv v0.54.1-0.20220705210223-9f0d97ca5741
go.opentelemetry.io/collector/semconv v0.82.0
go.uber.org/multierr v1.8.0
go.uber.org/zap v1.21.0
)
Expand All @@ -29,7 +29,7 @@ require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/knadh/koanf v1.4.2 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
Expand All @@ -52,7 +52,6 @@ require (
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
Loading
Loading