Skip to content

Commit

Permalink
Update core dependency and adopt to API changes (#8791)
Browse files Browse the repository at this point in the history
Remove usage of deprecated API:
- `pdata.AttributeMap`
- `pdata.NewAttributeMap`
- `pdata.NewAttributeMapFromMap`
- `pdata.AttributeValueSlice`
- `pdata.NewAttributeValueSlice`

Remove usage of deleted `pdata.InternalRep`
  • Loading branch information
dmitryax authored Mar 23, 2022
1 parent 313873d commit ac8d866
Show file tree
Hide file tree
Showing 489 changed files with 4,118 additions and 4,656 deletions.
4 changes: 2 additions & 2 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib v0.47.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.47.0
github.com/stretchr/testify v1.7.1
go.opentelemetry.io/collector v0.47.1-0.20220321233732-3cec6d3d98d9
go.opentelemetry.io/collector/model v0.47.1-0.20220321233732-3cec6d3d98d9
go.opentelemetry.io/collector v0.47.1-0.20220322153344-4c3b824aca1d
go.opentelemetry.io/collector/model v0.47.1-0.20220322153344-4c3b824aca1d
go.uber.org/multierr v1.8.0
golang.org/x/mod v0.5.1
)
Expand Down
11 changes: 4 additions & 7 deletions cmd/configschema/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/mdatagen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
github.com/go-playground/universal-translator v0.18.0
github.com/go-playground/validator/v10 v10.10.1
github.com/stretchr/testify v1.7.1
go.opentelemetry.io/collector v0.47.1-0.20220316214317-e6ea17cf27a8
go.opentelemetry.io/collector/model v0.47.1-0.20220316214317-e6ea17cf27a8
go.opentelemetry.io/collector v0.47.1-0.20220322153344-4c3b824aca1d
go.opentelemetry.io/collector/model v0.47.1-0.20220322153344-4c3b824aca1d
)

require (
Expand Down
8 changes: 4 additions & 4 deletions cmd/mdatagen/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions exporter/alibabacloudlogserviceexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
github.com/gogo/protobuf v1.3.2
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.47.0
github.com/stretchr/testify v1.7.1
go.opentelemetry.io/collector v0.47.1-0.20220316214317-e6ea17cf27a8
go.opentelemetry.io/collector/model v0.47.1-0.20220316214317-e6ea17cf27a8
go.opentelemetry.io/collector v0.47.1-0.20220322153344-4c3b824aca1d
go.opentelemetry.io/collector/model v0.47.1-0.20220322153344-4c3b824aca1d
go.uber.org/zap v1.21.0
)

