Generate Export[Logs|Metrics|Traces]PartialSuccess, plugin into the Response (#6361)
Signed-off-by: Bogdan <bogdandrutu@gmail.com> Signed-off-by: Bogdan <bogdandrutu@gmail.com>
This commit is contained in:
parent
73ee7ead1a
commit
2758d1a7a2
|
|
@ -0,0 +1,11 @@
|
|||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
|
||||
change_type: enhancement
|
||||
|
||||
# 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: Introduce partial success fields in ExportServiceResponse.
|
||||
|
||||
# One or more tracking issues or pull requests related to the change
|
||||
issues: [5815, 5816]
|
||||
|
|
@ -41,14 +41,18 @@ const header = `// Copyright The OpenTelemetry Authors
|
|||
var AllFiles = []*File{
|
||||
commonFile,
|
||||
metricsFile,
|
||||
metricsOtlpFile,
|
||||
resourceFile,
|
||||
primitiveSliceFile,
|
||||
traceFile,
|
||||
traceOtlpFile,
|
||||
logFile,
|
||||
logOtlpFile,
|
||||
}
|
||||
|
||||
// File represents the struct for one generated file.
|
||||
type File struct {
|
||||
Path string
|
||||
Name string
|
||||
PackageName string
|
||||
imports []string
|
||||
|
|
@ -82,7 +86,7 @@ func (f *File) GenerateFile() error {
|
|||
|
||||
// ignore gosec complain about permissions being `0644`.
|
||||
//nolint:gosec
|
||||
return os.WriteFile(filepath.Join("pdata", f.PackageName, generateFileName(f.Name)), sb.Bytes(), 0644)
|
||||
return os.WriteFile(filepath.Join(f.Path, f.PackageName, generateFileName(f.Name)), sb.Bytes(), 0644)
|
||||
}
|
||||
|
||||
// GenerateTestFile generates tests for the configured data structures for this File.
|
||||
|
|
@ -109,7 +113,7 @@ func (f *File) GenerateTestFile() error {
|
|||
|
||||
// ignore gosec complain about permissions being `0644`.
|
||||
//nolint:gosec
|
||||
return os.WriteFile(filepath.Join("pdata", f.PackageName, generateTestFileName(f.Name)), sb.Bytes(), 0644)
|
||||
return os.WriteFile(filepath.Join(f.Path, f.PackageName, generateTestFileName(f.Name)), sb.Bytes(), 0644)
|
||||
}
|
||||
|
||||
// GenerateInternalFile generates the internal pdata structures for this File.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
|
||||
|
||||
var commonFile = &File{
|
||||
Path: "pdata",
|
||||
Name: "common",
|
||||
PackageName: "pcommon",
|
||||
imports: []string{
|
||||
|
|
@ -15,11 +15,13 @@
|
|||
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
|
||||
|
||||
var logFile = &File{
|
||||
Path: "pdata",
|
||||
Name: "logs",
|
||||
PackageName: "plog",
|
||||
imports: []string{
|
||||
`"sort"`,
|
||||
``,
|
||||
`"go.opentelemetry.io/collector/pdata/internal"`,
|
||||
`otlplogs "go.opentelemetry.io/collector/pdata/internal/data/protogen/logs/v1"`,
|
||||
},
|
||||
testImports: []string{
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
|
||||
import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
var logOtlpFile = &File{
|
||||
Path: filepath.Join("pdata", "plog"),
|
||||
Name: "logs_otlp",
|
||||
PackageName: "plogotlp",
|
||||
imports: []string{
|
||||
`"sort"`,
|
||||
``,
|
||||
`"go.opentelemetry.io/collector/pdata/internal"`,
|
||||
`otlpcollectorlog "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/logs/v1"`,
|
||||
},
|
||||
testImports: []string{
|
||||
`"testing"`,
|
||||
``,
|
||||
`"github.com/stretchr/testify/assert"`,
|
||||
``,
|
||||
`"go.opentelemetry.io/collector/pdata/internal"`,
|
||||
`otlpcollectorlog "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/logs/v1"`,
|
||||
},
|
||||
structs: []baseStruct{
|
||||
exportLogsPartialSuccess,
|
||||
},
|
||||
}
|
||||
|
||||
var exportLogsPartialSuccess = &messageValueStruct{
|
||||
structName: "ExportLogsPartialSuccess",
|
||||
description: "// ExportLogsPartialSuccess represents the details of a partially successful export request.",
|
||||
originFullName: "otlpcollectorlog.ExportLogsPartialSuccess",
|
||||
fields: []baseField{
|
||||
&primitiveField{
|
||||
fieldName: "RejectedLogRecords",
|
||||
returnType: "int64",
|
||||
defaultVal: `int64(0)`,
|
||||
testVal: `int64(13)`,
|
||||
},
|
||||
&primitiveField{
|
||||
fieldName: "ErrorMessage",
|
||||
returnType: "string",
|
||||
defaultVal: `""`,
|
||||
testVal: `"error message"`,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -15,11 +15,13 @@
|
|||
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
|
||||
|
||||
var metricsFile = &File{
|
||||
Path: "pdata",
|
||||
Name: "metrics",
|
||||
PackageName: "pmetric",
|
||||
imports: []string{
|
||||
`"sort"`,
|
||||
``,
|
||||
`"go.opentelemetry.io/collector/pdata/internal"`,
|
||||
`otlpmetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/metrics/v1"`,
|
||||
},
|
||||
testImports: []string{
|
||||
|
|
@ -28,7 +30,6 @@ var metricsFile = &File{
|
|||
`"github.com/stretchr/testify/assert"`,
|
||||
``,
|
||||
`"go.opentelemetry.io/collector/pdata/internal"`,
|
||||
`"go.opentelemetry.io/collector/pdata/internal/data"`,
|
||||
`otlpmetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/metrics/v1"`,
|
||||
`"go.opentelemetry.io/collector/pdata/pcommon"`,
|
||||
},
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
var metricsOtlpFile = &File{
|
||||
Path: filepath.Join("pdata", "pmetric"),
|
||||
Name: "metrics_otlp",
|
||||
PackageName: "pmetricotlp",
|
||||
imports: []string{
|
||||
`"sort"`,
|
||||
``,
|
||||
`"go.opentelemetry.io/collector/pdata/internal"`,
|
||||
`otlpcollectormetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/metrics/v1"`,
|
||||
},
|
||||
testImports: []string{
|
||||
`"testing"`,
|
||||
``,
|
||||
`"github.com/stretchr/testify/assert"`,
|
||||
``,
|
||||
`"go.opentelemetry.io/collector/pdata/internal"`,
|
||||
`otlpcollectormetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/metrics/v1"`,
|
||||
},
|
||||
structs: []baseStruct{
|
||||
exportMetricsPartialSuccess,
|
||||
},
|
||||
}
|
||||
|
||||
var exportMetricsPartialSuccess = &messageValueStruct{
|
||||
structName: "ExportMetricsPartialSuccess",
|
||||
description: "// ExportMetricsPartialSuccess represents the details of a partially successful export request.",
|
||||
originFullName: "otlpcollectormetrics.ExportMetricsPartialSuccess",
|
||||
fields: []baseField{
|
||||
&primitiveField{
|
||||
fieldName: "RejectedDataPoints",
|
||||
returnType: "int64",
|
||||
defaultVal: `int64(0)`,
|
||||
testVal: `int64(13)`,
|
||||
},
|
||||
&primitiveField{
|
||||
fieldName: "ErrorMessage",
|
||||
returnType: "string",
|
||||
defaultVal: `""`,
|
||||
testVal: `"error message"`,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -223,6 +223,7 @@ func (iss *primitiveSliceStruct) generateInternal(sb *bytes.Buffer) {
|
|||
}
|
||||
|
||||
var primitiveSliceFile = &File{
|
||||
Path: "pdata",
|
||||
Name: "primitive_slice",
|
||||
PackageName: "pcommon",
|
||||
testImports: []string{
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
|
||||
|
||||
var traceFile = &File{
|
||||
Path: "pdata",
|
||||
Name: "traces",
|
||||
PackageName: "ptrace",
|
||||
imports: []string{
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
var traceOtlpFile = &File{
|
||||
Path: filepath.Join("pdata", "ptrace"),
|
||||
Name: "traces_otlp",
|
||||
PackageName: "ptraceotlp",
|
||||
imports: []string{
|
||||
`"sort"`,
|
||||
``,
|
||||
`"go.opentelemetry.io/collector/pdata/internal"`,
|
||||
`otlpcollectortrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/trace/v1"`,
|
||||
},
|
||||
testImports: []string{
|
||||
`"testing"`,
|
||||
``,
|
||||
`"github.com/stretchr/testify/assert"`,
|
||||
``,
|
||||
`"go.opentelemetry.io/collector/pdata/internal"`,
|
||||
`otlpcollectortrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/trace/v1"`,
|
||||
},
|
||||
structs: []baseStruct{
|
||||
exportTracePartialSuccess,
|
||||
},
|
||||
}
|
||||
|
||||
var exportTracePartialSuccess = &messageValueStruct{
|
||||
structName: "ExportTracePartialSuccess",
|
||||
description: "// ExportTracePartialSuccess represents the details of a partially successful export request.",
|
||||
originFullName: "otlpcollectortrace.ExportTracePartialSuccess",
|
||||
fields: []baseField{
|
||||
&primitiveField{
|
||||
fieldName: "RejectedSpans",
|
||||
returnType: "int64",
|
||||
defaultVal: `int64(0)`,
|
||||
testVal: `int64(13)`,
|
||||
},
|
||||
&primitiveField{
|
||||
fieldName: "ErrorMessage",
|
||||
returnType: "string",
|
||||
defaultVal: `""`,
|
||||
testVal: `"error message"`,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
package internal // import "go.opentelemetry.io/collector/pdata/internal/cmd/pdatagen/internal"
|
||||
|
||||
var resourceFile = &File{
|
||||
Path: "pdata",
|
||||
Name: "resource",
|
||||
PackageName: "pcommon",
|
||||
imports: []string{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT.
|
||||
// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
otlpcollectorlog "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/logs/v1"
|
||||
)
|
||||
|
||||
type ExportLogsPartialSuccess struct {
|
||||
orig *otlpcollectorlog.ExportLogsPartialSuccess
|
||||
}
|
||||
|
||||
func GetOrigExportLogsPartialSuccess(ms ExportLogsPartialSuccess) *otlpcollectorlog.ExportLogsPartialSuccess {
|
||||
return ms.orig
|
||||
}
|
||||
|
||||
func NewExportLogsPartialSuccess(orig *otlpcollectorlog.ExportLogsPartialSuccess) ExportLogsPartialSuccess {
|
||||
return ExportLogsPartialSuccess{orig: orig}
|
||||
}
|
||||
|
||||
func GenerateTestExportLogsPartialSuccess() ExportLogsPartialSuccess {
|
||||
orig := otlpcollectorlog.ExportLogsPartialSuccess{}
|
||||
tv := NewExportLogsPartialSuccess(&orig)
|
||||
FillTestExportLogsPartialSuccess(tv)
|
||||
return tv
|
||||
}
|
||||
|
||||
func FillTestExportLogsPartialSuccess(tv ExportLogsPartialSuccess) {
|
||||
tv.orig.RejectedLogRecords = int64(13)
|
||||
tv.orig.ErrorMessage = "error message"
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT.
|
||||
// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
otlpcollectormetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/metrics/v1"
|
||||
)
|
||||
|
||||
type ExportMetricsPartialSuccess struct {
|
||||
orig *otlpcollectormetrics.ExportMetricsPartialSuccess
|
||||
}
|
||||
|
||||
func GetOrigExportMetricsPartialSuccess(ms ExportMetricsPartialSuccess) *otlpcollectormetrics.ExportMetricsPartialSuccess {
|
||||
return ms.orig
|
||||
}
|
||||
|
||||
func NewExportMetricsPartialSuccess(orig *otlpcollectormetrics.ExportMetricsPartialSuccess) ExportMetricsPartialSuccess {
|
||||
return ExportMetricsPartialSuccess{orig: orig}
|
||||
}
|
||||
|
||||
func GenerateTestExportMetricsPartialSuccess() ExportMetricsPartialSuccess {
|
||||
orig := otlpcollectormetrics.ExportMetricsPartialSuccess{}
|
||||
tv := NewExportMetricsPartialSuccess(&orig)
|
||||
FillTestExportMetricsPartialSuccess(tv)
|
||||
return tv
|
||||
}
|
||||
|
||||
func FillTestExportMetricsPartialSuccess(tv ExportMetricsPartialSuccess) {
|
||||
tv.orig.RejectedDataPoints = int64(13)
|
||||
tv.orig.ErrorMessage = "error message"
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT.
|
||||
// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
otlpcollectortrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/trace/v1"
|
||||
)
|
||||
|
||||
type ExportTracePartialSuccess struct {
|
||||
orig *otlpcollectortrace.ExportTracePartialSuccess
|
||||
}
|
||||
|
||||
func GetOrigExportTracePartialSuccess(ms ExportTracePartialSuccess) *otlpcollectortrace.ExportTracePartialSuccess {
|
||||
return ms.orig
|
||||
}
|
||||
|
||||
func NewExportTracePartialSuccess(orig *otlpcollectortrace.ExportTracePartialSuccess) ExportTracePartialSuccess {
|
||||
return ExportTracePartialSuccess{orig: orig}
|
||||
}
|
||||
|
||||
func GenerateTestExportTracePartialSuccess() ExportTracePartialSuccess {
|
||||
orig := otlpcollectortrace.ExportTracePartialSuccess{}
|
||||
tv := NewExportTracePartialSuccess(&orig)
|
||||
FillTestExportTracePartialSuccess(tv)
|
||||
return tv
|
||||
}
|
||||
|
||||
func FillTestExportTracePartialSuccess(tv ExportTracePartialSuccess) {
|
||||
tv.orig.RejectedSpans = int64(13)
|
||||
tv.orig.ErrorMessage = "error message"
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT.
|
||||
// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".
|
||||
|
||||
package plogotlp
|
||||
|
||||
import (
|
||||
"go.opentelemetry.io/collector/pdata/internal"
|
||||
otlpcollectorlog "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/logs/v1"
|
||||
)
|
||||
|
||||
// ExportLogsPartialSuccess represents the details of a partially successful export request.
|
||||
//
|
||||
// This is a reference type, if passed by value and callee modifies it the
|
||||
// caller will see the modification.
|
||||
//
|
||||
// Must use NewExportLogsPartialSuccess function to create new instances.
|
||||
// Important: zero-initialized instance is not valid for use.
|
||||
|
||||
type ExportLogsPartialSuccess internal.ExportLogsPartialSuccess
|
||||
|
||||
func newExportLogsPartialSuccess(orig *otlpcollectorlog.ExportLogsPartialSuccess) ExportLogsPartialSuccess {
|
||||
return ExportLogsPartialSuccess(internal.NewExportLogsPartialSuccess(orig))
|
||||
}
|
||||
|
||||
func (ms ExportLogsPartialSuccess) getOrig() *otlpcollectorlog.ExportLogsPartialSuccess {
|
||||
return internal.GetOrigExportLogsPartialSuccess(internal.ExportLogsPartialSuccess(ms))
|
||||
}
|
||||
|
||||
// NewExportLogsPartialSuccess creates a new empty ExportLogsPartialSuccess.
|
||||
//
|
||||
// This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
|
||||
// OR directly access the member if this is embedded in another struct.
|
||||
func NewExportLogsPartialSuccess() ExportLogsPartialSuccess {
|
||||
return newExportLogsPartialSuccess(&otlpcollectorlog.ExportLogsPartialSuccess{})
|
||||
}
|
||||
|
||||
// MoveTo moves all properties from the current struct overriding the destination and
|
||||
// resetting the current instance to its zero value
|
||||
func (ms ExportLogsPartialSuccess) MoveTo(dest ExportLogsPartialSuccess) {
|
||||
*dest.getOrig() = *ms.getOrig()
|
||||
*ms.getOrig() = otlpcollectorlog.ExportLogsPartialSuccess{}
|
||||
}
|
||||
|
||||
// RejectedLogRecords returns the rejectedlogrecords associated with this ExportLogsPartialSuccess.
|
||||
func (ms ExportLogsPartialSuccess) RejectedLogRecords() int64 {
|
||||
return ms.getOrig().RejectedLogRecords
|
||||
}
|
||||
|
||||
// SetRejectedLogRecords replaces the rejectedlogrecords associated with this ExportLogsPartialSuccess.
|
||||
func (ms ExportLogsPartialSuccess) SetRejectedLogRecords(v int64) {
|
||||
ms.getOrig().RejectedLogRecords = v
|
||||
}
|
||||
|
||||
// ErrorMessage returns the errormessage associated with this ExportLogsPartialSuccess.
|
||||
func (ms ExportLogsPartialSuccess) ErrorMessage() string {
|
||||
return ms.getOrig().ErrorMessage
|
||||
}
|
||||
|
||||
// SetErrorMessage replaces the errormessage associated with this ExportLogsPartialSuccess.
|
||||
func (ms ExportLogsPartialSuccess) SetErrorMessage(v string) {
|
||||
ms.getOrig().ErrorMessage = v
|
||||
}
|
||||
|
||||
// CopyTo copies all properties from the current struct overriding the destination.
|
||||
func (ms ExportLogsPartialSuccess) CopyTo(dest ExportLogsPartialSuccess) {
|
||||
dest.SetRejectedLogRecords(ms.RejectedLogRecords())
|
||||
dest.SetErrorMessage(ms.ErrorMessage())
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT.
|
||||
// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".
|
||||
|
||||
package plogotlp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"go.opentelemetry.io/collector/pdata/internal"
|
||||
)
|
||||
|
||||
func TestExportLogsPartialSuccess_MoveTo(t *testing.T) {
|
||||
ms := ExportLogsPartialSuccess(internal.GenerateTestExportLogsPartialSuccess())
|
||||
dest := NewExportLogsPartialSuccess()
|
||||
ms.MoveTo(dest)
|
||||
assert.Equal(t, NewExportLogsPartialSuccess(), ms)
|
||||
assert.Equal(t, ExportLogsPartialSuccess(internal.GenerateTestExportLogsPartialSuccess()), dest)
|
||||
}
|
||||
|
||||
func TestExportLogsPartialSuccess_CopyTo(t *testing.T) {
|
||||
ms := NewExportLogsPartialSuccess()
|
||||
orig := NewExportLogsPartialSuccess()
|
||||
orig.CopyTo(ms)
|
||||
assert.Equal(t, orig, ms)
|
||||
orig = ExportLogsPartialSuccess(internal.GenerateTestExportLogsPartialSuccess())
|
||||
orig.CopyTo(ms)
|
||||
assert.Equal(t, orig, ms)
|
||||
}
|
||||
|
||||
func TestExportLogsPartialSuccess_RejectedLogRecords(t *testing.T) {
|
||||
ms := NewExportLogsPartialSuccess()
|
||||
assert.Equal(t, int64(0), ms.RejectedLogRecords())
|
||||
ms.SetRejectedLogRecords(int64(13))
|
||||
assert.Equal(t, int64(13), ms.RejectedLogRecords())
|
||||
}
|
||||
|
||||
func TestExportLogsPartialSuccess_ErrorMessage(t *testing.T) {
|
||||
ms := NewExportLogsPartialSuccess()
|
||||
assert.Equal(t, "", ms.ErrorMessage())
|
||||
ms.SetErrorMessage("error message")
|
||||
assert.Equal(t, "error message", ms.ErrorMessage())
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ package plogotlp // import "go.opentelemetry.io/collector/pdata/plog/plogotlp"
|
|||
import (
|
||||
"bytes"
|
||||
|
||||
"go.opentelemetry.io/collector/pdata/internal"
|
||||
otlpcollectorlog "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/logs/v1"
|
||||
"go.opentelemetry.io/collector/pdata/plog/internal/plogjson"
|
||||
)
|
||||
|
|
@ -53,3 +54,8 @@ func (lr Response) MarshalJSON() ([]byte, error) {
|
|||
func (lr Response) UnmarshalJSON(data []byte) error {
|
||||
return plogjson.UnmarshalExportLogsServiceResponse(data, lr.orig)
|
||||
}
|
||||
|
||||
// PartialSuccess returns the ExportLogsPartialSuccess associated with this Response.
|
||||
func (lr Response) PartialSuccess() ExportLogsPartialSuccess {
|
||||
return ExportLogsPartialSuccess(internal.NewExportLogsPartialSuccess(&lr.orig.PartialSuccess))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT.
|
||||
// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".
|
||||
|
||||
package pmetricotlp
|
||||
|
||||
import (
|
||||
"go.opentelemetry.io/collector/pdata/internal"
|
||||
otlpcollectormetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/metrics/v1"
|
||||
)
|
||||
|
||||
// ExportMetricsPartialSuccess represents the details of a partially successful export request.
|
||||
//
|
||||
// This is a reference type, if passed by value and callee modifies it the
|
||||
// caller will see the modification.
|
||||
//
|
||||
// Must use NewExportMetricsPartialSuccess function to create new instances.
|
||||
// Important: zero-initialized instance is not valid for use.
|
||||
|
||||
type ExportMetricsPartialSuccess internal.ExportMetricsPartialSuccess
|
||||
|
||||
func newExportMetricsPartialSuccess(orig *otlpcollectormetrics.ExportMetricsPartialSuccess) ExportMetricsPartialSuccess {
|
||||
return ExportMetricsPartialSuccess(internal.NewExportMetricsPartialSuccess(orig))
|
||||
}
|
||||
|
||||
func (ms ExportMetricsPartialSuccess) getOrig() *otlpcollectormetrics.ExportMetricsPartialSuccess {
|
||||
return internal.GetOrigExportMetricsPartialSuccess(internal.ExportMetricsPartialSuccess(ms))
|
||||
}
|
||||
|
||||
// NewExportMetricsPartialSuccess creates a new empty ExportMetricsPartialSuccess.
|
||||
//
|
||||
// This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
|
||||
// OR directly access the member if this is embedded in another struct.
|
||||
func NewExportMetricsPartialSuccess() ExportMetricsPartialSuccess {
|
||||
return newExportMetricsPartialSuccess(&otlpcollectormetrics.ExportMetricsPartialSuccess{})
|
||||
}
|
||||
|
||||
// MoveTo moves all properties from the current struct overriding the destination and
|
||||
// resetting the current instance to its zero value
|
||||
func (ms ExportMetricsPartialSuccess) MoveTo(dest ExportMetricsPartialSuccess) {
|
||||
*dest.getOrig() = *ms.getOrig()
|
||||
*ms.getOrig() = otlpcollectormetrics.ExportMetricsPartialSuccess{}
|
||||
}
|
||||
|
||||
// RejectedDataPoints returns the rejecteddatapoints associated with this ExportMetricsPartialSuccess.
|
||||
func (ms ExportMetricsPartialSuccess) RejectedDataPoints() int64 {
|
||||
return ms.getOrig().RejectedDataPoints
|
||||
}
|
||||
|
||||
// SetRejectedDataPoints replaces the rejecteddatapoints associated with this ExportMetricsPartialSuccess.
|
||||
func (ms ExportMetricsPartialSuccess) SetRejectedDataPoints(v int64) {
|
||||
ms.getOrig().RejectedDataPoints = v
|
||||
}
|
||||
|
||||
// ErrorMessage returns the errormessage associated with this ExportMetricsPartialSuccess.
|
||||
func (ms ExportMetricsPartialSuccess) ErrorMessage() string {
|
||||
return ms.getOrig().ErrorMessage
|
||||
}
|
||||
|
||||
// SetErrorMessage replaces the errormessage associated with this ExportMetricsPartialSuccess.
|
||||
func (ms ExportMetricsPartialSuccess) SetErrorMessage(v string) {
|
||||
ms.getOrig().ErrorMessage = v
|
||||
}
|
||||
|
||||
// CopyTo copies all properties from the current struct overriding the destination.
|
||||
func (ms ExportMetricsPartialSuccess) CopyTo(dest ExportMetricsPartialSuccess) {
|
||||
dest.SetRejectedDataPoints(ms.RejectedDataPoints())
|
||||
dest.SetErrorMessage(ms.ErrorMessage())
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT.
|
||||
// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".
|
||||
|
||||
package pmetricotlp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"go.opentelemetry.io/collector/pdata/internal"
|
||||
)
|
||||
|
||||
func TestExportMetricsPartialSuccess_MoveTo(t *testing.T) {
|
||||
ms := ExportMetricsPartialSuccess(internal.GenerateTestExportMetricsPartialSuccess())
|
||||
dest := NewExportMetricsPartialSuccess()
|
||||
ms.MoveTo(dest)
|
||||
assert.Equal(t, NewExportMetricsPartialSuccess(), ms)
|
||||
assert.Equal(t, ExportMetricsPartialSuccess(internal.GenerateTestExportMetricsPartialSuccess()), dest)
|
||||
}
|
||||
|
||||
func TestExportMetricsPartialSuccess_CopyTo(t *testing.T) {
|
||||
ms := NewExportMetricsPartialSuccess()
|
||||
orig := NewExportMetricsPartialSuccess()
|
||||
orig.CopyTo(ms)
|
||||
assert.Equal(t, orig, ms)
|
||||
orig = ExportMetricsPartialSuccess(internal.GenerateTestExportMetricsPartialSuccess())
|
||||
orig.CopyTo(ms)
|
||||
assert.Equal(t, orig, ms)
|
||||
}
|
||||
|
||||
func TestExportMetricsPartialSuccess_RejectedDataPoints(t *testing.T) {
|
||||
ms := NewExportMetricsPartialSuccess()
|
||||
assert.Equal(t, int64(0), ms.RejectedDataPoints())
|
||||
ms.SetRejectedDataPoints(int64(13))
|
||||
assert.Equal(t, int64(13), ms.RejectedDataPoints())
|
||||
}
|
||||
|
||||
func TestExportMetricsPartialSuccess_ErrorMessage(t *testing.T) {
|
||||
ms := NewExportMetricsPartialSuccess()
|
||||
assert.Equal(t, "", ms.ErrorMessage())
|
||||
ms.SetErrorMessage("error message")
|
||||
assert.Equal(t, "error message", ms.ErrorMessage())
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ package pmetricotlp // import "go.opentelemetry.io/collector/pdata/pmetric/pmetr
|
|||
import (
|
||||
"bytes"
|
||||
|
||||
"go.opentelemetry.io/collector/pdata/internal"
|
||||
otlpcollectormetrics "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/metrics/v1"
|
||||
"go.opentelemetry.io/collector/pdata/pmetric/internal/pmetricjson"
|
||||
)
|
||||
|
|
@ -53,3 +54,8 @@ func (mr Response) MarshalJSON() ([]byte, error) {
|
|||
func (mr Response) UnmarshalJSON(data []byte) error {
|
||||
return pmetricjson.UnmarshalExportMetricsServiceResponse(data, mr.orig)
|
||||
}
|
||||
|
||||
// PartialSuccess returns the ExportLogsPartialSuccess associated with this Response.
|
||||
func (mr Response) PartialSuccess() ExportMetricsPartialSuccess {
|
||||
return ExportMetricsPartialSuccess(internal.NewExportMetricsPartialSuccess(&mr.orig.PartialSuccess))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT.
|
||||
// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".
|
||||
|
||||
package ptraceotlp
|
||||
|
||||
import (
|
||||
"go.opentelemetry.io/collector/pdata/internal"
|
||||
otlpcollectortrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/trace/v1"
|
||||
)
|
||||
|
||||
// ExportTracePartialSuccess represents the details of a partially successful export request.
|
||||
//
|
||||
// This is a reference type, if passed by value and callee modifies it the
|
||||
// caller will see the modification.
|
||||
//
|
||||
// Must use NewExportTracePartialSuccess function to create new instances.
|
||||
// Important: zero-initialized instance is not valid for use.
|
||||
|
||||
type ExportTracePartialSuccess internal.ExportTracePartialSuccess
|
||||
|
||||
func newExportTracePartialSuccess(orig *otlpcollectortrace.ExportTracePartialSuccess) ExportTracePartialSuccess {
|
||||
return ExportTracePartialSuccess(internal.NewExportTracePartialSuccess(orig))
|
||||
}
|
||||
|
||||
func (ms ExportTracePartialSuccess) getOrig() *otlpcollectortrace.ExportTracePartialSuccess {
|
||||
return internal.GetOrigExportTracePartialSuccess(internal.ExportTracePartialSuccess(ms))
|
||||
}
|
||||
|
||||
// NewExportTracePartialSuccess creates a new empty ExportTracePartialSuccess.
|
||||
//
|
||||
// This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
|
||||
// OR directly access the member if this is embedded in another struct.
|
||||
func NewExportTracePartialSuccess() ExportTracePartialSuccess {
|
||||
return newExportTracePartialSuccess(&otlpcollectortrace.ExportTracePartialSuccess{})
|
||||
}
|
||||
|
||||
// MoveTo moves all properties from the current struct overriding the destination and
|
||||
// resetting the current instance to its zero value
|
||||
func (ms ExportTracePartialSuccess) MoveTo(dest ExportTracePartialSuccess) {
|
||||
*dest.getOrig() = *ms.getOrig()
|
||||
*ms.getOrig() = otlpcollectortrace.ExportTracePartialSuccess{}
|
||||
}
|
||||
|
||||
// RejectedSpans returns the rejectedspans associated with this ExportTracePartialSuccess.
|
||||
func (ms ExportTracePartialSuccess) RejectedSpans() int64 {
|
||||
return ms.getOrig().RejectedSpans
|
||||
}
|
||||
|
||||
// SetRejectedSpans replaces the rejectedspans associated with this ExportTracePartialSuccess.
|
||||
func (ms ExportTracePartialSuccess) SetRejectedSpans(v int64) {
|
||||
ms.getOrig().RejectedSpans = v
|
||||
}
|
||||
|
||||
// ErrorMessage returns the errormessage associated with this ExportTracePartialSuccess.
|
||||
func (ms ExportTracePartialSuccess) ErrorMessage() string {
|
||||
return ms.getOrig().ErrorMessage
|
||||
}
|
||||
|
||||
// SetErrorMessage replaces the errormessage associated with this ExportTracePartialSuccess.
|
||||
func (ms ExportTracePartialSuccess) SetErrorMessage(v string) {
|
||||
ms.getOrig().ErrorMessage = v
|
||||
}
|
||||
|
||||
// CopyTo copies all properties from the current struct overriding the destination.
|
||||
func (ms ExportTracePartialSuccess) CopyTo(dest ExportTracePartialSuccess) {
|
||||
dest.SetRejectedSpans(ms.RejectedSpans())
|
||||
dest.SetErrorMessage(ms.ErrorMessage())
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by "model/internal/cmd/pdatagen/main.go". DO NOT EDIT.
|
||||
// To regenerate this file run "go run model/internal/cmd/pdatagen/main.go".
|
||||
|
||||
package ptraceotlp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"go.opentelemetry.io/collector/pdata/internal"
|
||||
)
|
||||
|
||||
func TestExportTracePartialSuccess_MoveTo(t *testing.T) {
|
||||
ms := ExportTracePartialSuccess(internal.GenerateTestExportTracePartialSuccess())
|
||||
dest := NewExportTracePartialSuccess()
|
||||
ms.MoveTo(dest)
|
||||
assert.Equal(t, NewExportTracePartialSuccess(), ms)
|
||||
assert.Equal(t, ExportTracePartialSuccess(internal.GenerateTestExportTracePartialSuccess()), dest)
|
||||
}
|
||||
|
||||
func TestExportTracePartialSuccess_CopyTo(t *testing.T) {
|
||||
ms := NewExportTracePartialSuccess()
|
||||
orig := NewExportTracePartialSuccess()
|
||||
orig.CopyTo(ms)
|
||||
assert.Equal(t, orig, ms)
|
||||
orig = ExportTracePartialSuccess(internal.GenerateTestExportTracePartialSuccess())
|
||||
orig.CopyTo(ms)
|
||||
assert.Equal(t, orig, ms)
|
||||
}
|
||||
|
||||
func TestExportTracePartialSuccess_RejectedSpans(t *testing.T) {
|
||||
ms := NewExportTracePartialSuccess()
|
||||
assert.Equal(t, int64(0), ms.RejectedSpans())
|
||||
ms.SetRejectedSpans(int64(13))
|
||||
assert.Equal(t, int64(13), ms.RejectedSpans())
|
||||
}
|
||||
|
||||
func TestExportTracePartialSuccess_ErrorMessage(t *testing.T) {
|
||||
ms := NewExportTracePartialSuccess()
|
||||
assert.Equal(t, "", ms.ErrorMessage())
|
||||
ms.SetErrorMessage("error message")
|
||||
assert.Equal(t, "error message", ms.ErrorMessage())
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ package ptraceotlp // import "go.opentelemetry.io/collector/pdata/ptrace/ptraceo
|
|||
import (
|
||||
"bytes"
|
||||
|
||||
"go.opentelemetry.io/collector/pdata/internal"
|
||||
otlpcollectortrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/collector/trace/v1"
|
||||
"go.opentelemetry.io/collector/pdata/ptrace/internal/ptracejson"
|
||||
)
|
||||
|
|
@ -53,3 +54,8 @@ func (tr Response) MarshalJSON() ([]byte, error) {
|
|||
func (tr Response) UnmarshalJSON(data []byte) error {
|
||||
return ptracejson.UnmarshalExportTraceServiceResponse(data, tr.orig)
|
||||
}
|
||||
|
||||
// PartialSuccess returns the ExportLogsPartialSuccess associated with this Response.
|
||||
func (tr Response) PartialSuccess() ExportTracePartialSuccess {
|
||||
return ExportTracePartialSuccess(internal.NewExportTracePartialSuccess(&tr.orig.PartialSuccess))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue