diff --git a/CHANGELOG.md b/CHANGELOG.md index 659167a0262..0fafc6ebf5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## 🛑 Breaking changes 🛑 +- Rename pdata.*.[Start|End]Time to pdata.*.[Start|End]Timestamp (#2847) - Rename pdata.DoubleExemplar to pdata.Exemplar (#2804) - Rename pdata.DoubleHistogram to pdata.Histogram (#2797) - Rename pdata.DoubleSummary to pdata.Summary (#2774) diff --git a/cmd/pdatagen/internal/common_structs.go b/cmd/pdatagen/internal/common_structs.go index 315b2c25127..7442caa7aee 100644 --- a/cmd/pdatagen/internal/common_structs.go +++ b/cmd/pdatagen/internal/common_structs.go @@ -73,7 +73,7 @@ var instrumentationLibraryField = &messageValueField{ } var startTimeField = &primitiveTypedField{ - fieldName: "StartTime", + fieldName: "StartTimestamp", originFieldName: "StartTimeUnixNano", returnType: "Timestamp", rawType: "uint64", @@ -91,7 +91,7 @@ var timeField = &primitiveTypedField{ } var endTimeField = &primitiveTypedField{ - fieldName: "EndTime", + fieldName: "EndTimestamp", originFieldName: "EndTimeUnixNano", returnType: "Timestamp", rawType: "uint64", diff --git a/consumer/pdata/generated_metrics.go b/consumer/pdata/generated_metrics.go index 64455bac0d4..171be6dfbd4 100644 --- a/consumer/pdata/generated_metrics.go +++ b/consumer/pdata/generated_metrics.go @@ -931,13 +931,13 @@ func (ms IntDataPoint) LabelsMap() StringMap { return newStringMap(&(*ms.orig).Labels) } -// StartTime returns the starttime associated with this IntDataPoint. -func (ms IntDataPoint) StartTime() Timestamp { +// StartTimestamp returns the starttimestamp associated with this IntDataPoint. +func (ms IntDataPoint) StartTimestamp() Timestamp { return Timestamp((*ms.orig).StartTimeUnixNano) } -// SetStartTime replaces the starttime associated with this IntDataPoint. -func (ms IntDataPoint) SetStartTime(v Timestamp) { +// SetStartTimestamp replaces the starttimestamp associated with this IntDataPoint. +func (ms IntDataPoint) SetStartTimestamp(v Timestamp) { (*ms.orig).StartTimeUnixNano = uint64(v) } @@ -969,7 +969,7 @@ func (ms IntDataPoint) Exemplars() IntExemplarSlice { // CopyTo copies all properties from the current struct to the dest. func (ms IntDataPoint) CopyTo(dest IntDataPoint) { ms.LabelsMap().CopyTo(dest.LabelsMap()) - dest.SetStartTime(ms.StartTime()) + dest.SetStartTimestamp(ms.StartTimestamp()) dest.SetTimestamp(ms.Timestamp()) dest.SetValue(ms.Value()) ms.Exemplars().CopyTo(dest.Exemplars()) @@ -1116,13 +1116,13 @@ func (ms DoubleDataPoint) LabelsMap() StringMap { return newStringMap(&(*ms.orig).Labels) } -// StartTime returns the starttime associated with this DoubleDataPoint. -func (ms DoubleDataPoint) StartTime() Timestamp { +// StartTimestamp returns the starttimestamp associated with this DoubleDataPoint. +func (ms DoubleDataPoint) StartTimestamp() Timestamp { return Timestamp((*ms.orig).StartTimeUnixNano) } -// SetStartTime replaces the starttime associated with this DoubleDataPoint. -func (ms DoubleDataPoint) SetStartTime(v Timestamp) { +// SetStartTimestamp replaces the starttimestamp associated with this DoubleDataPoint. +func (ms DoubleDataPoint) SetStartTimestamp(v Timestamp) { (*ms.orig).StartTimeUnixNano = uint64(v) } @@ -1154,7 +1154,7 @@ func (ms DoubleDataPoint) Exemplars() ExemplarSlice { // CopyTo copies all properties from the current struct to the dest. func (ms DoubleDataPoint) CopyTo(dest DoubleDataPoint) { ms.LabelsMap().CopyTo(dest.LabelsMap()) - dest.SetStartTime(ms.StartTime()) + dest.SetStartTimestamp(ms.StartTimestamp()) dest.SetTimestamp(ms.Timestamp()) dest.SetValue(ms.Value()) ms.Exemplars().CopyTo(dest.Exemplars()) @@ -1301,13 +1301,13 @@ func (ms IntHistogramDataPoint) LabelsMap() StringMap { return newStringMap(&(*ms.orig).Labels) } -// StartTime returns the starttime associated with this IntHistogramDataPoint. -func (ms IntHistogramDataPoint) StartTime() Timestamp { +// StartTimestamp returns the starttimestamp associated with this IntHistogramDataPoint. +func (ms IntHistogramDataPoint) StartTimestamp() Timestamp { return Timestamp((*ms.orig).StartTimeUnixNano) } -// SetStartTime replaces the starttime associated with this IntHistogramDataPoint. -func (ms IntHistogramDataPoint) SetStartTime(v Timestamp) { +// SetStartTimestamp replaces the starttimestamp associated with this IntHistogramDataPoint. +func (ms IntHistogramDataPoint) SetStartTimestamp(v Timestamp) { (*ms.orig).StartTimeUnixNano = uint64(v) } @@ -1369,7 +1369,7 @@ func (ms IntHistogramDataPoint) Exemplars() IntExemplarSlice { // CopyTo copies all properties from the current struct to the dest. func (ms IntHistogramDataPoint) CopyTo(dest IntHistogramDataPoint) { ms.LabelsMap().CopyTo(dest.LabelsMap()) - dest.SetStartTime(ms.StartTime()) + dest.SetStartTimestamp(ms.StartTimestamp()) dest.SetTimestamp(ms.Timestamp()) dest.SetCount(ms.Count()) dest.SetSum(ms.Sum()) @@ -1519,13 +1519,13 @@ func (ms HistogramDataPoint) LabelsMap() StringMap { return newStringMap(&(*ms.orig).Labels) } -// StartTime returns the starttime associated with this HistogramDataPoint. -func (ms HistogramDataPoint) StartTime() Timestamp { +// StartTimestamp returns the starttimestamp associated with this HistogramDataPoint. +func (ms HistogramDataPoint) StartTimestamp() Timestamp { return Timestamp((*ms.orig).StartTimeUnixNano) } -// SetStartTime replaces the starttime associated with this HistogramDataPoint. -func (ms HistogramDataPoint) SetStartTime(v Timestamp) { +// SetStartTimestamp replaces the starttimestamp associated with this HistogramDataPoint. +func (ms HistogramDataPoint) SetStartTimestamp(v Timestamp) { (*ms.orig).StartTimeUnixNano = uint64(v) } @@ -1587,7 +1587,7 @@ func (ms HistogramDataPoint) Exemplars() ExemplarSlice { // CopyTo copies all properties from the current struct to the dest. func (ms HistogramDataPoint) CopyTo(dest HistogramDataPoint) { ms.LabelsMap().CopyTo(dest.LabelsMap()) - dest.SetStartTime(ms.StartTime()) + dest.SetStartTimestamp(ms.StartTimestamp()) dest.SetTimestamp(ms.Timestamp()) dest.SetCount(ms.Count()) dest.SetSum(ms.Sum()) @@ -1737,13 +1737,13 @@ func (ms SummaryDataPoint) LabelsMap() StringMap { return newStringMap(&(*ms.orig).Labels) } -// StartTime returns the starttime associated with this SummaryDataPoint. -func (ms SummaryDataPoint) StartTime() Timestamp { +// StartTimestamp returns the starttimestamp associated with this SummaryDataPoint. +func (ms SummaryDataPoint) StartTimestamp() Timestamp { return Timestamp((*ms.orig).StartTimeUnixNano) } -// SetStartTime replaces the starttime associated with this SummaryDataPoint. -func (ms SummaryDataPoint) SetStartTime(v Timestamp) { +// SetStartTimestamp replaces the starttimestamp associated with this SummaryDataPoint. +func (ms SummaryDataPoint) SetStartTimestamp(v Timestamp) { (*ms.orig).StartTimeUnixNano = uint64(v) } @@ -1785,7 +1785,7 @@ func (ms SummaryDataPoint) QuantileValues() ValueAtQuantileSlice { // CopyTo copies all properties from the current struct to the dest. func (ms SummaryDataPoint) CopyTo(dest SummaryDataPoint) { ms.LabelsMap().CopyTo(dest.LabelsMap()) - dest.SetStartTime(ms.StartTime()) + dest.SetStartTimestamp(ms.StartTimestamp()) dest.SetTimestamp(ms.Timestamp()) dest.SetCount(ms.Count()) dest.SetSum(ms.Sum()) diff --git a/consumer/pdata/generated_metrics_test.go b/consumer/pdata/generated_metrics_test.go index 68826beaa42..43b0b97b2ea 100644 --- a/consumer/pdata/generated_metrics_test.go +++ b/consumer/pdata/generated_metrics_test.go @@ -711,12 +711,12 @@ func TestIntDataPoint_LabelsMap(t *testing.T) { assert.EqualValues(t, testValLabelsMap, ms.LabelsMap()) } -func TestIntDataPoint_StartTime(t *testing.T) { +func TestIntDataPoint_StartTimestamp(t *testing.T) { ms := NewIntDataPoint() - assert.EqualValues(t, Timestamp(0), ms.StartTime()) - testValStartTime := Timestamp(1234567890) - ms.SetStartTime(testValStartTime) - assert.EqualValues(t, testValStartTime, ms.StartTime()) + assert.EqualValues(t, Timestamp(0), ms.StartTimestamp()) + testValStartTimestamp := Timestamp(1234567890) + ms.SetStartTimestamp(testValStartTimestamp) + assert.EqualValues(t, testValStartTimestamp, ms.StartTimestamp()) } func TestIntDataPoint_Timestamp(t *testing.T) { @@ -871,12 +871,12 @@ func TestDoubleDataPoint_LabelsMap(t *testing.T) { assert.EqualValues(t, testValLabelsMap, ms.LabelsMap()) } -func TestDoubleDataPoint_StartTime(t *testing.T) { +func TestDoubleDataPoint_StartTimestamp(t *testing.T) { ms := NewDoubleDataPoint() - assert.EqualValues(t, Timestamp(0), ms.StartTime()) - testValStartTime := Timestamp(1234567890) - ms.SetStartTime(testValStartTime) - assert.EqualValues(t, testValStartTime, ms.StartTime()) + assert.EqualValues(t, Timestamp(0), ms.StartTimestamp()) + testValStartTimestamp := Timestamp(1234567890) + ms.SetStartTimestamp(testValStartTimestamp) + assert.EqualValues(t, testValStartTimestamp, ms.StartTimestamp()) } func TestDoubleDataPoint_Timestamp(t *testing.T) { @@ -1031,12 +1031,12 @@ func TestIntHistogramDataPoint_LabelsMap(t *testing.T) { assert.EqualValues(t, testValLabelsMap, ms.LabelsMap()) } -func TestIntHistogramDataPoint_StartTime(t *testing.T) { +func TestIntHistogramDataPoint_StartTimestamp(t *testing.T) { ms := NewIntHistogramDataPoint() - assert.EqualValues(t, Timestamp(0), ms.StartTime()) - testValStartTime := Timestamp(1234567890) - ms.SetStartTime(testValStartTime) - assert.EqualValues(t, testValStartTime, ms.StartTime()) + assert.EqualValues(t, Timestamp(0), ms.StartTimestamp()) + testValStartTimestamp := Timestamp(1234567890) + ms.SetStartTimestamp(testValStartTimestamp) + assert.EqualValues(t, testValStartTimestamp, ms.StartTimestamp()) } func TestIntHistogramDataPoint_Timestamp(t *testing.T) { @@ -1215,12 +1215,12 @@ func TestHistogramDataPoint_LabelsMap(t *testing.T) { assert.EqualValues(t, testValLabelsMap, ms.LabelsMap()) } -func TestHistogramDataPoint_StartTime(t *testing.T) { +func TestHistogramDataPoint_StartTimestamp(t *testing.T) { ms := NewHistogramDataPoint() - assert.EqualValues(t, Timestamp(0), ms.StartTime()) - testValStartTime := Timestamp(1234567890) - ms.SetStartTime(testValStartTime) - assert.EqualValues(t, testValStartTime, ms.StartTime()) + assert.EqualValues(t, Timestamp(0), ms.StartTimestamp()) + testValStartTimestamp := Timestamp(1234567890) + ms.SetStartTimestamp(testValStartTimestamp) + assert.EqualValues(t, testValStartTimestamp, ms.StartTimestamp()) } func TestHistogramDataPoint_Timestamp(t *testing.T) { @@ -1399,12 +1399,12 @@ func TestSummaryDataPoint_LabelsMap(t *testing.T) { assert.EqualValues(t, testValLabelsMap, ms.LabelsMap()) } -func TestSummaryDataPoint_StartTime(t *testing.T) { +func TestSummaryDataPoint_StartTimestamp(t *testing.T) { ms := NewSummaryDataPoint() - assert.EqualValues(t, Timestamp(0), ms.StartTime()) - testValStartTime := Timestamp(1234567890) - ms.SetStartTime(testValStartTime) - assert.EqualValues(t, testValStartTime, ms.StartTime()) + assert.EqualValues(t, Timestamp(0), ms.StartTimestamp()) + testValStartTimestamp := Timestamp(1234567890) + ms.SetStartTimestamp(testValStartTimestamp) + assert.EqualValues(t, testValStartTimestamp, ms.StartTimestamp()) } func TestSummaryDataPoint_Timestamp(t *testing.T) { @@ -2035,7 +2035,7 @@ func generateTestIntDataPoint() IntDataPoint { func fillTestIntDataPoint(tv IntDataPoint) { fillTestStringMap(tv.LabelsMap()) - tv.SetStartTime(Timestamp(1234567890)) + tv.SetStartTimestamp(Timestamp(1234567890)) tv.SetTimestamp(Timestamp(1234567890)) tv.SetValue(int64(-17)) fillTestIntExemplarSlice(tv.Exemplars()) @@ -2062,7 +2062,7 @@ func generateTestDoubleDataPoint() DoubleDataPoint { func fillTestDoubleDataPoint(tv DoubleDataPoint) { fillTestStringMap(tv.LabelsMap()) - tv.SetStartTime(Timestamp(1234567890)) + tv.SetStartTimestamp(Timestamp(1234567890)) tv.SetTimestamp(Timestamp(1234567890)) tv.SetValue(float64(17.13)) fillTestExemplarSlice(tv.Exemplars()) @@ -2089,7 +2089,7 @@ func generateTestIntHistogramDataPoint() IntHistogramDataPoint { func fillTestIntHistogramDataPoint(tv IntHistogramDataPoint) { fillTestStringMap(tv.LabelsMap()) - tv.SetStartTime(Timestamp(1234567890)) + tv.SetStartTimestamp(Timestamp(1234567890)) tv.SetTimestamp(Timestamp(1234567890)) tv.SetCount(uint64(17)) tv.SetSum(int64(1713)) @@ -2119,7 +2119,7 @@ func generateTestHistogramDataPoint() HistogramDataPoint { func fillTestHistogramDataPoint(tv HistogramDataPoint) { fillTestStringMap(tv.LabelsMap()) - tv.SetStartTime(Timestamp(1234567890)) + tv.SetStartTimestamp(Timestamp(1234567890)) tv.SetTimestamp(Timestamp(1234567890)) tv.SetCount(uint64(17)) tv.SetSum(float64(17.13)) @@ -2149,7 +2149,7 @@ func generateTestSummaryDataPoint() SummaryDataPoint { func fillTestSummaryDataPoint(tv SummaryDataPoint) { fillTestStringMap(tv.LabelsMap()) - tv.SetStartTime(Timestamp(1234567890)) + tv.SetStartTimestamp(Timestamp(1234567890)) tv.SetTimestamp(Timestamp(1234567890)) tv.SetCount(uint64(17)) tv.SetSum(float64(17.13)) diff --git a/consumer/pdata/generated_trace.go b/consumer/pdata/generated_trace.go index 7a2a1e9e8ac..5e5256ab3dc 100644 --- a/consumer/pdata/generated_trace.go +++ b/consumer/pdata/generated_trace.go @@ -523,23 +523,23 @@ func (ms Span) SetKind(v SpanKind) { (*ms.orig).Kind = otlptrace.Span_SpanKind(v) } -// StartTime returns the starttime associated with this Span. -func (ms Span) StartTime() Timestamp { +// StartTimestamp returns the starttimestamp associated with this Span. +func (ms Span) StartTimestamp() Timestamp { return Timestamp((*ms.orig).StartTimeUnixNano) } -// SetStartTime replaces the starttime associated with this Span. -func (ms Span) SetStartTime(v Timestamp) { +// SetStartTimestamp replaces the starttimestamp associated with this Span. +func (ms Span) SetStartTimestamp(v Timestamp) { (*ms.orig).StartTimeUnixNano = uint64(v) } -// EndTime returns the endtime associated with this Span. -func (ms Span) EndTime() Timestamp { +// EndTimestamp returns the endtimestamp associated with this Span. +func (ms Span) EndTimestamp() Timestamp { return Timestamp((*ms.orig).EndTimeUnixNano) } -// SetEndTime replaces the endtime associated with this Span. -func (ms Span) SetEndTime(v Timestamp) { +// SetEndTimestamp replaces the endtimestamp associated with this Span. +func (ms Span) SetEndTimestamp(v Timestamp) { (*ms.orig).EndTimeUnixNano = uint64(v) } @@ -601,8 +601,8 @@ func (ms Span) CopyTo(dest Span) { dest.SetParentSpanID(ms.ParentSpanID()) dest.SetName(ms.Name()) dest.SetKind(ms.Kind()) - dest.SetStartTime(ms.StartTime()) - dest.SetEndTime(ms.EndTime()) + dest.SetStartTimestamp(ms.StartTimestamp()) + dest.SetEndTimestamp(ms.EndTimestamp()) ms.Attributes().CopyTo(dest.Attributes()) dest.SetDroppedAttributesCount(ms.DroppedAttributesCount()) ms.Events().CopyTo(dest.Events()) diff --git a/consumer/pdata/generated_trace_test.go b/consumer/pdata/generated_trace_test.go index 58f3f04a277..37ba3305868 100644 --- a/consumer/pdata/generated_trace_test.go +++ b/consumer/pdata/generated_trace_test.go @@ -461,20 +461,20 @@ func TestSpan_Kind(t *testing.T) { assert.EqualValues(t, testValKind, ms.Kind()) } -func TestSpan_StartTime(t *testing.T) { +func TestSpan_StartTimestamp(t *testing.T) { ms := NewSpan() - assert.EqualValues(t, Timestamp(0), ms.StartTime()) - testValStartTime := Timestamp(1234567890) - ms.SetStartTime(testValStartTime) - assert.EqualValues(t, testValStartTime, ms.StartTime()) + assert.EqualValues(t, Timestamp(0), ms.StartTimestamp()) + testValStartTimestamp := Timestamp(1234567890) + ms.SetStartTimestamp(testValStartTimestamp) + assert.EqualValues(t, testValStartTimestamp, ms.StartTimestamp()) } -func TestSpan_EndTime(t *testing.T) { +func TestSpan_EndTimestamp(t *testing.T) { ms := NewSpan() - assert.EqualValues(t, Timestamp(0), ms.EndTime()) - testValEndTime := Timestamp(1234567890) - ms.SetEndTime(testValEndTime) - assert.EqualValues(t, testValEndTime, ms.EndTime()) + assert.EqualValues(t, Timestamp(0), ms.EndTimestamp()) + testValEndTimestamp := Timestamp(1234567890) + ms.SetEndTimestamp(testValEndTimestamp) + assert.EqualValues(t, testValEndTimestamp, ms.EndTimestamp()) } func TestSpan_Attributes(t *testing.T) { @@ -939,8 +939,8 @@ func fillTestSpan(tv Span) { tv.SetParentSpanID(NewSpanID([8]byte{8, 7, 6, 5, 4, 3, 2, 1})) tv.SetName("test_name") tv.SetKind(SpanKindSERVER) - tv.SetStartTime(Timestamp(1234567890)) - tv.SetEndTime(Timestamp(1234567890)) + tv.SetStartTimestamp(Timestamp(1234567890)) + tv.SetEndTimestamp(Timestamp(1234567890)) fillTestAttributeMap(tv.Attributes()) tv.SetDroppedAttributesCount(uint32(17)) fillTestSpanEventSlice(tv.Events()) diff --git a/consumer/pdata/metric_test.go b/consumer/pdata/metric_test.go index 6511f7d802e..cd958ac1a48 100644 --- a/consumer/pdata/metric_test.go +++ b/consumer/pdata/metric_test.go @@ -342,12 +342,12 @@ func TestOtlpToInternalReadOnly(t *testing.T) { int64DataPoints := metricInt.IntGauge().DataPoints() assert.EqualValues(t, 2, int64DataPoints.Len()) // First point - assert.EqualValues(t, startTime, int64DataPoints.At(0).StartTime()) + assert.EqualValues(t, startTime, int64DataPoints.At(0).StartTimestamp()) assert.EqualValues(t, endTime, int64DataPoints.At(0).Timestamp()) assert.EqualValues(t, 123, int64DataPoints.At(0).Value()) assert.EqualValues(t, NewStringMap().InitFromMap(map[string]string{"key0": "value0"}), int64DataPoints.At(0).LabelsMap()) // Second point - assert.EqualValues(t, startTime, int64DataPoints.At(1).StartTime()) + assert.EqualValues(t, startTime, int64DataPoints.At(1).StartTimestamp()) assert.EqualValues(t, endTime, int64DataPoints.At(1).Timestamp()) assert.EqualValues(t, 456, int64DataPoints.At(1).Value()) assert.EqualValues(t, NewStringMap().InitFromMap(map[string]string{"key1": "value1"}), int64DataPoints.At(1).LabelsMap()) @@ -363,12 +363,12 @@ func TestOtlpToInternalReadOnly(t *testing.T) { doubleDataPoints := dsd.DataPoints() assert.EqualValues(t, 2, doubleDataPoints.Len()) // First point - assert.EqualValues(t, startTime, doubleDataPoints.At(0).StartTime()) + assert.EqualValues(t, startTime, doubleDataPoints.At(0).StartTimestamp()) assert.EqualValues(t, endTime, doubleDataPoints.At(0).Timestamp()) assert.EqualValues(t, 123.1, doubleDataPoints.At(0).Value()) assert.EqualValues(t, NewStringMap().InitFromMap(map[string]string{"key0": "value0"}), doubleDataPoints.At(0).LabelsMap()) // Second point - assert.EqualValues(t, startTime, doubleDataPoints.At(1).StartTime()) + assert.EqualValues(t, startTime, doubleDataPoints.At(1).StartTimestamp()) assert.EqualValues(t, endTime, doubleDataPoints.At(1).Timestamp()) assert.EqualValues(t, 456.1, doubleDataPoints.At(1).Value()) assert.EqualValues(t, NewStringMap().InitFromMap(map[string]string{"key1": "value1"}), doubleDataPoints.At(1).LabelsMap()) @@ -384,13 +384,13 @@ func TestOtlpToInternalReadOnly(t *testing.T) { histogramDataPoints := dhd.DataPoints() assert.EqualValues(t, 2, histogramDataPoints.Len()) // First point - assert.EqualValues(t, startTime, histogramDataPoints.At(0).StartTime()) + assert.EqualValues(t, startTime, histogramDataPoints.At(0).StartTimestamp()) assert.EqualValues(t, endTime, histogramDataPoints.At(0).Timestamp()) assert.EqualValues(t, []float64{1, 2}, histogramDataPoints.At(0).ExplicitBounds()) assert.EqualValues(t, NewStringMap().InitFromMap(map[string]string{"key0": "value0"}), histogramDataPoints.At(0).LabelsMap()) assert.EqualValues(t, []uint64{10, 15, 1}, histogramDataPoints.At(0).BucketCounts()) // Second point - assert.EqualValues(t, startTime, histogramDataPoints.At(1).StartTime()) + assert.EqualValues(t, startTime, histogramDataPoints.At(1).StartTimestamp()) assert.EqualValues(t, endTime, histogramDataPoints.At(1).Timestamp()) assert.EqualValues(t, []float64{1}, histogramDataPoints.At(1).ExplicitBounds()) assert.EqualValues(t, NewStringMap().InitFromMap(map[string]string{"key1": "value1"}), histogramDataPoints.At(1).LabelsMap()) @@ -458,8 +458,8 @@ func TestOtlpToFromInternalIntGaugeMutating(t *testing.T) { igd.DataPoints().Resize(1) assert.EqualValues(t, 1, igd.DataPoints().Len()) int64DataPoints := igd.DataPoints() - int64DataPoints.At(0).SetStartTime(Timestamp(startTime + 1)) - assert.EqualValues(t, startTime+1, int64DataPoints.At(0).StartTime()) + int64DataPoints.At(0).SetStartTimestamp(Timestamp(startTime + 1)) + assert.EqualValues(t, startTime+1, int64DataPoints.At(0).StartTimestamp()) int64DataPoints.At(0).SetTimestamp(Timestamp(endTime + 1)) assert.EqualValues(t, endTime+1, int64DataPoints.At(0).Timestamp()) int64DataPoints.At(0).SetValue(124) @@ -538,8 +538,8 @@ func TestOtlpToFromInternalDoubleSumMutating(t *testing.T) { dsd.DataPoints().Resize(1) assert.EqualValues(t, 1, dsd.DataPoints().Len()) doubleDataPoints := dsd.DataPoints() - doubleDataPoints.At(0).SetStartTime(Timestamp(startTime + 1)) - assert.EqualValues(t, startTime+1, doubleDataPoints.At(0).StartTime()) + doubleDataPoints.At(0).SetStartTimestamp(Timestamp(startTime + 1)) + assert.EqualValues(t, startTime+1, doubleDataPoints.At(0).StartTimestamp()) doubleDataPoints.At(0).SetTimestamp(Timestamp(endTime + 1)) assert.EqualValues(t, endTime+1, doubleDataPoints.At(0).Timestamp()) doubleDataPoints.At(0).SetValue(124.1) @@ -619,8 +619,8 @@ func TestOtlpToFromInternalHistogramMutating(t *testing.T) { dhd.DataPoints().Resize(1) assert.EqualValues(t, 1, dhd.DataPoints().Len()) histogramDataPoints := dhd.DataPoints() - histogramDataPoints.At(0).SetStartTime(Timestamp(startTime + 1)) - assert.EqualValues(t, startTime+1, histogramDataPoints.At(0).StartTime()) + histogramDataPoints.At(0).SetStartTimestamp(Timestamp(startTime + 1)) + assert.EqualValues(t, startTime+1, histogramDataPoints.At(0).StartTimestamp()) histogramDataPoints.At(0).SetTimestamp(Timestamp(endTime + 1)) assert.EqualValues(t, endTime+1, histogramDataPoints.At(0).Timestamp()) histogramDataPoints.At(0).LabelsMap().Delete("key0") diff --git a/exporter/kafkaexporter/jaeger_marshaller_test.go b/exporter/kafkaexporter/jaeger_marshaller_test.go index a04241614a3..b74b4ec3835 100644 --- a/exporter/kafkaexporter/jaeger_marshaller_test.go +++ b/exporter/kafkaexporter/jaeger_marshaller_test.go @@ -32,8 +32,8 @@ func TestJaegerMarshaller(t *testing.T) { td.ResourceSpans().At(0).InstrumentationLibrarySpans().Resize(1) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().Resize(1) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetName("foo") - td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetStartTime(pdata.Timestamp(10)) - td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetEndTime(pdata.Timestamp(20)) + td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetStartTimestamp(pdata.Timestamp(10)) + td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetEndTimestamp(pdata.Timestamp(20)) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetTraceID(pdata.NewTraceID([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetSpanID(pdata.NewSpanID([8]byte{1, 2, 3, 4, 5, 6, 7, 8})) batches, err := jaegertranslator.InternalTracesToJaegerProto(td) diff --git a/exporter/loggingexporter/logging_exporter.go b/exporter/loggingexporter/logging_exporter.go index a84ffa1161c..3f7fad76b31 100644 --- a/exporter/loggingexporter/logging_exporter.go +++ b/exporter/loggingexporter/logging_exporter.go @@ -119,7 +119,7 @@ func (b *logDataBuffer) logIntDataPoints(ps pdata.IntDataPointSlice) { b.logEntry("IntDataPoints #%d", i) b.logDataPointLabels(p.LabelsMap()) - b.logEntry("StartTime: %d", p.StartTime()) + b.logEntry("StartTimestamp: %d", p.StartTimestamp()) b.logEntry("Timestamp: %d", p.Timestamp()) b.logEntry("Value: %d", p.Value()) } @@ -131,7 +131,7 @@ func (b *logDataBuffer) logDoubleDataPoints(ps pdata.DoubleDataPointSlice) { b.logEntry("DoubleDataPoints #%d", i) b.logDataPointLabels(p.LabelsMap()) - b.logEntry("StartTime: %d", p.StartTime()) + b.logEntry("StartTimestamp: %d", p.StartTimestamp()) b.logEntry("Timestamp: %d", p.Timestamp()) b.logEntry("Value: %f", p.Value()) } @@ -143,7 +143,7 @@ func (b *logDataBuffer) logDoubleHistogramDataPoints(ps pdata.HistogramDataPoint b.logEntry("HistogramDataPoints #%d", i) b.logDataPointLabels(p.LabelsMap()) - b.logEntry("StartTime: %d", p.StartTime()) + b.logEntry("StartTimestamp: %d", p.StartTimestamp()) b.logEntry("Timestamp: %d", p.Timestamp()) b.logEntry("Count: %d", p.Count()) b.logEntry("Sum: %f", p.Sum()) @@ -170,7 +170,7 @@ func (b *logDataBuffer) logIntHistogramDataPoints(ps pdata.IntHistogramDataPoint b.logEntry("HistogramDataPoints #%d", i) b.logDataPointLabels(p.LabelsMap()) - b.logEntry("StartTime: %d", p.StartTime()) + b.logEntry("StartTimestamp: %d", p.StartTimestamp()) b.logEntry("Timestamp: %d", p.Timestamp()) b.logEntry("Count: %d", p.Count()) b.logEntry("Sum: %d", p.Sum()) @@ -197,7 +197,7 @@ func (b *logDataBuffer) logDoubleSummaryDataPoints(ps pdata.SummaryDataPointSlic b.logEntry("SummaryDataPoints #%d", i) b.logDataPointLabels(p.LabelsMap()) - b.logEntry("StartTime: %d", p.StartTime()) + b.logEntry("StartTimestamp: %d", p.StartTimestamp()) b.logEntry("Timestamp: %d", p.Timestamp()) b.logEntry("Count: %d", p.Count()) b.logEntry("Sum: %f", p.Sum()) @@ -351,8 +351,8 @@ func (s *loggingExporter) pushTraceData( buf.logAttr("ID", span.SpanID().HexString()) buf.logAttr("Name", span.Name()) buf.logAttr("Kind", span.Kind().String()) - buf.logAttr("Start time", span.StartTime().String()) - buf.logAttr("End time", span.EndTime().String()) + buf.logAttr("Start time", span.StartTimestamp().String()) + buf.logAttr("End time", span.EndTimestamp().String()) buf.logAttr("Status code", span.Status().Code().String()) buf.logAttr("Status message", span.Status().Message()) diff --git a/internal/goldendataset/metric_gen.go b/internal/goldendataset/metric_gen.go index f642ce69b6e..26e6ef2cec9 100644 --- a/internal/goldendataset/metric_gen.go +++ b/internal/goldendataset/metric_gen.go @@ -160,7 +160,7 @@ func populateIntPoints(cfg MetricCfg, pts pdata.IntDataPointSlice) { pts.Resize(cfg.NumPtsPerMetric) for i := 0; i < cfg.NumPtsPerMetric; i++ { pt := pts.At(i) - pt.SetStartTime(pdata.Timestamp(cfg.StartTime)) + pt.SetStartTimestamp(pdata.Timestamp(cfg.StartTime)) pt.SetTimestamp(getTimestamp(cfg.StartTime, cfg.StepSize, i)) pt.SetValue(int64(cfg.PtVal + i)) populatePtLabels(cfg, pt.LabelsMap()) @@ -171,7 +171,7 @@ func populateDoublePoints(cfg MetricCfg, pts pdata.DoubleDataPointSlice) { pts.Resize(cfg.NumPtsPerMetric) for i := 0; i < cfg.NumPtsPerMetric; i++ { pt := pts.At(i) - pt.SetStartTime(pdata.Timestamp(cfg.StartTime)) + pt.SetStartTimestamp(pdata.Timestamp(cfg.StartTime)) pt.SetTimestamp(getTimestamp(cfg.StartTime, cfg.StepSize, i)) pt.SetValue(float64(cfg.PtVal + i)) populatePtLabels(cfg, pt.LabelsMap()) @@ -183,7 +183,7 @@ func populateDoubleHistogram(cfg MetricCfg, dh pdata.Histogram) { pts.Resize(cfg.NumPtsPerMetric) for i := 0; i < cfg.NumPtsPerMetric; i++ { pt := pts.At(i) - pt.SetStartTime(pdata.Timestamp(cfg.StartTime)) + pt.SetStartTimestamp(pdata.Timestamp(cfg.StartTime)) ts := getTimestamp(cfg.StartTime, cfg.StepSize, i) pt.SetTimestamp(ts) populatePtLabels(cfg, pt.LabelsMap()) @@ -220,7 +220,7 @@ func populateIntHistogram(cfg MetricCfg, dh pdata.IntHistogram) { pts.Resize(cfg.NumPtsPerMetric) for i := 0; i < cfg.NumPtsPerMetric; i++ { pt := pts.At(i) - pt.SetStartTime(pdata.Timestamp(cfg.StartTime)) + pt.SetStartTimestamp(pdata.Timestamp(cfg.StartTime)) ts := getTimestamp(cfg.StartTime, cfg.StepSize, i) pt.SetTimestamp(ts) populatePtLabels(cfg, pt.LabelsMap()) diff --git a/internal/goldendataset/metric_gen_test.go b/internal/goldendataset/metric_gen_test.go index 98b9a26f99e..441ba507caf 100644 --- a/internal/goldendataset/metric_gen_test.go +++ b/internal/goldendataset/metric_gen_test.go @@ -53,7 +53,7 @@ func TestGenDefault(t *testing.T) { ptLabels, _ := pt.LabelsMap().Get("pt-label-key-0") require.Equal(t, "pt-label-val-0", ptLabels) - require.EqualValues(t, 940000000000000000, pt.StartTime()) + require.EqualValues(t, 940000000000000000, pt.StartTimestamp()) require.EqualValues(t, 940000000000000042, pt.Timestamp()) require.EqualValues(t, 1, pt.Value()) } diff --git a/internal/testdata/metric.go b/internal/testdata/metric.go index 8a0b18874ad..79ce7402010 100644 --- a/internal/testdata/metric.go +++ b/internal/testdata/metric.go @@ -333,12 +333,12 @@ func initCounterIntMetric(im pdata.Metric) { idps.Resize(2) idp0 := idps.At(0) initMetricLabels1(idp0.LabelsMap()) - idp0.SetStartTime(TestMetricStartTimestamp) + idp0.SetStartTimestamp(TestMetricStartTimestamp) idp0.SetTimestamp(TestMetricTimestamp) idp0.SetValue(123) idp1 := idps.At(1) initMetricLabels2(idp1.LabelsMap()) - idp1.SetStartTime(TestMetricStartTimestamp) + idp1.SetStartTimestamp(TestMetricStartTimestamp) idp1.SetTimestamp(TestMetricTimestamp) idp1.SetValue(456) } @@ -350,7 +350,7 @@ func initGaugeIntMetricOneDataPoint(im pdata.Metric) { idps.Resize(1) idp0 := idps.At(0) initMetricLabels1(idp0.LabelsMap()) - idp0.SetStartTime(TestMetricStartTimestamp) + idp0.SetStartTimestamp(TestMetricStartTimestamp) idp0.SetTimestamp(TestMetricTimestamp) idp0.SetValue(123) } @@ -382,13 +382,13 @@ func initSumDoubleMetric(dm pdata.Metric) { ddps.Resize(2) ddp0 := ddps.At(0) initMetricLabels12(ddp0.LabelsMap()) - ddp0.SetStartTime(TestMetricStartTimestamp) + ddp0.SetStartTimestamp(TestMetricStartTimestamp) ddp0.SetTimestamp(TestMetricTimestamp) ddp0.SetValue(1.23) ddp1 := ddps.At(1) initMetricLabels13(ddp1.LabelsMap()) - ddp1.SetStartTime(TestMetricStartTimestamp) + ddp1.SetStartTimestamp(TestMetricStartTimestamp) ddp1.SetTimestamp(TestMetricTimestamp) ddp1.SetValue(4.56) } @@ -420,13 +420,13 @@ func initDoubleHistogramMetric(hm pdata.Metric) { hdps.Resize(2) hdp0 := hdps.At(0) initMetricLabels13(hdp0.LabelsMap()) - hdp0.SetStartTime(TestMetricStartTimestamp) + hdp0.SetStartTimestamp(TestMetricStartTimestamp) hdp0.SetTimestamp(TestMetricTimestamp) hdp0.SetCount(1) hdp0.SetSum(15) hdp1 := hdps.At(1) initMetricLabels2(hdp1.LabelsMap()) - hdp1.SetStartTime(TestMetricStartTimestamp) + hdp1.SetStartTimestamp(TestMetricStartTimestamp) hdp1.SetTimestamp(TestMetricTimestamp) hdp1.SetCount(1) hdp1.SetSum(15) @@ -478,13 +478,13 @@ func initIntHistogramMetric(hm pdata.Metric) { hdps.Resize(2) hdp0 := hdps.At(0) initMetricLabels13(hdp0.LabelsMap()) - hdp0.SetStartTime(TestMetricStartTimestamp) + hdp0.SetStartTimestamp(TestMetricStartTimestamp) hdp0.SetTimestamp(TestMetricTimestamp) hdp0.SetCount(1) hdp0.SetSum(15) hdp1 := hdps.At(1) initMetricLabels2(hdp1.LabelsMap()) - hdp1.SetStartTime(TestMetricStartTimestamp) + hdp1.SetStartTimestamp(TestMetricStartTimestamp) hdp1.SetTimestamp(TestMetricTimestamp) hdp1.SetCount(1) hdp1.SetSum(15) @@ -536,13 +536,13 @@ func initDoubleSummaryMetric(sm pdata.Metric) { sdps.Resize(2) sdp0 := sdps.At(0) initMetricLabels13(sdp0.LabelsMap()) - sdp0.SetStartTime(TestMetricStartTimestamp) + sdp0.SetStartTimestamp(TestMetricStartTimestamp) sdp0.SetTimestamp(TestMetricTimestamp) sdp0.SetCount(1) sdp0.SetSum(15) sdp1 := sdps.At(1) initMetricLabels2(sdp1.LabelsMap()) - sdp1.SetStartTime(TestMetricStartTimestamp) + sdp1.SetStartTimestamp(TestMetricStartTimestamp) sdp1.SetTimestamp(TestMetricTimestamp) sdp1.SetCount(1) sdp1.SetSum(15) diff --git a/internal/testdata/trace.go b/internal/testdata/trace.go index 0a7cb0a928b..f8a2a0f9946 100644 --- a/internal/testdata/trace.go +++ b/internal/testdata/trace.go @@ -232,8 +232,8 @@ func generateTraceOtlpTwoSpansSameResourceOneDifferent() *otlpcollectortrace.Exp func fillSpanOne(span pdata.Span) { span.SetName("operationA") - span.SetStartTime(TestSpanStartTimestamp) - span.SetEndTime(TestSpanEndTimestamp) + span.SetStartTimestamp(TestSpanStartTimestamp) + span.SetEndTimestamp(TestSpanEndTimestamp) span.SetDroppedAttributesCount(1) evs := span.Events() evs.Resize(2) @@ -282,8 +282,8 @@ func generateOtlpSpanOne() *otlptrace.Span { func fillSpanTwo(span pdata.Span) { span.SetName("operationB") - span.SetStartTime(TestSpanStartTimestamp) - span.SetEndTime(TestSpanEndTimestamp) + span.SetStartTimestamp(TestSpanStartTimestamp) + span.SetEndTimestamp(TestSpanEndTimestamp) span.Links().Resize(2) initSpanLinkAttributes(span.Links().At(0).Attributes()) span.Links().At(0).SetDroppedAttributesCount(4) @@ -311,8 +311,8 @@ func generateOtlpSpanTwo() *otlptrace.Span { func fillSpanThree(span pdata.Span) { span.SetName("operationC") - span.SetStartTime(TestSpanStartTimestamp) - span.SetEndTime(TestSpanEndTimestamp) + span.SetStartTimestamp(TestSpanStartTimestamp) + span.SetEndTimestamp(TestSpanEndTimestamp) initSpanAttributes(span.Attributes()) span.SetDroppedAttributesCount(5) } diff --git a/internal/version/version.go b/internal/version/version.go index 1413be74199..b79c1d95e4d 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -67,7 +67,7 @@ var InfoVar = Info{ // RuntimeVar returns the InfoVar plus runtime information like uptime. func RuntimeVar() Info { - return append(InfoVar, [2]string{"StartTime", startTime.String()}, [2]string{"Uptime", time.Since(startTime).String()}) + return append(InfoVar, [2]string{"StartTimestamp", startTime.String()}, [2]string{"Uptime", time.Since(startTime).String()}) } // Info has properties about the build and runtime. diff --git a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper.go index 82c3639919d..8efd0ab126a 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/cpu_scraper.go @@ -88,7 +88,7 @@ func initializeCPUTimeDataPoint(dataPoint pdata.DoubleDataPoint, startTime, now } labelsMap.Insert(metadata.Labels.CPUState, stateLabel) - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others.go index fc180366536..8a0e1fc1d6b 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_others.go @@ -180,7 +180,7 @@ func initializeInt64DataPoint(dataPoint pdata.IntDataPoint, startTime, now pdata if directionLabel != "" { labelsMap.Insert(metadata.Labels.DiskDirection, directionLabel) } - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } @@ -191,7 +191,7 @@ func initializeDoubleDataPoint(dataPoint pdata.DoubleDataPoint, startTime, now p if directionLabel != "" { labelsMap.Insert(metadata.Labels.DiskDirection, directionLabel) } - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows.go b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows.go index e01ecd36a5a..0f68b3d6a29 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows.go +++ b/receiver/hostmetricsreceiver/internal/scraper/diskscraper/disk_scraper_windows.go @@ -190,7 +190,7 @@ func initializeInt64DataPoint(dataPoint pdata.IntDataPoint, startTime, now pdata if directionLabel != "" { labelsMap.Insert(metadata.Labels.DiskDirection, directionLabel) } - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } @@ -201,7 +201,7 @@ func initializeDoubleDataPoint(dataPoint pdata.DoubleDataPoint, startTime, now p if directionLabel != "" { labelsMap.Insert(metadata.Labels.DiskDirection, directionLabel) } - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper.go index b9c94a0e236..8ee6cbca901 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/networkscraper/network_scraper.go @@ -170,7 +170,7 @@ func initializeNetworkDataPoint(dataPoint pdata.IntDataPoint, startTime, now pda labelsMap := dataPoint.LabelsMap() labelsMap.Insert(metadata.Labels.NetworkDevice, deviceLabel) labelsMap.Insert(metadata.Labels.NetworkDirection, directionLabel) - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others.go index 4c2a6c500f2..b121b535b36 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_others.go @@ -137,7 +137,7 @@ func initializePagingOperationsDataPoint(dataPoint pdata.IntDataPoint, startTime labelsMap := dataPoint.LabelsMap() labelsMap.Insert(metadata.Labels.PagingType, typeLabel) labelsMap.Insert(metadata.Labels.PagingDirection, directionLabel) - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } @@ -153,7 +153,7 @@ func initializePageFaultsMetric(metric pdata.Metric, startTime, now pdata.Timest func initializePageFaultDataPoint(dataPoint pdata.IntDataPoint, startTime, now pdata.Timestamp, typeLabel string, value int64) { dataPoint.LabelsMap().Insert(metadata.Labels.PagingType, typeLabel) - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows.go b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows.go index 0a88cf82ef6..545149a1506 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows.go +++ b/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/paging_scraper_windows.go @@ -170,7 +170,7 @@ func initializePagingOperationsDataPoint(dataPoint pdata.IntDataPoint, startTime labelsMap := dataPoint.LabelsMap() labelsMap.Insert(metadata.Labels.PagingType, metadata.LabelPagingType.Major) labelsMap.Insert(metadata.Labels.PagingDirection, directionLabel) - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go index ee65f888165..2905f119492 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go @@ -248,7 +248,7 @@ func initializeDiskIOMetric(metric pdata.Metric, startTime, now pdata.Timestamp, func initializeDiskIODataPoint(dataPoint pdata.IntDataPoint, startTime, now pdata.Timestamp, value int64, directionLabel string) { labelsMap := dataPoint.LabelsMap() labelsMap.Insert(metadata.Labels.ProcessDirection, directionLabel) - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_linux.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_linux.go index 22dbf284ea6..487721ef3a9 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_linux.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_linux.go @@ -34,7 +34,7 @@ func appendCPUTimeStateDataPoints(ddps pdata.DoubleDataPointSlice, startTime, no func initializeCPUTimeDataPoint(dataPoint pdata.DoubleDataPoint, startTime, now pdata.Timestamp, value float64, stateLabel string) { labelsMap := dataPoint.LabelsMap() labelsMap.Insert(metadata.Labels.ProcessState, stateLabel) - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } diff --git a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_windows.go b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_windows.go index 43b1c857296..08e31bf85c3 100644 --- a/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_windows.go +++ b/receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_windows.go @@ -36,7 +36,7 @@ func appendCPUTimeStateDataPoints(ddps pdata.DoubleDataPointSlice, startTime, no func initializeCPUTimeDataPoint(dataPoint pdata.DoubleDataPoint, startTime, now pdata.Timestamp, value float64, stateLabel string) { labelsMap := dataPoint.LabelsMap() labelsMap.Insert(metadata.Labels.ProcessState, stateLabel) - dataPoint.SetStartTime(startTime) + dataPoint.SetStartTimestamp(startTime) dataPoint.SetTimestamp(now) dataPoint.SetValue(value) } diff --git a/receiver/hostmetricsreceiver/internal/testutils.go b/receiver/hostmetricsreceiver/internal/testutils.go index 2e1e7498510..236af01f1fc 100644 --- a/receiver/hostmetricsreceiver/internal/testutils.go +++ b/receiver/hostmetricsreceiver/internal/testutils.go @@ -66,14 +66,14 @@ func AssertDoubleSumMetricLabelExists(t *testing.T, metric pdata.Metric, index i func AssertIntSumMetricStartTimeEquals(t *testing.T, metric pdata.Metric, startTime pdata.Timestamp) { idps := metric.IntSum().DataPoints() for i := 0; i < idps.Len(); i++ { - require.Equal(t, startTime, idps.At(i).StartTime()) + require.Equal(t, startTime, idps.At(i).StartTimestamp()) } } func AssertDoubleSumMetricStartTimeEquals(t *testing.T, metric pdata.Metric, startTime pdata.Timestamp) { ddps := metric.DoubleSum().DataPoints() for i := 0; i < ddps.Len(); i++ { - require.Equal(t, startTime, ddps.At(i).StartTime()) + require.Equal(t, startTime, ddps.At(i).StartTimestamp()) } } diff --git a/receiver/jaegerreceiver/jaeger_agent_test.go b/receiver/jaegerreceiver/jaeger_agent_test.go index 3e7a12a1526..9039cf72b21 100644 --- a/receiver/jaegerreceiver/jaeger_agent_test.go +++ b/receiver/jaegerreceiver/jaeger_agent_test.go @@ -231,8 +231,8 @@ func generateTraceData() pdata.Traces { span := td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0) span.SetSpanID(pdata.NewSpanID([8]byte{0, 1, 2, 3, 4, 5, 6, 7})) span.SetTraceID(pdata.NewTraceID([16]byte{0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0})) - span.SetStartTime(1581452772000000000) - span.SetEndTime(1581452773000000000) + span.SetStartTimestamp(1581452772000000000) + span.SetEndTimestamp(1581452773000000000) return td } diff --git a/receiver/jaegerreceiver/trace_receiver_test.go b/receiver/jaegerreceiver/trace_receiver_test.go index f33a0d3bd61..4da4298096d 100644 --- a/receiver/jaegerreceiver/trace_receiver_test.go +++ b/receiver/jaegerreceiver/trace_receiver_test.go @@ -309,8 +309,8 @@ func expectedTraceData(t1, t2, t3 time.Time) pdata.Traces { span0.SetParentSpanID(parentSpanID) span0.SetTraceID(traceID) span0.SetName("DBSearch") - span0.SetStartTime(pdata.TimestampFromTime(t1)) - span0.SetEndTime(pdata.TimestampFromTime(t2)) + span0.SetStartTimestamp(pdata.TimestampFromTime(t1)) + span0.SetEndTimestamp(pdata.TimestampFromTime(t2)) span0.Status().SetCode(pdata.StatusCodeError) span0.Status().SetMessage("Stale indices") @@ -318,8 +318,8 @@ func expectedTraceData(t1, t2, t3 time.Time) pdata.Traces { span1.SetSpanID(parentSpanID) span1.SetTraceID(traceID) span1.SetName("ProxyFetch") - span1.SetStartTime(pdata.TimestampFromTime(t2)) - span1.SetEndTime(pdata.TimestampFromTime(t3)) + span1.SetStartTimestamp(pdata.TimestampFromTime(t2)) + span1.SetEndTimestamp(pdata.TimestampFromTime(t3)) span1.Status().SetCode(pdata.StatusCodeError) span1.Status().SetMessage("Frontend crash") diff --git a/receiver/kafkareceiver/jaeger_unmarshaller_test.go b/receiver/kafkareceiver/jaeger_unmarshaller_test.go index 318dd3837f1..919488ca12d 100644 --- a/receiver/kafkareceiver/jaeger_unmarshaller_test.go +++ b/receiver/kafkareceiver/jaeger_unmarshaller_test.go @@ -32,8 +32,8 @@ func TestUnmarshallJaeger(t *testing.T) { td.ResourceSpans().At(0).InstrumentationLibrarySpans().Resize(1) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().Resize(1) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetName("foo") - td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetStartTime(pdata.Timestamp(10)) - td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetEndTime(pdata.Timestamp(20)) + td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetStartTimestamp(pdata.Timestamp(10)) + td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetEndTimestamp(pdata.Timestamp(20)) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetTraceID(pdata.NewTraceID([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetSpanID(pdata.NewSpanID([8]byte{1, 2, 3, 4, 5, 6, 7, 8})) batches, err := jaegertranslator.InternalTracesToJaegerProto(td) diff --git a/receiver/kafkareceiver/zipkin_unmarshaller_test.go b/receiver/kafkareceiver/zipkin_unmarshaller_test.go index 028f6d3863b..ed947672032 100644 --- a/receiver/kafkareceiver/zipkin_unmarshaller_test.go +++ b/receiver/kafkareceiver/zipkin_unmarshaller_test.go @@ -37,8 +37,8 @@ func TestUnmarshallZipkin(t *testing.T) { td.ResourceSpans().At(0).InstrumentationLibrarySpans().Resize(1) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().Resize(1) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetName("foo") - td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetStartTime(pdata.Timestamp(1597759000)) - td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetEndTime(pdata.Timestamp(1597769000)) + td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetStartTimestamp(pdata.Timestamp(1597759000)) + td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetEndTimestamp(pdata.Timestamp(1597769000)) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetTraceID(pdata.NewTraceID([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetSpanID(pdata.NewSpanID([8]byte{1, 2, 3, 4, 5, 6, 7, 8})) td.ResourceSpans().At(0).InstrumentationLibrarySpans().At(0).Spans().At(0).SetParentSpanID(pdata.NewSpanID([8]byte{0, 0, 0, 0, 0, 0, 0, 0})) diff --git a/receiver/prometheusreceiver/internal/transaction.go b/receiver/prometheusreceiver/internal/transaction.go index 1e92b29e2a1..e2252f2377b 100644 --- a/receiver/prometheusreceiver/internal/transaction.go +++ b/receiver/prometheusreceiver/internal/transaction.go @@ -166,7 +166,7 @@ func (tr *transaction) Commit() error { return err } - adjustStartTime(tr.metricBuilder.startTime, metrics) + adjustStartTimestamp(tr.metricBuilder.startTime, metrics) } else { // AdjustMetrics - jobsMap has to be non-nil in this case. // Note: metrics could be empty after adjustment, which needs to be checked before passing it on to ConsumeMetrics() @@ -191,7 +191,7 @@ func (tr *transaction) Rollback() error { return nil } -func adjustStartTime(startTime float64, metrics []*metricspb.Metric) { +func adjustStartTimestamp(startTime float64, metrics []*metricspb.Metric) { startTimeTs := timestampFromFloat64(startTime) for _, metric := range metrics { switch metric.GetMetricDescriptor().GetType() { diff --git a/receiver/zipkinreceiver/proto_parse_test.go b/receiver/zipkinreceiver/proto_parse_test.go index 5f3070c0bae..79e418afd3c 100644 --- a/receiver/zipkinreceiver/proto_parse_test.go +++ b/receiver/zipkinreceiver/proto_parse_test.go @@ -119,8 +119,8 @@ func TestConvertSpansToTraceSpans_protobuf(t *testing.T) { span0.SetSpanID(pdata.NewSpanID([8]byte{0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0})) span0.SetParentSpanID(pdata.NewSpanID([8]byte{0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0})) span0.SetName("ProtoSpan1") - span0.SetStartTime(pdata.TimestampFromTime(now)) - span0.SetEndTime(pdata.TimestampFromTime(now.Add(12 * time.Second))) + span0.SetStartTimestamp(pdata.TimestampFromTime(now)) + span0.SetEndTimestamp(pdata.TimestampFromTime(now.Add(12 * time.Second))) span0.Attributes().UpsertString(conventions.AttributeNetHostIP, "192.168.0.1") span0.Attributes().UpsertInt(conventions.AttributeNetHostPort, 8009) span0.Attributes().UpsertString(conventions.AttributeNetPeerName, "memcached") @@ -137,8 +137,8 @@ func TestConvertSpansToTraceSpans_protobuf(t *testing.T) { span1.SetSpanID(pdata.NewSpanID([8]byte{0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60})) span1.SetParentSpanID(pdata.NewSpanID([8]byte{0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10})) span1.SetName("CacheWarmUp") - span1.SetStartTime(pdata.TimestampFromTime(now.Add(-10 * time.Hour))) - span1.SetEndTime(pdata.TimestampFromTime(now.Add(-10 * time.Hour).Add(7 * time.Second))) + span1.SetStartTimestamp(pdata.TimestampFromTime(now.Add(-10 * time.Hour))) + span1.SetEndTimestamp(pdata.TimestampFromTime(now.Add(-10 * time.Hour).Add(7 * time.Second))) span1.Attributes().UpsertString(conventions.AttributeNetHostIP, "10.0.0.13") span1.Attributes().UpsertInt(conventions.AttributeNetHostPort, 8009) span1.Attributes().UpsertString(conventions.AttributeNetPeerName, "redis") diff --git a/testbed/testbed/data_providers.go b/testbed/testbed/data_providers.go index 0e021df3c80..9006700d052 100644 --- a/testbed/testbed/data_providers.go +++ b/testbed/testbed/data_providers.go @@ -104,8 +104,8 @@ func (dp *PerfTestDataProvider) GenerateTraces() (pdata.Traces, bool) { for k, v := range dp.options.Attributes { attrs.UpsertString(k, v) } - span.SetStartTime(pdata.TimestampFromTime(startTime)) - span.SetEndTime(pdata.TimestampFromTime(endTime)) + span.SetStartTimestamp(pdata.TimestampFromTime(startTime)) + span.SetEndTimestamp(pdata.TimestampFromTime(endTime)) } return traceData, false } @@ -154,7 +154,7 @@ func (dp *PerfTestDataProvider) GenerateMetrics() (pdata.Metrics, bool) { dps.Resize(dataPointsPerMetric) for j := 0; j < dataPointsPerMetric; j++ { dataPoint := dps.At(j) - dataPoint.SetStartTime(pdata.TimestampFromTime(time.Now())) + dataPoint.SetStartTimestamp(pdata.TimestampFromTime(time.Now())) value := dp.dataItemsGenerated.Inc() dataPoint.SetValue(int64(value)) dataPoint.LabelsMap().InitFromMap(map[string]string{ diff --git a/translator/internaldata/metrics_to_oc.go b/translator/internaldata/metrics_to_oc.go index cb3bbf47e81..dc1baff58e5 100644 --- a/translator/internaldata/metrics_to_oc.go +++ b/translator/internaldata/metrics_to_oc.go @@ -258,7 +258,7 @@ func intPointsToOC(dps pdata.IntDataPointSlice, labelKeys *labelKeys) []*ocmetri for i := 0; i < dps.Len(); i++ { ip := dps.At(i) ts := &ocmetrics.TimeSeries{ - StartTimestamp: timestampAsTimestampPb(ip.StartTime()), + StartTimestamp: timestampAsTimestampPb(ip.StartTimestamp()), LabelValues: labelValuesToOC(ip.LabelsMap(), labelKeys), Points: []*ocmetrics.Point{ { @@ -282,7 +282,7 @@ func doublePointToOC(dps pdata.DoubleDataPointSlice, labelKeys *labelKeys) []*oc for i := 0; i < dps.Len(); i++ { dp := dps.At(i) ts := &ocmetrics.TimeSeries{ - StartTimestamp: timestampAsTimestampPb(dp.StartTime()), + StartTimestamp: timestampAsTimestampPb(dp.StartTimestamp()), LabelValues: labelValuesToOC(dp.LabelsMap(), labelKeys), Points: []*ocmetrics.Point{ { @@ -309,7 +309,7 @@ func doubleHistogramPointToOC(dps pdata.HistogramDataPointSlice, labelKeys *labe doubleExemplarsToOC(dp.ExplicitBounds(), buckets, dp.Exemplars()) ts := &ocmetrics.TimeSeries{ - StartTimestamp: timestampAsTimestampPb(dp.StartTime()), + StartTimestamp: timestampAsTimestampPb(dp.StartTimestamp()), LabelValues: labelValuesToOC(dp.LabelsMap(), labelKeys), Points: []*ocmetrics.Point{ { @@ -342,7 +342,7 @@ func intHistogramPointToOC(dps pdata.IntHistogramDataPointSlice, labelKeys *labe intExemplarsToOC(dp.ExplicitBounds(), buckets, dp.Exemplars()) ts := &ocmetrics.TimeSeries{ - StartTimestamp: timestampAsTimestampPb(dp.StartTime()), + StartTimestamp: timestampAsTimestampPb(dp.StartTimestamp()), LabelValues: labelValuesToOC(dp.LabelsMap(), labelKeys), Points: []*ocmetrics.Point{ { @@ -402,7 +402,7 @@ func doubleSummaryPointToOC(dps pdata.SummaryDataPointSlice, labelKeys *labelKey percentileValues := summaryPercentilesToOC(dp.QuantileValues()) ts := &ocmetrics.TimeSeries{ - StartTimestamp: timestampAsTimestampPb(dp.StartTime()), + StartTimestamp: timestampAsTimestampPb(dp.StartTimestamp()), LabelValues: labelValuesToOC(dp.LabelsMap(), labelKeys), Points: []*ocmetrics.Point{ { diff --git a/translator/internaldata/oc_to_metrics.go b/translator/internaldata/oc_to_metrics.go index 989ba710be8..3b05489ab46 100644 --- a/translator/internaldata/oc_to_metrics.go +++ b/translator/internaldata/oc_to_metrics.go @@ -278,7 +278,7 @@ func fillIntDataPoint(ocMetric *ocmetrics.Metric, dps pdata.IntDataPointSlice) { dp := dps.At(pos) pos++ - dp.SetStartTime(startTimestamp) + dp.SetStartTimestamp(startTimestamp) dp.SetTimestamp(pdata.TimestampFromTime(point.GetTimestamp().AsTime())) setLabelsMap(ocLabelsKeys, timeseries.LabelValues, dp.LabelsMap()) dp.SetValue(point.GetInt64Value()) @@ -306,7 +306,7 @@ func fillDoubleDataPoint(ocMetric *ocmetrics.Metric, dps pdata.DoubleDataPointSl dp := dps.At(pos) pos++ - dp.SetStartTime(startTimestamp) + dp.SetStartTimestamp(startTimestamp) dp.SetTimestamp(pdata.TimestampFromTime(point.GetTimestamp().AsTime())) setLabelsMap(ocLabelsKeys, timeseries.LabelValues, dp.LabelsMap()) dp.SetValue(point.GetDoubleValue()) @@ -334,7 +334,7 @@ func fillDoubleHistogramDataPoint(ocMetric *ocmetrics.Metric, dps pdata.Histogra dp := dps.At(pos) pos++ - dp.SetStartTime(startTimestamp) + dp.SetStartTimestamp(startTimestamp) dp.SetTimestamp(pdata.TimestampFromTime(point.GetTimestamp().AsTime())) setLabelsMap(ocLabelsKeys, timeseries.LabelValues, dp.LabelsMap()) distributionValue := point.GetDistributionValue() @@ -366,7 +366,7 @@ func fillDoubleSummaryDataPoint(ocMetric *ocmetrics.Metric, dps pdata.SummaryDat dp := dps.At(pos) pos++ - dp.SetStartTime(startTimestamp) + dp.SetStartTimestamp(startTimestamp) dp.SetTimestamp(pdata.TimestampFromTime(point.GetTimestamp().AsTime())) setLabelsMap(ocLabelsKeys, timeseries.LabelValues, dp.LabelsMap()) summaryValue := point.GetSummaryValue() diff --git a/translator/internaldata/oc_to_traces.go b/translator/internaldata/oc_to_traces.go index b034091d091..866d1909a44 100644 --- a/translator/internaldata/oc_to_traces.go +++ b/translator/internaldata/oc_to_traces.go @@ -144,8 +144,8 @@ func ocSpanToInternal(src *octrace.Span, dest pdata.Span) { dest.SetParentSpanID(spanIDToInternal(src.ParentSpanId)) dest.SetName(src.Name.GetValue()) - dest.SetStartTime(pdata.TimestampFromTime(src.StartTime.AsTime())) - dest.SetEndTime(pdata.TimestampFromTime(src.EndTime.AsTime())) + dest.SetStartTimestamp(pdata.TimestampFromTime(src.StartTime.AsTime())) + dest.SetEndTimestamp(pdata.TimestampFromTime(src.EndTime.AsTime())) ocStatusToInternal(src.Status, src.Attributes, dest.Status()) diff --git a/translator/internaldata/traces_to_oc.go b/translator/internaldata/traces_to_oc.go index 0e01518547a..84716624c52 100644 --- a/translator/internaldata/traces_to_oc.go +++ b/translator/internaldata/traces_to_oc.go @@ -87,8 +87,8 @@ func spanToOC(span pdata.Span) *octrace.Span { ParentSpanId: spanIDToOC(span.ParentSpanID()), Name: stringToTruncatableString(span.Name()), Kind: spanKindToOC(span.Kind()), - StartTime: timestampAsTimestampPb(span.StartTime()), - EndTime: timestampAsTimestampPb(span.EndTime()), + StartTime: timestampAsTimestampPb(span.StartTimestamp()), + EndTime: timestampAsTimestampPb(span.EndTimestamp()), Attributes: attributes, TimeEvents: eventsToOC(span.Events(), span.DroppedEventsCount()), Links: linksToOC(span.Links(), span.DroppedLinksCount()), diff --git a/translator/trace/jaeger/jaegerproto_to_traces.go b/translator/trace/jaeger/jaegerproto_to_traces.go index 0bbc555be03..5f11a4a3e1d 100644 --- a/translator/trace/jaeger/jaegerproto_to_traces.go +++ b/translator/trace/jaeger/jaegerproto_to_traces.go @@ -167,8 +167,8 @@ func jSpanToInternal(span *model.Span) (pdata.Span, instrumentationLibrary) { dest.SetTraceID(tracetranslator.UInt64ToTraceID(span.TraceID.High, span.TraceID.Low)) dest.SetSpanID(tracetranslator.UInt64ToSpanID(uint64(span.SpanID))) dest.SetName(span.OperationName) - dest.SetStartTime(pdata.TimestampFromTime(span.StartTime)) - dest.SetEndTime(pdata.TimestampFromTime(span.StartTime.Add(span.Duration))) + dest.SetStartTimestamp(pdata.TimestampFromTime(span.StartTime)) + dest.SetEndTimestamp(pdata.TimestampFromTime(span.StartTime.Add(span.Duration))) parentSpanID := span.ParentSpanID() if parentSpanID != model.SpanID(0) { diff --git a/translator/trace/jaeger/jaegerproto_to_traces_test.go b/translator/trace/jaeger/jaegerproto_to_traces_test.go index 96ba7b3ef8d..23275fbbf78 100644 --- a/translator/trace/jaeger/jaegerproto_to_traces_test.go +++ b/translator/trace/jaeger/jaegerproto_to_traces_test.go @@ -532,8 +532,8 @@ func generateTraceDataOneSpanNoResource() pdata.Traces { [16]byte{0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0x80})) span.SetDroppedAttributesCount(0) span.SetDroppedEventsCount(0) - span.SetStartTime(testSpanStartTimestamp) - span.SetEndTime(testSpanEndTimestamp) + span.SetStartTimestamp(testSpanStartTimestamp) + span.SetEndTimestamp(testSpanEndTimestamp) span.SetKind(pdata.SpanKindCLIENT) span.Events().At(0).SetTimestamp(testSpanEventTimestamp) span.Events().At(0).SetDroppedAttributesCount(0) @@ -717,8 +717,8 @@ func generateTraceDataTwoSpansChildParent() pdata.Traces { span.SetParentSpanID(spans.At(0).SpanID()) span.SetKind(pdata.SpanKindSERVER) span.SetTraceID(spans.At(0).TraceID()) - span.SetStartTime(spans.At(0).StartTime()) - span.SetEndTime(spans.At(0).EndTime()) + span.SetStartTimestamp(spans.At(0).StartTimestamp()) + span.SetEndTimestamp(spans.At(0).EndTimestamp()) span.Status().SetCode(pdata.StatusCodeError) span.Attributes().InitFromMap(map[string]pdata.AttributeValue{ tracetranslator.TagHTTPStatusCode: pdata.NewAttributeValueInt(404), @@ -769,8 +769,8 @@ func generateTraceDataTwoSpansWithFollower() pdata.Traces { span.SetName("operationC") span.SetSpanID(pdata.NewSpanID([8]byte{0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18})) span.SetTraceID(spans.At(0).TraceID()) - span.SetStartTime(spans.At(0).EndTime()) - span.SetEndTime(spans.At(0).EndTime() + 1000000) + span.SetStartTimestamp(spans.At(0).EndTimestamp()) + span.SetEndTimestamp(spans.At(0).EndTimestamp() + 1000000) span.SetKind(pdata.SpanKindCONSUMER) span.Status().SetCode(pdata.StatusCodeOk) span.Status().SetMessage("status-ok") @@ -847,8 +847,8 @@ func generateTraceDataTwoSpansFromTwoLibraries() pdata.Traces { span1.SetTraceID(tracetranslator.UInt64ToTraceID(0, 0)) span1.SetSpanID(tracetranslator.UInt64ToSpanID(0)) span1.SetName("operation1") - span1.SetStartTime(testSpanStartTimestamp) - span1.SetEndTime(testSpanEndTimestamp) + span1.SetStartTimestamp(testSpanStartTimestamp) + span1.SetEndTimestamp(testSpanEndTimestamp) rs0ils1 := rs0.InstrumentationLibrarySpans().At(1) rs0ils1.InstrumentationLibrary().SetName("library2") @@ -858,8 +858,8 @@ func generateTraceDataTwoSpansFromTwoLibraries() pdata.Traces { span2.SetTraceID(span1.TraceID()) span2.SetSpanID(span1.SpanID()) span2.SetName("operation2") - span2.SetStartTime(testSpanStartTimestamp) - span2.SetEndTime(testSpanEndTimestamp) + span2.SetStartTimestamp(testSpanStartTimestamp) + span2.SetEndTimestamp(testSpanEndTimestamp) return td } diff --git a/translator/trace/jaeger/jaegerthrift_to_traces.go b/translator/trace/jaeger/jaegerthrift_to_traces.go index b63acba724c..dab27df8c0b 100644 --- a/translator/trace/jaeger/jaegerthrift_to_traces.go +++ b/translator/trace/jaeger/jaegerthrift_to_traces.go @@ -100,8 +100,8 @@ func jThriftSpanToInternal(span *jaeger.Span, dest pdata.Span) { dest.SetTraceID(tracetranslator.UInt64ToTraceID(uint64(span.TraceIdHigh), uint64(span.TraceIdLow))) dest.SetSpanID(tracetranslator.UInt64ToSpanID(uint64(span.SpanId))) dest.SetName(span.OperationName) - dest.SetStartTime(microsecondsToUnixNano(span.StartTime)) - dest.SetEndTime(microsecondsToUnixNano(span.StartTime + span.Duration)) + dest.SetStartTimestamp(microsecondsToUnixNano(span.StartTime)) + dest.SetEndTimestamp(microsecondsToUnixNano(span.StartTime + span.Duration)) parentSpanID := span.ParentSpanId if parentSpanID != 0 { diff --git a/translator/trace/jaeger/traces_to_jaegerproto.go b/translator/trace/jaeger/traces_to_jaegerproto.go index 5bd370cec8b..bdebb9be24d 100644 --- a/translator/trace/jaeger/traces_to_jaegerproto.go +++ b/translator/trace/jaeger/traces_to_jaegerproto.go @@ -175,7 +175,7 @@ func spanToJaegerProto(span pdata.Span, libraryTags pdata.InstrumentationLibrary return nil, fmt.Errorf("error converting span links to Jaeger references: %w", err) } - startTime := span.StartTime().AsTime() + startTime := span.StartTimestamp().AsTime() return &model.Span{ TraceID: traceID, @@ -183,7 +183,7 @@ func spanToJaegerProto(span pdata.Span, libraryTags pdata.InstrumentationLibrary OperationName: span.Name(), References: jReferences, StartTime: startTime, - Duration: span.EndTime().AsTime().Sub(startTime), + Duration: span.EndTimestamp().AsTime().Sub(startTime), Tags: getJaegerProtoSpanTags(span, libraryTags), Logs: spanEventsToJaegerProtoLogs(span.Events()), }, nil diff --git a/translator/trace/zipkin/traces_to_zipkinv2.go b/translator/trace/zipkin/traces_to_zipkinv2.go index ff2bf16b547..d4db59a7e4e 100644 --- a/translator/trace/zipkin/traces_to_zipkinv2.go +++ b/translator/trace/zipkin/traces_to_zipkinv2.go @@ -121,9 +121,9 @@ func spanToZipkinSpan( zs.Sampled = &sampled zs.Name = span.Name() - zs.Timestamp = span.StartTime().AsTime() - if span.EndTime() != 0 { - zs.Duration = time.Duration(span.EndTime() - span.StartTime()) + zs.Timestamp = span.StartTimestamp().AsTime() + if span.EndTimestamp() != 0 { + zs.Duration = time.Duration(span.EndTimestamp() - span.StartTimestamp()) } zs.Kind = spanKindToZipkinKind(span.Kind()) if span.Kind() == pdata.SpanKindINTERNAL { diff --git a/translator/trace/zipkin/zipkinv2_to_traces.go b/translator/trace/zipkin/zipkinv2_to_traces.go index a9341d01b19..185099160b5 100644 --- a/translator/trace/zipkin/zipkinv2_to_traces.go +++ b/translator/trace/zipkin/zipkinv2_to_traces.go @@ -133,8 +133,8 @@ func zSpanToInternal(zspan *zipkinmodel.SpanModel, tags map[string]string, dest } dest.SetName(zspan.Name) - dest.SetStartTime(pdata.TimestampFromTime(zspan.Timestamp)) - dest.SetEndTime(pdata.TimestampFromTime(zspan.Timestamp.Add(zspan.Duration))) + dest.SetStartTimestamp(pdata.TimestampFromTime(zspan.Timestamp)) + dest.SetEndTimestamp(pdata.TimestampFromTime(zspan.Timestamp.Add(zspan.Duration))) dest.SetKind(zipkinKindToSpanKind(zspan.Kind, tags)) populateSpanStatus(tags, dest.Status()) diff --git a/translator/trace/zipkin/zipkinv2_to_traces_test.go b/translator/trace/zipkin/zipkinv2_to_traces_test.go index 2effd7006cf..c8417703f23 100644 --- a/translator/trace/zipkin/zipkinv2_to_traces_test.go +++ b/translator/trace/zipkin/zipkinv2_to_traces_test.go @@ -129,8 +129,8 @@ func generateTraceSingleSpanNoResourceOrInstrLibrary() pdata.Traces { span.SetSpanID(pdata.NewSpanID([8]byte{0xAF, 0xAE, 0xAD, 0xAC, 0xAB, 0xAA, 0xA9, 0xA8})) span.SetName("MinimalData") span.SetKind(pdata.SpanKindCLIENT) - span.SetStartTime(1596911098294000000) - span.SetEndTime(1596911098295000000) + span.SetStartTimestamp(1596911098294000000) + span.SetEndTimestamp(1596911098295000000) span.Attributes().InitEmptyWithCapacity(0) return td } @@ -157,8 +157,8 @@ func generateTraceSingleSpanErrorStatus() pdata.Traces { span.SetSpanID(pdata.NewSpanID([8]byte{0xAF, 0xAE, 0xAD, 0xAC, 0xAB, 0xAA, 0xA9, 0xA8})) span.SetName("MinimalData") span.SetKind(pdata.SpanKindCLIENT) - span.SetStartTime(1596911098294000000) - span.SetEndTime(1596911098295000000) + span.SetStartTimestamp(1596911098294000000) + span.SetEndTimestamp(1596911098295000000) span.Attributes().InitEmptyWithCapacity(0) span.Status().SetCode(pdata.StatusCodeError) return td