Expand All @@ -30,9 +30,9 @@ require (
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/spf13/cast v1.4.1 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/otel v1.4.1 // indirect
go.opentelemetry.io/otel v1.5.0 // indirect
go.opentelemetry.io/otel/metric v0.27.0 // indirect
go.opentelemetry.io/otel/trace v1.4.1 // indirect
go.opentelemetry.io/otel/trace v1.5.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
Expand Down
20 changes: 10 additions & 10 deletions exporter/alibabacloudlogserviceexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ func fillHTTPServerSpan(span pdata.Span) {
status.SetMessage("something error")
}

func constructSpanAttributes(attributes map[string]interface{}) pdata.AttributeMap {
attrs := pdata.NewAttributeMap()
func constructSpanAttributes(attributes map[string]interface{}) pdata.Map {
attrs := pdata.NewMap()
for key, value := range attributes {
if cast, ok := value.(int); ok {
attrs.InsertInt(key, int64(cast))
Expand Down
2 changes: 1 addition & 1 deletion exporter/awscloudwatchlogsexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func logToCWLog(resourceAttrs map[string]interface{}, log pdata.LogRecord) (*clo
}, nil
}

func attrsValue(attrs pdata.AttributeMap) map[string]interface{} {
func attrsValue(attrs pdata.Map) map[string]interface{} {
if attrs.Len() == 0 {
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions exporter/awscloudwatchlogsexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.47.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.47.0
github.com/stretchr/testify v1.7.1
go.opentelemetry.io/collector v0.47.1-0.20220316214317-e6ea17cf27a8
go.opentelemetry.io/collector/model v0.47.1-0.20220316214317-e6ea17cf27a8
go.opentelemetry.io/collector v0.47.1-0.20220322153344-4c3b824aca1d
go.opentelemetry.io/collector/model v0.47.1-0.20220322153344-4c3b824aca1d
go.uber.org/zap v1.21.0
)

Expand All @@ -28,9 +28,9 @@ require (
github.com/spf13/cast v1.4.1 // indirect
github.com/stretchr/objx v0.1.1 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/otel v1.4.1 // indirect
go.opentelemetry.io/otel v1.5.0 // indirect
go.opentelemetry.io/otel/metric v0.27.0 // indirect
go.opentelemetry.io/otel/trace v1.4.1 // indirect
go.opentelemetry.io/otel/trace v1.5.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
Expand Down
20 changes: 10 additions & 10 deletions exporter/awscloudwatchlogsexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exporter/awsemfexporter/datapoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (dps summaryDataPointSlice) At(i int) (dataPoint, bool) {

// createLabels converts OTel AttributesMap attributes to a map
// and optionally adds in the OTel instrumentation library name
func createLabels(attributes pdata.AttributeMap, instrLibName string) map[string]string {
func createLabels(attributes pdata.Map, instrLibName string) map[string]string {
labels := make(map[string]string, attributes.Len()+1)
attributes.Range(func(k string, v pdata.Value) bool {
labels[k] = v.AsString()
Expand Down
26 changes: 13 additions & 13 deletions exporter/awsemfexporter/datapoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func TestIntDataPointSliceAt(t *testing.T) {
setupDataPointCache()

instrLibName := "cloudwatch-otel"
labels := map[string]pdata.Value{"label": pdata.NewValueString("value")}
labels := map[string]interface{}{"label": "value"}

testDeltaCases := []struct {
testName string
Expand Down Expand Up @@ -296,7 +296,7 @@ func TestIntDataPointSliceAt(t *testing.T) {
testDPS := pdata.NewNumberDataPointSlice()
testDP := testDPS.AppendEmpty()
testDP.SetIntVal(tc.value.(int64))
pdata.NewAttributeMapFromMap(labels).CopyTo(testDP.Attributes())
pdata.NewMapFromRaw(labels).CopyTo(testDP.Attributes())

dps := numberDataPointSlice{
instrLibName,
Expand Down Expand Up @@ -334,7 +334,7 @@ func TestDoubleDataPointSliceAt(t *testing.T) {
setupDataPointCache()

instrLibName := "cloudwatch-otel"
labels := map[string]pdata.Value{"label1": pdata.NewValueString("value1")}
labels := map[string]interface{}{"label1": "value1"}

testDeltaCases := []struct {
testName string
Expand Down Expand Up @@ -367,7 +367,7 @@ func TestDoubleDataPointSliceAt(t *testing.T) {
testDPS := pdata.NewNumberDataPointSlice()
testDP := testDPS.AppendEmpty()
testDP.SetDoubleVal(tc.value.(float64))
pdata.NewAttributeMapFromMap(labels).CopyTo(testDP.Attributes())
pdata.NewMapFromRaw(labels).CopyTo(testDP.Attributes())

dps := numberDataPointSlice{
instrLibName,
Expand All @@ -394,15 +394,15 @@ func TestDoubleDataPointSliceAt(t *testing.T) {

func TestHistogramDataPointSliceAt(t *testing.T) {
instrLibName := "cloudwatch-otel"
labels := map[string]pdata.Value{"label1": pdata.NewValueString("value1")}
labels := map[string]interface{}{"label1": "value1"}

testDPS := pdata.NewHistogramDataPointSlice()
testDP := testDPS.AppendEmpty()
testDP.SetCount(uint64(17))
testDP.SetSum(17.13)
testDP.SetBucketCounts([]uint64{1, 2, 3})
testDP.SetExplicitBounds([]float64{1, 2, 3})
pdata.NewAttributeMapFromMap(labels).CopyTo(testDP.Attributes())
pdata.NewMapFromRaw(labels).CopyTo(testDP.Attributes())

dps := histogramDataPointSlice{
instrLibName,
Expand All @@ -429,7 +429,7 @@ func TestSummaryDataPointSliceAt(t *testing.T) {
setupDataPointCache()

instrLibName := "cloudwatch-otel"
labels := map[string]pdata.Value{"label1": pdata.NewValueString("value1")}
labels := map[string]interface{}{"label1": "value1"}
metadataTimeStamp := time.Now().UnixNano() / int64(time.Millisecond)

testCases := []struct {
Expand Down Expand Up @@ -468,7 +468,7 @@ func TestSummaryDataPointSliceAt(t *testing.T) {
testQuantileValue = testDP.QuantileValues().AppendEmpty()
testQuantileValue.SetQuantile(100)
testQuantileValue.SetValue(float64(5))
pdata.NewAttributeMapFromMap(labels).CopyTo(testDP.Attributes())
pdata.NewMapFromRaw(labels).CopyTo(testDP.Attributes())

dps := summaryDataPointSlice{
instrLibName,
Expand Down Expand Up @@ -518,10 +518,10 @@ func TestCreateLabels(t *testing.T) {
"b": "B",
"c": "C",
}
labelsMap := pdata.NewAttributeMapFromMap(map[string]pdata.Value{
"a": pdata.NewValueString("A"),
"b": pdata.NewValueString("B"),
"c": pdata.NewValueString("C"),
labelsMap := pdata.NewMapFromRaw(map[string]interface{}{
"a": "A",
"b": "B",
"c": "C",
})

labels := createLabels(labelsMap, noInstrumentationLibraryName)
Expand Down Expand Up @@ -646,7 +646,7 @@ func TestGetDataPoints(t *testing.T) {

logger := zap.NewNop()

expectedAttributes := pdata.NewAttributeMapFromMap(map[string]pdata.Value{"label1": pdata.NewValueString("value1")})
expectedAttributes := pdata.NewMapFromRaw(map[string]interface{}{"label1": "value1"})

t.Run(tc.testName, func(t *testing.T) {
setupDataPointCache()
Expand Down
4 changes: 2 additions & 2 deletions exporter/awsemfexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.47.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/opencensus v0.47.0
github.com/stretchr/testify v1.7.1
go.opentelemetry.io/collector v0.47.1-0.20220316214317-e6ea17cf27a8
go.opentelemetry.io/collector/model v0.47.1-0.20220316214317-e6ea17cf27a8
go.opentelemetry.io/collector v0.47.1-0.20220322153344-4c3b824aca1d
go.opentelemetry.io/collector/model v0.47.1-0.20220322153344-4c3b824aca1d
go.uber.org/zap v1.21.0
google.golang.org/protobuf v1.27.1
)
Expand Down
Loading

0 comments on commit ac8d866

Please sign in to comment.