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

[pdata] Extract model/internal/pdata package into model/internal #5162

Merged
merged 1 commit into from
Apr 6, 2022
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
6 changes: 3 additions & 3 deletions model/internal/cmd/pdatagen/internal/base_slices.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ func fillTest${structName}(tv ${structName}) {
}
}`

const commonSliceAliasTemplate = `// ${structName} is an alias for pdata.${structName} struct.
type ${structName} = pdata.${structName}
const commonSliceAliasTemplate = `// ${structName} is an alias for internal.${structName} struct.
type ${structName} = internal.${structName}

// New${structName} is an alias for a function to create ${structName}.
var New${structName} = pdata.New${structName}`
var New${structName} = internal.New${structName}`

const slicePtrTemplate = `// ${structName} logically represents a slice of ${elementName}.
//
Expand Down
6 changes: 3 additions & 3 deletions model/internal/cmd/pdatagen/internal/base_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ const messageValueGenerateTestTemplate = `func generateTest${structName}() ${str
const messageValueFillTestHeaderTemplate = `func fillTest${structName}(tv ${structName}) {`
const messageValueFillTestFooterTemplate = `}`

const messageValueAliasTemplate = `// ${structName} is an alias for pdata.${structName} struct.
type ${structName} = pdata.${structName}
const messageValueAliasTemplate = `// ${structName} is an alias for internal.${structName} struct.
type ${structName} = internal.${structName}

// New${structName} is an alias for a function to create a new empty ${structName}.
var New${structName} = pdata.New${structName}`
var New${structName} = internal.New${structName}`

const newLine = "\n"

Expand Down
17 changes: 13 additions & 4 deletions model/internal/cmd/pdatagen/internal/files.go

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

4 changes: 2 additions & 2 deletions model/internal/cmd/pdatagen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ func check(e error) {

func main() {
for _, fp := range internal.AllFiles {
f, err := os.Create("./model/internal/pdata/generated_" + fp.Name + ".go")
f, err := os.Create("./model/internal/generated_" + fp.Name + ".go")
check(err)
_, err = f.WriteString(fp.GenerateFile())
check(err)
check(f.Close())
f, err = os.Create("./model/internal/pdata/generated_" + fp.Name + "_test.go")
f, err = os.Create("./model/internal/generated_" + fp.Name + "_test.go")
check(err)
_, err = f.WriteString(fp.GenerateTestFile())
check(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata // import "go.opentelemetry.io/collector/model/internal/pdata"
package internal // import "go.opentelemetry.io/collector/model/internal"

// This file contains data structures that are common for all telemetry types,
// such as timestamps, attributes, etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata
package internal

import (
"encoding/base64"
Expand Down

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

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

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

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

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

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

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

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

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

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

2 changes: 1 addition & 1 deletion model/internal/pdata/logs.go → model/internal/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata // import "go.opentelemetry.io/collector/model/internal/pdata"
package internal // import "go.opentelemetry.io/collector/model/internal"

import (
otlplogs "go.opentelemetry.io/collector/model/internal/data/protogen/logs/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata
package internal

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata // import "go.opentelemetry.io/collector/model/internal/pdata"
package internal // import "go.opentelemetry.io/collector/model/internal"

import (
otlpmetrics "go.opentelemetry.io/collector/model/internal/data/protogen/metrics/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata
package internal

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata // import "go.opentelemetry.io/collector/model/internal/pdata"
package internal // import "go.opentelemetry.io/collector/model/internal"

import (
otlplogs "go.opentelemetry.io/collector/model/internal/data/protogen/logs/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata // import "go.opentelemetry.io/collector/model/internal/pdata"
package internal // import "go.opentelemetry.io/collector/model/internal"

import (
"go.opentelemetry.io/collector/model/internal/data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata
package internal

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata // import "go.opentelemetry.io/collector/model/internal/pdata"
package internal // import "go.opentelemetry.io/collector/model/internal"

import (
"time"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata
package internal

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata // import "go.opentelemetry.io/collector/model/internal/pdata"
package internal // import "go.opentelemetry.io/collector/model/internal"

import (
"go.opentelemetry.io/collector/model/internal/data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata
package internal

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata // import "go.opentelemetry.io/collector/model/internal/pdata"
package internal // import "go.opentelemetry.io/collector/model/internal"

import (
otlptrace "go.opentelemetry.io/collector/model/internal/data/protogen/trace/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package pdata
package internal

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion model/otlp/json_marshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/gogo/protobuf/jsonpb"

ipdata "go.opentelemetry.io/collector/model/internal/pdata"
ipdata "go.opentelemetry.io/collector/model/internal"
"go.opentelemetry.io/collector/model/pdata"
)

Expand Down
2 changes: 1 addition & 1 deletion model/otlp/json_unmarshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (

"github.com/gogo/protobuf/jsonpb"

ipdata "go.opentelemetry.io/collector/model/internal"
otlplogs "go.opentelemetry.io/collector/model/internal/data/protogen/logs/v1"
otlpmetrics "go.opentelemetry.io/collector/model/internal/data/protogen/metrics/v1"
otlptrace "go.opentelemetry.io/collector/model/internal/data/protogen/trace/v1"
ipdata "go.opentelemetry.io/collector/model/internal/pdata"
"go.opentelemetry.io/collector/model/otlpgrpc"
"go.opentelemetry.io/collector/model/pdata"
)
Expand Down
2 changes: 1 addition & 1 deletion model/otlp/pb_marshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package otlp // import "go.opentelemetry.io/collector/model/otlp"

import (
ipdata "go.opentelemetry.io/collector/model/internal/pdata"
ipdata "go.opentelemetry.io/collector/model/internal"
"go.opentelemetry.io/collector/model/pdata"
)

Expand Down
2 changes: 1 addition & 1 deletion model/otlp/pb_unmarshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
package otlp // import "go.opentelemetry.io/collector/model/otlp"

import (
ipdata "go.opentelemetry.io/collector/model/internal"
otlplogs "go.opentelemetry.io/collector/model/internal/data/protogen/logs/v1"
otlpmetrics "go.opentelemetry.io/collector/model/internal/data/protogen/metrics/v1"
otlptrace "go.opentelemetry.io/collector/model/internal/data/protogen/trace/v1"
ipdata "go.opentelemetry.io/collector/model/internal/pdata"
"go.opentelemetry.io/collector/model/pdata"
)

Expand Down
2 changes: 1 addition & 1 deletion model/otlpgrpc/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"github.com/gogo/protobuf/jsonpb"
"google.golang.org/grpc"

ipdata "go.opentelemetry.io/collector/model/internal"
otlpcollectorlog "go.opentelemetry.io/collector/model/internal/data/protogen/collector/logs/v1"
v1 "go.opentelemetry.io/collector/model/internal/data/protogen/common/v1"
otlplogs "go.opentelemetry.io/collector/model/internal/data/protogen/logs/v1"
ipdata "go.opentelemetry.io/collector/model/internal/pdata"
"go.opentelemetry.io/collector/model/pdata"
)

Expand Down
2 changes: 1 addition & 1 deletion model/otlpgrpc/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"google.golang.org/grpc/test/bufconn"

v1 "go.opentelemetry.io/collector/model/internal/data/protogen/logs/v1"
"go.opentelemetry.io/collector/model/internal/pdata"
"go.opentelemetry.io/collector/model/pdata"
)

var _ json.Unmarshaler = LogsResponse{}
Expand Down
Loading