Skip to content

Commit

Permalink
[pdata] Remove deprecated [Metrics|Traces|Logs]MoveTo methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax committed Feb 8, 2023
1 parent ead716a commit 8089867
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 51 deletions.
11 changes: 11 additions & 0 deletions .chloggen/pdatap-remove-moveto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: pdata

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove deprecated `[Metrics|Traces|Logs]MoveTo` methods.

# One or more tracking issues or pull requests related to the change
issues: [7165]
8 changes: 0 additions & 8 deletions pdata/plog/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ func NewLogs() Logs {
return newLogs(&otlpcollectorlog.ExportLogsServiceRequest{})
}

// MoveTo moves the Logs instance overriding the destination and
// resetting the current instance to its zero value.
// Deprecated: [1.0.0-rc5] The method can be replaced with a plain assignment.
func (ms Logs) MoveTo(dest Logs) {
*dest.getOrig() = *ms.getOrig()
*ms.getOrig() = otlpcollectorlog.ExportLogsServiceRequest{}
}

// CopyTo copies the Logs instance overriding the destination.
func (ms Logs) CopyTo(dest Logs) {
ms.ResourceLogs().CopyTo(dest.ResourceLogs())
Expand Down
9 changes: 0 additions & 9 deletions pdata/plog/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,6 @@ func TestResourceLogsWireCompatibility(t *testing.T) {
assert.EqualValues(t, logs.getOrig(), &gogoprotoRS2)
}

func TestLogsMoveTo(t *testing.T) {
logs := NewLogs()
fillTestResourceLogsSlice(logs.ResourceLogs())
dest := NewLogs()
logs.MoveTo(dest)
assert.EqualValues(t, NewLogs(), logs)
assert.EqualValues(t, generateTestResourceLogsSlice(), dest.ResourceLogs())
}

func TestLogsCopyTo(t *testing.T) {
logs := NewLogs()
fillTestResourceLogsSlice(logs.ResourceLogs())
Expand Down
8 changes: 0 additions & 8 deletions pdata/pmetric/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ func (ms Metrics) CopyTo(dest Metrics) {
ms.ResourceMetrics().CopyTo(dest.ResourceMetrics())
}

// MoveTo moves the Metrics instance overriding the destination and
// resetting the current instance to its zero value.
// Deprecated: [1.0.0-rc5] The method can be replaced with a plain assignment.
func (ms Metrics) MoveTo(dest Metrics) {
*dest.getOrig() = *ms.getOrig()
*ms.getOrig() = otlpcollectormetrics.ExportMetricsServiceRequest{}
}

// ResourceMetrics returns the ResourceMetricsSlice associated with this Metrics.
func (ms Metrics) ResourceMetrics() ResourceMetricsSlice {
return newResourceMetricsSlice(&ms.getOrig().ResourceMetrics)
Expand Down
9 changes: 0 additions & 9 deletions pdata/pmetric/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,6 @@ func TestHistogramWithValidSum(t *testing.T) {
assert.EqualValues(t, histo, dest)
}

func TestMetricsMoveTo(t *testing.T) {
metrics := NewMetrics()
fillTestResourceMetricsSlice(metrics.ResourceMetrics())
dest := NewMetrics()
metrics.MoveTo(dest)
assert.EqualValues(t, NewMetrics(), metrics)
assert.EqualValues(t, generateTestResourceMetricsSlice(), dest.ResourceMetrics())
}

func TestOtlpToInternalReadOnly(t *testing.T) {
md := newMetrics(&otlpcollectormetrics.ExportMetricsServiceRequest{
ResourceMetrics: []*otlpmetrics.ResourceMetrics{
Expand Down
8 changes: 0 additions & 8 deletions pdata/ptrace/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ func NewTraces() Traces {
return newTraces(&otlpcollectortrace.ExportTraceServiceRequest{})
}

// MoveTo moves the Traces instance overriding the destination and
// resetting the current instance to its zero value.
// Deprecated: [1.0.0-rc5] The method can be replaced with a plain assignment.
func (ms Traces) MoveTo(dest Traces) {
*dest.getOrig() = *ms.getOrig()
*ms.getOrig() = otlpcollectortrace.ExportTraceServiceRequest{}
}

// CopyTo copies the Traces instance overriding the destination.
func (ms Traces) CopyTo(dest Traces) {
ms.ResourceSpans().CopyTo(dest.ResourceSpans())
Expand Down
9 changes: 0 additions & 9 deletions pdata/ptrace/traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@ func TestResourceSpansWireCompatibility(t *testing.T) {
assert.EqualValues(t, traces.getOrig(), &gogoprotoRS2)
}

func TestTracesMoveTo(t *testing.T) {
traces := NewTraces()
fillTestResourceSpansSlice(traces.ResourceSpans())
dest := NewTraces()
traces.MoveTo(dest)
assert.EqualValues(t, NewTraces(), traces)
assert.EqualValues(t, generateTestResourceSpansSlice(), dest.ResourceSpans())
}

func TestTracesCopyTo(t *testing.T) {
traces := NewTraces()
fillTestResourceSpansSlice(traces.ResourceSpans())
Expand Down

0 comments on commit 8089867

Please sign in to comment.