diff --git a/internal/pkg/instrumentation/bpf/database/sql/probe.go b/internal/pkg/instrumentation/bpf/database/sql/probe.go index 03a45f9b5..313507b77 100644 --- a/internal/pkg/instrumentation/bpf/database/sql/probe.go +++ b/internal/pkg/instrumentation/bpf/database/sql/probe.go @@ -15,6 +15,7 @@ import ( "go.opentelemetry.io/auto/internal/pkg/instrumentation/context" "go.opentelemetry.io/auto/internal/pkg/instrumentation/probe" + "go.opentelemetry.io/auto/internal/pkg/instrumentation/utils" ) //go:generate go run github.com/cilium/ebpf/cmd/bpf2go -target amd64,arm64 -cc clang -cflags $CFLAGS bpf ./bpf/probe.bpf.c @@ -96,8 +97,8 @@ func convertEvent(e *event) []*probe.SpanEvent { return []*probe.SpanEvent{ { SpanName: "DB", - StartTime: int64(e.StartTime), - EndTime: int64(e.EndTime), + StartTime: utils.BootRelativeTime(e.StartTime), + EndTime: utils.BootRelativeTime(e.EndTime), SpanContext: &sc, Attributes: []attribute.KeyValue{ semconv.DBQueryText(query), diff --git a/internal/pkg/instrumentation/bpf/database/sql/probe_test.go b/internal/pkg/instrumentation/bpf/database/sql/probe_test.go index 57a2cdb98..076f2f239 100644 --- a/internal/pkg/instrumentation/bpf/database/sql/probe_test.go +++ b/internal/pkg/instrumentation/bpf/database/sql/probe_test.go @@ -41,8 +41,8 @@ func TestProbeConvertEvent(t *testing.T) { }) want := &probe.SpanEvent{ SpanName: "DB", - StartTime: int64(start.UnixNano()), - EndTime: int64(end.UnixNano()), + StartTime: start, + EndTime: end, SpanContext: &sc, Attributes: []attribute.KeyValue{ semconv.DBQueryText("SELECT * FROM foo"), diff --git a/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/consumer/probe.go b/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/consumer/probe.go index 980e7509b..4d7a7bb8e 100644 --- a/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/consumer/probe.go +++ b/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/consumer/probe.go @@ -15,6 +15,7 @@ import ( "go.opentelemetry.io/auto/internal/pkg/instrumentation/context" "go.opentelemetry.io/auto/internal/pkg/instrumentation/probe" + "go.opentelemetry.io/auto/internal/pkg/instrumentation/utils" "go.opentelemetry.io/auto/internal/pkg/structfield" ) @@ -122,8 +123,8 @@ func convertEvent(e *event) []*probe.SpanEvent { return []*probe.SpanEvent{ { SpanName: kafkaConsumerSpanName(topic), - StartTime: int64(e.StartTime), - EndTime: int64(e.EndTime), + StartTime: utils.BootRelativeTime(e.StartTime), + EndTime: utils.BootRelativeTime(e.EndTime), SpanContext: &sc, ParentSpanContext: pscPtr, Attributes: attributes, diff --git a/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/consumer/probe_test.go b/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/consumer/probe_test.go index 30f5d4cfc..497d0e15b 100644 --- a/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/consumer/probe_test.go +++ b/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/consumer/probe_test.go @@ -47,8 +47,8 @@ func TestProbeConvertEvent(t *testing.T) { }) want := &probe.SpanEvent{ SpanName: kafkaConsumerSpanName("topic1"), - StartTime: int64(start.UnixNano()), - EndTime: int64(end.UnixNano()), + StartTime: start, + EndTime: end, SpanContext: &sc, Attributes: []attribute.KeyValue{ semconv.MessagingSystemKafka, diff --git a/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/producer/probe.go b/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/producer/probe.go index 863eed88a..1a89598de 100644 --- a/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/producer/probe.go +++ b/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/producer/probe.go @@ -14,6 +14,7 @@ import ( "go.opentelemetry.io/auto/internal/pkg/instrumentation/context" "go.opentelemetry.io/auto/internal/pkg/instrumentation/probe" + "go.opentelemetry.io/auto/internal/pkg/instrumentation/utils" "go.opentelemetry.io/auto/internal/pkg/structfield" ) @@ -138,8 +139,8 @@ func convertEvent(e *event) []*probe.SpanEvent { res = append(res, &probe.SpanEvent{ SpanName: kafkaProducerSpanName(msgTopic), - StartTime: int64(e.StartTime), - EndTime: int64(e.EndTime), + StartTime: utils.BootRelativeTime(e.StartTime), + EndTime: utils.BootRelativeTime(e.EndTime), SpanContext: &sc, Attributes: msgAttrs, ParentSpanContext: pscPtr, diff --git a/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/producer/probe_test.go b/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/producer/probe_test.go index 45d1623cc..6e37e3dfb 100644 --- a/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/producer/probe_test.go +++ b/internal/pkg/instrumentation/bpf/github.com/segmentio/kafka-go/producer/probe_test.go @@ -63,8 +63,8 @@ func TestProbeConvertEvent(t *testing.T) { }) want1 := &probe.SpanEvent{ SpanName: kafkaProducerSpanName("topic1"), - StartTime: int64(start.UnixNano()), - EndTime: int64(end.UnixNano()), + StartTime: start, + EndTime: end, SpanContext: &sc1, Attributes: []attribute.KeyValue{ semconv.MessagingKafkaMessageKey("key1"), @@ -78,8 +78,8 @@ func TestProbeConvertEvent(t *testing.T) { want2 := &probe.SpanEvent{ SpanName: kafkaProducerSpanName("topic2"), - StartTime: int64(start.UnixNano()), - EndTime: int64(end.UnixNano()), + StartTime: start, + EndTime: end, SpanContext: &sc2, Attributes: []attribute.KeyValue{ semconv.MessagingKafkaMessageKey("key2"), diff --git a/internal/pkg/instrumentation/bpf/go.opentelemetry.io/otel/traceglobal/probe.go b/internal/pkg/instrumentation/bpf/go.opentelemetry.io/otel/traceglobal/probe.go index 4bbed87bc..4ab997b3e 100644 --- a/internal/pkg/instrumentation/bpf/go.opentelemetry.io/otel/traceglobal/probe.go +++ b/internal/pkg/instrumentation/bpf/go.opentelemetry.io/otel/traceglobal/probe.go @@ -10,6 +10,7 @@ import ( "go.opentelemetry.io/auto/internal/pkg/inject" "go.opentelemetry.io/auto/internal/pkg/instrumentation/probe" + "go.opentelemetry.io/auto/internal/pkg/instrumentation/utils" "go.opentelemetry.io/auto/internal/pkg/process" "go.opentelemetry.io/auto/internal/pkg/structfield" @@ -207,8 +208,8 @@ func convertEvent(e *event) []*probe.SpanEvent { return []*probe.SpanEvent{ { SpanName: spanName, - StartTime: int64(e.StartTime), - EndTime: int64(e.EndTime), + StartTime: utils.BootRelativeTime(e.StartTime), + EndTime: utils.BootRelativeTime(e.EndTime), Attributes: convertAttributes(e.Attributes), SpanContext: &sc, ParentSpanContext: pscPtr, diff --git a/internal/pkg/instrumentation/bpf/go.opentelemetry.io/otel/traceglobal/probe_test.go b/internal/pkg/instrumentation/bpf/go.opentelemetry.io/otel/traceglobal/probe_test.go index a6be025c2..57210087c 100644 --- a/internal/pkg/instrumentation/bpf/go.opentelemetry.io/otel/traceglobal/probe_test.go +++ b/internal/pkg/instrumentation/bpf/go.opentelemetry.io/otel/traceglobal/probe_test.go @@ -104,8 +104,8 @@ func TestProbeConvertEvent(t *testing.T) { }) want := &probe.SpanEvent{ SpanName: "Foo", - StartTime: int64(start.UnixNano()), - EndTime: int64(end.UnixNano()), + StartTime: start, + EndTime: end, SpanContext: &sc, Attributes: []attribute.KeyValue{ attribute.Bool("bool_key", true), diff --git a/internal/pkg/instrumentation/bpf/google.golang.org/grpc/client/probe.go b/internal/pkg/instrumentation/bpf/google.golang.org/grpc/client/probe.go index 366426dbb..f1011d6a3 100644 --- a/internal/pkg/instrumentation/bpf/google.golang.org/grpc/client/probe.go +++ b/internal/pkg/instrumentation/bpf/google.golang.org/grpc/client/probe.go @@ -147,8 +147,8 @@ func convertEvent(e *event) []*probe.SpanEvent { event := &probe.SpanEvent{ SpanName: method, - StartTime: int64(e.StartTime), - EndTime: int64(e.EndTime), + StartTime: utils.BootRelativeTime(e.StartTime), + EndTime: utils.BootRelativeTime(e.EndTime), Attributes: attrs, SpanContext: &sc, ParentSpanContext: pscPtr, diff --git a/internal/pkg/instrumentation/bpf/google.golang.org/grpc/server/probe.go b/internal/pkg/instrumentation/bpf/google.golang.org/grpc/server/probe.go index 9264d125d..1c13ac0f1 100644 --- a/internal/pkg/instrumentation/bpf/google.golang.org/grpc/server/probe.go +++ b/internal/pkg/instrumentation/bpf/google.golang.org/grpc/server/probe.go @@ -16,6 +16,7 @@ import ( "go.opentelemetry.io/auto/internal/pkg/inject" "go.opentelemetry.io/auto/internal/pkg/instrumentation/context" "go.opentelemetry.io/auto/internal/pkg/instrumentation/probe" + "go.opentelemetry.io/auto/internal/pkg/instrumentation/utils" "go.opentelemetry.io/auto/internal/pkg/process" "go.opentelemetry.io/auto/internal/pkg/structfield" ) @@ -127,8 +128,8 @@ func convertEvent(e *event) []*probe.SpanEvent { return []*probe.SpanEvent{ { SpanName: method, - StartTime: int64(e.StartTime), - EndTime: int64(e.EndTime), + StartTime: utils.BootRelativeTime(e.StartTime), + EndTime: utils.BootRelativeTime(e.EndTime), Attributes: []attribute.KeyValue{ semconv.RPCSystemKey.String("grpc"), semconv.RPCServiceKey.String(method), diff --git a/internal/pkg/instrumentation/bpf/net/http/client/probe.go b/internal/pkg/instrumentation/bpf/net/http/client/probe.go index f7eb679e7..d0ab072d9 100644 --- a/internal/pkg/instrumentation/bpf/net/http/client/probe.go +++ b/internal/pkg/instrumentation/bpf/net/http/client/probe.go @@ -274,8 +274,8 @@ func convertEvent(e *event) []*probe.SpanEvent { spanEvent := &probe.SpanEvent{ SpanName: method, - StartTime: int64(e.StartTime), - EndTime: int64(e.EndTime), + StartTime: utils.BootRelativeTime(e.StartTime), + EndTime: utils.BootRelativeTime(e.EndTime), SpanContext: &sc, Attributes: attrs, ParentSpanContext: pscPtr, diff --git a/internal/pkg/instrumentation/bpf/net/http/client/probe_test.go b/internal/pkg/instrumentation/bpf/net/http/client/probe_test.go index 9369b62c6..6eae3a946 100644 --- a/internal/pkg/instrumentation/bpf/net/http/client/probe_test.go +++ b/internal/pkg/instrumentation/bpf/net/http/client/probe_test.go @@ -96,8 +96,8 @@ func TestConvertEvent(t *testing.T) { { SpanName: methodString, SpanContext: &spanContext, - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String(methodString), semconv.HTTPResponseStatusCodeKey.Int(200), @@ -129,8 +129,8 @@ func TestConvertEvent(t *testing.T) { { SpanName: methodString, SpanContext: &spanContext, - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String(methodString), semconv.HTTPResponseStatusCodeKey.Int(400), @@ -163,8 +163,8 @@ func TestConvertEvent(t *testing.T) { { SpanName: methodString, SpanContext: &spanContext, - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String(methodString), semconv.HTTPResponseStatusCodeKey.Int(500), @@ -197,8 +197,8 @@ func TestConvertEvent(t *testing.T) { { SpanName: methodString, SpanContext: &spanContext, - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String(methodString), semconv.HTTPResponseStatusCodeKey.Int(200), @@ -234,8 +234,8 @@ func TestConvertEvent(t *testing.T) { { SpanName: methodString, SpanContext: &spanContext, - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String(methodString), semconv.HTTPResponseStatusCodeKey.Int(200), @@ -271,8 +271,8 @@ func TestConvertEvent(t *testing.T) { { SpanName: methodString, SpanContext: &spanContext, - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String(methodString), semconv.HTTPResponseStatusCodeKey.Int(200), diff --git a/internal/pkg/instrumentation/bpf/net/http/server/probe.go b/internal/pkg/instrumentation/bpf/net/http/server/probe.go index 3996aa770..3f519f9fc 100644 --- a/internal/pkg/instrumentation/bpf/net/http/server/probe.go +++ b/internal/pkg/instrumentation/bpf/net/http/server/probe.go @@ -18,6 +18,7 @@ import ( "go.opentelemetry.io/auto/internal/pkg/instrumentation/bpf/net/http" "go.opentelemetry.io/auto/internal/pkg/instrumentation/context" "go.opentelemetry.io/auto/internal/pkg/instrumentation/probe" + "go.opentelemetry.io/auto/internal/pkg/instrumentation/utils" "go.opentelemetry.io/auto/internal/pkg/process" "go.opentelemetry.io/auto/internal/pkg/structfield" ) @@ -211,8 +212,8 @@ func convertEvent(e *event) []*probe.SpanEvent { spanEvent := &probe.SpanEvent{ SpanName: spanName, - StartTime: int64(e.StartTime), - EndTime: int64(e.EndTime), + StartTime: utils.BootRelativeTime(e.StartTime), + EndTime: utils.BootRelativeTime(e.EndTime), SpanContext: &sc, ParentSpanContext: pscPtr, Attributes: attributes, diff --git a/internal/pkg/instrumentation/bpf/net/http/server/probe_test.go b/internal/pkg/instrumentation/bpf/net/http/server/probe_test.go index bcf50e338..4fe81e2d7 100644 --- a/internal/pkg/instrumentation/bpf/net/http/server/probe_test.go +++ b/internal/pkg/instrumentation/bpf/net/http/server/probe_test.go @@ -58,8 +58,8 @@ func TestProbeConvertEvent(t *testing.T) { expected: []*probe.SpanEvent{ { SpanName: "GET", - StartTime: int64(start.UnixNano()), - EndTime: int64(end.UnixNano()), + StartTime: start, + EndTime: end, SpanContext: &sc, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String("GET"), @@ -98,8 +98,8 @@ func TestProbeConvertEvent(t *testing.T) { expected: []*probe.SpanEvent{ { SpanName: "GET", - StartTime: int64(start.UnixNano()), - EndTime: int64(end.UnixNano()), + StartTime: start, + EndTime: end, SpanContext: &sc, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String("GET"), @@ -139,8 +139,8 @@ func TestProbeConvertEvent(t *testing.T) { expected: []*probe.SpanEvent{ { SpanName: "GET", - StartTime: int64(start.UnixNano()), - EndTime: int64(end.UnixNano()), + StartTime: start, + EndTime: end, SpanContext: &sc, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String("GET"), @@ -179,8 +179,8 @@ func TestProbeConvertEvent(t *testing.T) { expected: []*probe.SpanEvent{ { SpanName: "GET", - StartTime: int64(start.UnixNano()), - EndTime: int64(end.UnixNano()), + StartTime: start, + EndTime: end, SpanContext: &sc, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String("GET"), diff --git a/internal/pkg/instrumentation/probe/event.go b/internal/pkg/instrumentation/probe/event.go index 6e2e48b69..d6205a5c0 100644 --- a/internal/pkg/instrumentation/probe/event.go +++ b/internal/pkg/instrumentation/probe/event.go @@ -4,6 +4,8 @@ package probe import ( + "time" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" @@ -24,8 +26,8 @@ type Status struct { type SpanEvent struct { SpanName string Attributes []attribute.KeyValue - StartTime int64 - EndTime int64 + StartTime time.Time + EndTime time.Time SpanContext *trace.SpanContext ParentSpanContext *trace.SpanContext Status Status diff --git a/internal/pkg/instrumentation/utils/kernel.go b/internal/pkg/instrumentation/utils/kernel.go new file mode 100644 index 000000000..1bf14f00c --- /dev/null +++ b/internal/pkg/instrumentation/utils/kernel.go @@ -0,0 +1,26 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package utils + +import ( + "math" + "time" +) + +var bootTimeOffset = func() int64 { + o, err := estimateBootTimeOffset() + if err != nil { + panic(err) + } + return o +}() + +// BootRelativeTime returns the time nsec number of nanoseconds after the +// estimated boot time of the process. +func BootRelativeTime(nsec uint64) time.Time { + if nsec > math.MaxInt64 { + nsec = math.MaxInt64 + } + return time.Unix(0, bootTimeOffset+int64(nsec)) +} diff --git a/internal/pkg/instrumentation/utils/kernel_linux.go b/internal/pkg/instrumentation/utils/kernel_linux.go index 801706abe..c3a5184a5 100644 --- a/internal/pkg/instrumentation/utils/kernel_linux.go +++ b/internal/pkg/instrumentation/utils/kernel_linux.go @@ -178,7 +178,7 @@ func GetCPUCount() (int, error) { return 0, err } -func EstimateBootTimeOffset() (bootTimeOffset int64, err error) { +func estimateBootTimeOffset() (bootTimeOffset int64, err error) { // The datapath is currently using ktime_get_boot_ns for the pcap timestamp, // which corresponds to CLOCK_BOOTTIME. To be able to convert the the // CLOCK_BOOTTIME to CLOCK_REALTIME (i.e. a unix timestamp). diff --git a/internal/pkg/instrumentation/utils/kernel_other.go b/internal/pkg/instrumentation/utils/kernel_other.go index e3767a734..f9da90dcb 100644 --- a/internal/pkg/instrumentation/utils/kernel_other.go +++ b/internal/pkg/instrumentation/utils/kernel_other.go @@ -30,6 +30,6 @@ func GetCPUCount() (int, error) { return 0, nil } -func EstimateBootTimeOffset() (bootTimeOffset int64, err error) { +func estimateBootTimeOffset() (bootTimeOffset int64, err error) { return 0, nil } diff --git a/internal/pkg/opentelemetry/controller.go b/internal/pkg/opentelemetry/controller.go index eba78c6e4..f7232cc92 100644 --- a/internal/pkg/opentelemetry/controller.go +++ b/internal/pkg/opentelemetry/controller.go @@ -5,13 +5,11 @@ package opentelemetry import ( "context" - "time" "github.com/go-logr/logr" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/auto/internal/pkg/instrumentation/probe" - "go.opentelemetry.io/auto/internal/pkg/instrumentation/utils" ) // Controller handles OpenTelemetry telemetry generation for events. @@ -20,7 +18,6 @@ type Controller struct { version string tracerProvider trace.TracerProvider tracersMap map[tracerID]trace.Tracer - bootTime int64 } type tracerID struct{ name, version, schema string } @@ -75,31 +72,21 @@ func (c *Controller) Trace(event *probe.Event) { Start(ctx, se.SpanName, trace.WithAttributes(se.Attributes...), trace.WithSpanKind(event.Kind), - trace.WithTimestamp(c.convertTime(se.StartTime))) + trace.WithTimestamp(se.StartTime)) span.SetStatus(se.Status.Code, se.Status.Description) - span.End(trace.WithTimestamp(c.convertTime(se.EndTime))) + span.End(trace.WithTimestamp(se.EndTime)) } } -func (c *Controller) convertTime(t int64) time.Time { - return time.Unix(0, c.bootTime+t) -} - // NewController returns a new initialized [Controller]. func NewController(logger logr.Logger, tracerProvider trace.TracerProvider, ver string) (*Controller, error) { logger = logger.WithName("Controller") - bt, err := utils.EstimateBootTimeOffset() - if err != nil { - return nil, err - } - return &Controller{ logger: logger, version: ver, tracerProvider: tracerProvider, tracersMap: make(map[tracerID]trace.Tracer), - bootTime: bt, }, nil } diff --git a/internal/pkg/opentelemetry/controller_test.go b/internal/pkg/opentelemetry/controller_test.go index 3c67c22bb..1af8b9a8d 100644 --- a/internal/pkg/opentelemetry/controller_test.go +++ b/internal/pkg/opentelemetry/controller_test.go @@ -78,9 +78,6 @@ func TestTrace(t *testing.T) { ctrl, err := NewController(logger, tp, "test") assert.NoError(t, err) - convertedStartTime := ctrl.convertTime(startTime.Unix()) - convertedEndTime := ctrl.convertTime(endTime.Unix()) - spId, err := trace.SpanIDFromHex("00f067aa0ba902b7") assert.NoError(t, err) trId, err := trace.TraceIDFromHex("00f067aa0ba902b700f067aa0ba902b7") @@ -106,8 +103,8 @@ func TestTrace(t *testing.T) { SpanEvents: []*probe.SpanEvent{ { SpanName: "testSpan", - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, SpanContext: &spanContext, TracerSchema: semconv.SchemaURL, }, @@ -117,8 +114,8 @@ func TestTrace(t *testing.T) { { Name: "testSpan", SpanKind: trace.SpanKindClient, - StartTime: convertedStartTime, - EndTime: convertedEndTime, + StartTime: startTime, + EndTime: endTime, Resource: instResource(), InstrumentationLibrary: instrumentation.Scope{ Name: "go.opentelemetry.io/auto/foo/bar", @@ -141,8 +138,8 @@ func TestTrace(t *testing.T) { SpanEvents: []*probe.SpanEvent{ { SpanName: "GET", - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, SpanContext: &spanContext, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String("GET"), @@ -158,8 +155,8 @@ func TestTrace(t *testing.T) { { Name: "GET", SpanKind: trace.SpanKindClient, - StartTime: convertedStartTime, - EndTime: convertedEndTime, + StartTime: startTime, + EndTime: startTime, Resource: instResource(), InstrumentationLibrary: instrumentation.Scope{ Name: "go.opentelemetry.io/auto/net/http", @@ -187,8 +184,8 @@ func TestTrace(t *testing.T) { SpanEvents: []*probe.SpanEvent{ { SpanName: "GET", - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, SpanContext: &spanContext, Attributes: []attribute.KeyValue{ semconv.HTTPRequestMethodKey.String("GET"), @@ -205,8 +202,8 @@ func TestTrace(t *testing.T) { { Name: "GET", SpanKind: trace.SpanKindClient, - StartTime: convertedStartTime, - EndTime: convertedEndTime, + StartTime: startTime, + EndTime: endTime, Resource: instResource(), InstrumentationLibrary: instrumentation.Scope{ Name: "go.opentelemetry.io/auto/net/http", @@ -234,8 +231,8 @@ func TestTrace(t *testing.T) { SpanEvents: []*probe.SpanEvent{ { SpanName: "very important span", - StartTime: startTime.Unix(), - EndTime: endTime.Unix(), + StartTime: startTime, + EndTime: endTime, SpanContext: &spanContext, Attributes: []attribute.KeyValue{ attribute.Int64("int.value", 42), @@ -254,8 +251,8 @@ func TestTrace(t *testing.T) { { Name: "very important span", SpanKind: trace.SpanKindClient, - StartTime: convertedStartTime, - EndTime: convertedEndTime, + StartTime: startTime, + EndTime: endTime, Resource: instResource(), InstrumentationLibrary: instrumentation.Scope{ Name: "user-tracer",