Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[chore] remove deprecated code #6178

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

## Unreleased

### 🛑 Breaking changes 🛑

- Delete deprecated `go.opentelemetry.io/collector/service/featuregate`. (#6178)
- Delete deprecated `pmetric.OptionalType`. (#6178)
- Delete deprecated `ptrace.Span[Link]?.TraceStateStruct`. (#6178)
- Delete deprecated `pcommon.NewValueBytesEmpty`. (#6178)
- Delete deprecated `pmetric.MetricDataType`. (#6178)
- Delete deprecated `pmetric.Metric.DataType()`. (#6178)
- Delete deprecated `pmetric.NumberDataPoint.[Set]?[Int|Double]Val()`. (#6178)
- Delete deprecated `pmetric.Exemplar.[Set]?[Int|Double]Val()`. (#6178)
- Delete deprecated `p[metric|log|trace]otlp.[Client|Server]`. (#6178)
- Delete deprecated pdata Clone methods. (#6178)
- Delete deprecated `pcommon.Value` getter/setter methods with `Val` suffix. (#6178)
- Delete deprecated `StringVal` and `SetStringVal` methods. (#6178)
- Delete deprecated `ValueTypeString` method. (#6178)

### 🚩 Deprecations 🚩

- Deprecate `p[metric|log|trace]otlp.RegiserServer` in favor of `p[metric|log|trace]otlp.RegiserGRPCServer` (#6180)
Expand Down
76 changes: 0 additions & 76 deletions pdata/pcommon/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ const (
ValueTypeBytes
)

// Deprecated: [0.61.0] Use ValueTypeStr instead
const ValueTypeString = ValueTypeStr

// String returns the string representation of the ValueType.
func (avt ValueType) String() string {
switch avt {
Expand Down Expand Up @@ -131,9 +128,6 @@ func NewValueBytes() Value {
return newValue(&otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_BytesValue{BytesValue: nil}})
}

// Deprecated: [0.61.0] Use NewValueBytes instead
var NewValueBytesEmpty = NewValueBytes

func newValue(orig *otlpcommon.AnyValue) Value {
return Value(internal.NewValue(orig))
}
Expand Down Expand Up @@ -329,76 +323,6 @@ func (v Value) SetEmptySlice() Slice {
return newSlice(&av.ArrayValue.Values)
}

// Deprecated: [0.61.0] Use Str instead.
func (v Value) StringVal() string {
return v.Str()
}

// Deprecated: [0.61.0] Use Int instead.
func (v Value) IntVal() int64 {
return v.Int()
}

// Deprecated: [0.61.0] Use Double instead.
func (v Value) DoubleVal() float64 {
return v.Double()
}

// Deprecated: [0.61.0] Use Bool instead.
func (v Value) BoolVal() bool {
return v.Bool()
}

// Deprecated: [0.61.0] Use Map instead.
func (v Value) MapVal() Map {
return v.Map()
}

// Deprecated: [0.61.0] Use Slice instead.
func (v Value) SliceVal() Slice {
return v.Slice()
}

// Deprecated: [0.61.0] Use Bytes instead.
func (v Value) BytesVal() ByteSlice {
return v.Bytes()
}

// Deprecated: [0.61.0] Use SetStr instead.
func (v Value) SetStringVal(sv string) {
v.SetStr(sv)
}

// Deprecated: [0.61.0] Use SetInt instead.
func (v Value) SetIntVal(iv int64) {
v.SetInt(iv)
}

// Deprecated: [0.61.0] Use SetDouble instead.
func (v Value) SetDoubleVal(dv float64) {
v.SetDouble(dv)
}

// Deprecated: [0.61.0] Use SetBool instead.
func (v Value) SetBoolVal(bv bool) {
v.SetBool(bv)
}

// Deprecated: [0.61.0] Use SetEmptyBytes instead.
func (v Value) SetEmptyBytesVal() ByteSlice {
return v.SetEmptyBytes()
}

// Deprecated: [0.61.0] Use SetEmptyMap instead.
func (v Value) SetEmptyMapVal() Map {
return v.SetEmptyMap()
}

// Deprecated: [0.61.0] Use SetEmptySlice instead.
func (v Value) SetEmptySliceVal() Slice {
return v.SetEmptySlice()
}

// CopyTo copies the attribute to a destination.
func (v Value) CopyTo(dest Value) {
destOrig := dest.getOrig()
Expand Down
36 changes: 18 additions & 18 deletions pdata/pcommon/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ func TestValueMap(t *testing.T) {
assert.Equal(t, NewMap(), m1.Map())
assert.Equal(t, 0, m1.Map().Len())

m1.MapVal().PutDouble("double_key", 123)
assert.Equal(t, 1, m1.MapVal().Len())
got, exists := m1.MapVal().Get("double_key")
m1.Map().PutDouble("double_key", 123)
assert.Equal(t, 1, m1.Map().Len())
got, exists := m1.Map().Get("double_key")
assert.True(t, exists)
assert.Equal(t, NewValueDouble(123), got)

// Create a second map.
m2 := m1.MapVal().PutEmptyMap("child_map")
m2 := m1.Map().PutEmptyMap("child_map")
assert.Equal(t, 0, m2.Len())

// Modify the source map that was inserted.
Expand All @@ -92,13 +92,13 @@ func TestValueMap(t *testing.T) {
assert.Equal(t, NewValueStr("somestr"), got)

// Insert the second map as a child. This should perform a deep copy.
assert.EqualValues(t, 2, m1.MapVal().Len())
got, exists = m1.MapVal().Get("double_key")
assert.EqualValues(t, 2, m1.Map().Len())
got, exists = m1.Map().Get("double_key")
assert.True(t, exists)
assert.Equal(t, NewValueDouble(123), got)
got, exists = m1.Map().Get("child_map")
assert.True(t, exists)
assert.Equal(t, m2, got.MapVal())
assert.Equal(t, m2, got.Map())

// Modify the source map m2 that was inserted into m1.
m2.PutStr("key_in_child", "somestr2")
Expand All @@ -108,16 +108,16 @@ func TestValueMap(t *testing.T) {
assert.Equal(t, NewValueStr("somestr2"), got)

// The child map inside m1 should be modified.
childMap, childMapExists := m1.MapVal().Get("child_map")
childMap, childMapExists := m1.Map().Get("child_map")
require.True(t, childMapExists)
got, exists = childMap.Map().Get("key_in_child")
require.True(t, exists)
assert.Equal(t, NewValueStr("somestr2"), got)

// Now modify the inserted map (not the source)
childMap.MapVal().PutStr("key_in_child", "somestr3")
assert.EqualValues(t, 1, childMap.MapVal().Len())
got, exists = childMap.MapVal().Get("key_in_child")
childMap.Map().PutStr("key_in_child", "somestr3")
assert.EqualValues(t, 1, childMap.Map().Len())
got, exists = childMap.Map().Get("key_in_child")
require.True(t, exists)
assert.Equal(t, NewValueStr("somestr3"), got)

Expand Down Expand Up @@ -221,12 +221,12 @@ func TestValueEqual(t *testing.T) {
assert.True(t, av1.Equal(av2))

av2 = NewValueBytes()
av2.BytesVal().FromRaw([]byte{1, 2, 3})
av2.Bytes().FromRaw([]byte{1, 2, 3})
assert.False(t, av1.Equal(av2))
assert.False(t, av2.Equal(av1))

av1 = NewValueBytes()
av1.BytesVal().FromRaw([]byte{1, 2, 4})
av1.Bytes().FromRaw([]byte{1, 2, 4})
assert.False(t, av1.Equal(av2))

av1.Bytes().SetAt(2, 3)
Expand Down Expand Up @@ -362,7 +362,7 @@ func TestMapPutEmptySlice(t *testing.T) {
}, m.AsRaw())
childSliceVal, ok := m.Get("k")
assert.True(t, ok)
childSliceVal.Slice().AppendEmpty().SetEmptySliceVal().AppendEmpty().SetStr("val")
childSliceVal.Slice().AppendEmpty().SetEmptySlice().AppendEmpty().SetStr("val")
assert.EqualValues(t, map[string]interface{}{
"k": []interface{}{[]interface{}{"val"}},
}, m.AsRaw())
Expand Down Expand Up @@ -446,7 +446,7 @@ func TestMapWithEmpty(t *testing.T) {
val, exist = sm.Get("another_key_string")
assert.True(t, exist)
assert.EqualValues(t, ValueTypeStr, val.Type())
assert.EqualValues(t, "another_value", val.StringVal())
assert.EqualValues(t, "another_value", val.Str())

sm.PutInt("another_key_int", 456)
val, exist = sm.Get("another_key_int")
Expand Down Expand Up @@ -1033,7 +1033,7 @@ func TestNewValueFromRaw(t *testing.T) {
input: []byte{1, 2, 3},
expected: func() Value {
m := NewValueBytes()
m.BytesVal().FromRaw([]byte{1, 2, 3})
m.Bytes().FromRaw([]byte{1, 2, 3})
return m
}(),
},
Expand All @@ -1044,7 +1044,7 @@ func TestNewValueFromRaw(t *testing.T) {
},
expected: func() Value {
m := NewValueMap()
m.MapVal().FromRaw(map[string]interface{}{"k": "v"})
m.Map().FromRaw(map[string]interface{}{"k": "v"})
return m
}(),
},
Expand Down Expand Up @@ -1125,6 +1125,6 @@ func generateTestValueSlice() Value {

func generateTestValueBytes() Value {
v := NewValueBytes()
v.BytesVal().FromRaw([]byte("String bytes"))
v.Bytes().FromRaw([]byte("String bytes"))
return v
}
11 changes: 0 additions & 11 deletions pdata/plog/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,6 @@ func (ms Logs) CopyTo(dest Logs) {
ms.ResourceLogs().CopyTo(dest.ResourceLogs())
}

// Clone returns a copy of Logs.
// Deprecated: [0.61.0] Replace with:
//
// newLogs := NewLogs()
// ms.CopyTo(newLogs)
func (ms Logs) Clone() Logs {
cloneLd := NewLogs()
ms.ResourceLogs().CopyTo(cloneLd.ResourceLogs())
return cloneLd
}

// LogRecordCount calculates the total number of log records.
func (ms Logs) LogRecordCount() int {
logCount := 0
Expand Down
6 changes: 0 additions & 6 deletions pdata/plog/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ func TestLogsMoveTo(t *testing.T) {
assert.EqualValues(t, ResourceLogsSlice(internal.GenerateTestResourceLogsSlice()), dest.ResourceLogs())
}

func TestLogsClone(t *testing.T) {
logs := NewLogs()
internal.FillTestResourceLogsSlice(internal.ResourceLogsSlice(logs.ResourceLogs()))
assert.EqualValues(t, logs, logs.Clone())
}

func TestLogsCopyTo(t *testing.T) {
logs := NewLogs()
internal.FillTestResourceLogsSlice(internal.ResourceLogsSlice(logs.ResourceLogs()))
Expand Down
6 changes: 0 additions & 6 deletions pdata/plog/plogotlp/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ type GRPCClient interface {
Export(ctx context.Context, request Request, opts ...grpc.CallOption) (Response, error)
}

// Deprecated: [0.61.0] Use GRPCClient instead
type Client = GRPCClient

type logsClient struct {
rawClient otlpcollectorlog.LogsServiceClient
}
Expand All @@ -152,9 +149,6 @@ type GRPCServer interface {
Export(context.Context, Request) (Response, error)
}

// Deprecated: [0.61.0] Use GRPCServer instead
type Server = GRPCServer

// RegisterGRPCServer registers the Server to the grpc.Server.
func RegisterGRPCServer(s *grpc.Server, srv GRPCServer) {
otlpcollectorlog.RegisterLogsServiceServer(s, &rawLogsServer{srv: srv})
Expand Down
95 changes: 0 additions & 95 deletions pdata/pmetric/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@ func (ms Metrics) CopyTo(dest Metrics) {
ms.ResourceMetrics().CopyTo(dest.ResourceMetrics())
}

// Clone returns a copy of Metrics.
// Deprecated: [0.61.0] Replace with:
//
// newMetrics := NewMetrics()
// ms.CopyTo(newMetrics)
func (ms Metrics) Clone() Metrics {
cloneMd := NewMetrics()
ms.ResourceMetrics().CopyTo(cloneMd.ResourceMetrics())
return cloneMd
}

// MoveTo moves all properties from the current struct to dest
// resetting the current instance to its zero value.
func (ms Metrics) MoveTo(dest Metrics) {
Expand Down Expand Up @@ -109,29 +98,6 @@ func (ms Metrics) DataPointCount() (dataPointCount int) {
return
}

// Deprecated: [v0.61.0] use MetricType.
type MetricDataType = MetricType

const (
// Deprecated: [v0.61.0] use MetricTypeNone.
MetricDataTypeNone = MetricTypeNone
// Deprecated: [v0.61.0] use MetricTypeGauge.
MetricDataTypeGauge = MetricTypeGauge
// Deprecated: [v0.61.0] use MetricTypeSum.
MetricDataTypeSum = MetricTypeSum
// Deprecated: [v0.61.0] use MetricTypeHistogram.
MetricDataTypeHistogram = MetricTypeHistogram
// Deprecated: [v0.61.0] use MetricTypeExponentialHistogram.
MetricDataTypeExponentialHistogram = MetricTypeExponentialHistogram
// Deprecated: [v0.61.0] use MetricTypeSummary.
MetricDataTypeSummary = MetricTypeSummary
)

// Deprecated: [v0.61.0] use Metric.Type().
func (ms Metric) DataType() MetricDataType {
return ms.Type()
}

// MetricType specifies the type of data in a Metric.
type MetricType int32

Expand Down Expand Up @@ -224,64 +190,3 @@ func (nt ExemplarValueType) String() string {
}
return ""
}

// Deprecated: [v0.61.0] not used, will be deleted in next release.
type OptionalType int32

const (
// Deprecated: [v0.61.0] not used, will be deleted in next release.
OptionalTypeNone OptionalType = iota
// Deprecated: [v0.61.0] not used, will be deleted in next release.
OptionalTypeDouble
)

// Deprecated: [v0.61.0] not used, will be deleted in next release.
func (ot OptionalType) String() string {
switch ot {
case OptionalTypeNone:
return "None"
case OptionalTypeDouble:
return "Double"
}
return ""
}

// Deprecated: [v0.61.0] use NumberDataPoint.DoubleValue().
func (ms NumberDataPoint) DoubleVal() float64 {
return ms.DoubleValue()
}

// Deprecated: [v0.61.0] use NumberDataPoint.SetDoubleValue().
func (ms NumberDataPoint) SetDoubleVal(v float64) {
ms.SetDoubleValue(v)
}

// Deprecated: [v0.61.0] use NumberDataPoint.IntValue().
func (ms NumberDataPoint) IntVal() int64 {
return ms.IntValue()
}

// Deprecated: [v0.61.0] use NumberDataPoint.SetIntValue().
func (ms NumberDataPoint) SetIntVal(v int64) {
ms.SetIntValue(v)
}

// Deprecated: [v0.61.0] use Exemplar.DoubleValue().
func (ms Exemplar) DoubleVal() float64 {
return ms.DoubleValue()
}

// Deprecated: [v0.61.0] use Exemplar.SetDoubleValue().
func (ms Exemplar) SetDoubleVal(v float64) {
ms.SetDoubleValue(v)
}

// Deprecated: [v0.61.0] use Exemplar.IntValue().
func (ms Exemplar) IntVal() int64 {
return ms.IntValue()
}

// Deprecated: [v0.61.0] use Exemplar.SetIntValue().
func (ms Exemplar) SetIntVal(v int64) {
ms.SetIntValue(v)
}
Loading