Skip to content

Commit

Permalink
Update core dependency and adopt to its API changes (open-telemetry#9231
Browse files Browse the repository at this point in the history
)

Switch from using model/pdata package to the new packages split by signal type
  • Loading branch information
dmitryax committed Apr 13, 2022
1 parent 9470d98 commit 9c214be
Show file tree
Hide file tree
Showing 1,051 changed files with 15,125 additions and 15,774 deletions.
9 changes: 6 additions & 3 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.48.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.48.0
github.com/stretchr/testify v1.7.1
go.opentelemetry.io/collector v0.48.0
go.opentelemetry.io/collector/model v0.48.0
go.opentelemetry.io/collector v0.48.1-0.20220412005140-8eb68f40028d
go.opentelemetry.io/collector/pdata v0.0.0-20220412005140-8eb68f40028d
go.uber.org/multierr v1.8.0
golang.org/x/mod v0.5.1
golang.org/x/text v0.3.7
Expand Down Expand Up @@ -188,7 +188,7 @@ require (
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.15.1 // indirect
github.com/knadh/koanf v1.4.0 // indirect
github.com/knadh/koanf v1.4.1 // indirect
github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b // indirect
github.com/leoluk/perflib_exporter v0.1.0 // indirect
github.com/lib/pq v1.10.5 // indirect
Expand Down Expand Up @@ -440,6 +440,7 @@ require (
go.etcd.io/bbolt v1.3.6 // indirect
go.mongodb.org/atlas v0.15.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/collector/model v0.48.1-0.20220412005140-8eb68f40028d // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.31.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.31.0 // indirect
go.opentelemetry.io/otel v1.6.3 // indirect
Expand Down Expand Up @@ -802,3 +803,5 @@ exclude github.com/StackExchange/wmi v1.2.0

// see https://github.com/distribution/distribution/issues/3590
exclude github.com/docker/distribution v2.8.0+incompatible

replace go.opentelemetry.io/collector/pdata => go.opentelemetry.io/collector/pdata v0.0.0-20220412005140-8eb68f40028d
24 changes: 13 additions & 11 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/configschema/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/model/pdata"
"go.opentelemetry.io/collector/pdata/pmetric"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry"
)
Expand All @@ -38,7 +38,7 @@ func TestPackageDirLocal(t *testing.T) {
}

func TestPackageDirError(t *testing.T) {
pkg := pdata.NewSum()
pkg := pmetric.NewSum()
pkgType := reflect.ValueOf(pkg).Type()
srcRoot := "test/fail"
dr := NewDirResolver(srcRoot, DefaultModule)
Expand Down
11 changes: 6 additions & 5 deletions cmd/mdatagen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,30 @@ 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.48.0
go.opentelemetry.io/collector/model v0.48.0
go.opentelemetry.io/collector v0.48.1-0.20220412005140-8eb68f40028d
go.opentelemetry.io/collector/pdata v0.0.0-00010101000000-000000000000
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/knadh/koanf v1.4.0 // indirect
github.com/knadh/koanf v1.4.1 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)

replace go.opentelemetry.io/collector/pdata => go.opentelemetry.io/collector/pdata v0.0.0-20220412005140-8eb68f40028d
18 changes: 8 additions & 10 deletions cmd/mdatagen/go.sum

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

26 changes: 13 additions & 13 deletions cmd/mdatagen/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/go-playground/validator/v10/non-standard/validators"
en_translations "github.com/go-playground/validator/v10/translations/en"
"go.opentelemetry.io/collector/config/mapprovider/filemapprovider"
"go.opentelemetry.io/collector/model/pdata"
"go.opentelemetry.io/collector/pdata/pcommon"
)

type metricName string
Expand All @@ -52,24 +52,24 @@ func (mn attributeName) RenderUnexported() (string, error) {
// ValueType defines an attribute value type.
type ValueType struct {
// ValueType is type of the metric number, options are "double", "int".
ValueType pdata.ValueType
ValueType pcommon.ValueType
}

// UnmarshalText implements the encoding.TextUnmarshaler interface.
func (mvt *ValueType) UnmarshalText(text []byte) error {
switch vtStr := string(text); vtStr {
case "":
mvt.ValueType = pdata.ValueTypeEmpty
mvt.ValueType = pcommon.ValueTypeEmpty
case "string":
mvt.ValueType = pdata.ValueTypeString
mvt.ValueType = pcommon.ValueTypeString
case "int":
mvt.ValueType = pdata.ValueTypeInt
mvt.ValueType = pcommon.ValueTypeInt
case "double":
mvt.ValueType = pdata.ValueTypeDouble
mvt.ValueType = pcommon.ValueTypeDouble
case "bool":
mvt.ValueType = pdata.ValueTypeDouble
mvt.ValueType = pcommon.ValueTypeDouble
case "bytes":
mvt.ValueType = pdata.ValueTypeDouble
mvt.ValueType = pcommon.ValueTypeDouble
default:
return fmt.Errorf("invalid type: %q", vtStr)
}
Expand All @@ -84,15 +84,15 @@ func (mvt ValueType) String() string {
// Primitive returns name of primitive type for the ValueType.
func (mvt ValueType) Primitive() string {
switch mvt.ValueType {
case pdata.ValueTypeString:
case pcommon.ValueTypeString:
return "string"
case pdata.ValueTypeInt:
case pcommon.ValueTypeInt:
return "int64"
case pdata.ValueTypeDouble:
case pcommon.ValueTypeDouble:
return "float64"
case pdata.ValueTypeBool:
case pcommon.ValueTypeBool:
return "bool"
case pdata.ValueTypeBytes:
case pcommon.ValueTypeBytes:
return "[]byte"
default:
return ""
Expand Down
6 changes: 3 additions & 3 deletions cmd/mdatagen/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/model/pdata"
"go.opentelemetry.io/collector/pdata/pmetric"
)

func Test_loadMetadata(t *testing.T) {
Expand Down Expand Up @@ -53,7 +53,7 @@ func Test_loadMetadata(t *testing.T) {
ExtendedDocumentation: "Additional information on CPU Time can be found [here](https://en.wikipedia.org/wiki/CPU_time).",
Unit: "s",
Sum: &sum{
MetricValueType: MetricValueType{pdata.MetricValueTypeDouble},
MetricValueType: MetricValueType{pmetric.MetricValueTypeDouble},
Aggregated: Aggregated{Aggregation: "cumulative"},
Mono: Mono{Monotonic: true},
},
Expand All @@ -64,7 +64,7 @@ func Test_loadMetadata(t *testing.T) {
Description: "Percentage of CPU time broken down by different states.",
Unit: "1",
Gauge: &gauge{
MetricValueType: MetricValueType{pdata.MetricValueTypeDouble},
MetricValueType: MetricValueType{pmetric.MetricValueTypeDouble},
},
Attributes: []attributeName{"enumAttribute"},
},
Expand Down
Loading

0 comments on commit 9c214be

Please sign in to comment.