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

Generate Export[Logs|Metrics|Traces]PartialSuccess, plugin into the Response #6361

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
11 changes: 11 additions & 0 deletions .chloggen/generatepartialresponse.yaml
Original file line number Diff line number Diff line change
@@ -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]
8 changes: 6 additions & 2 deletions pdata/internal/cmd/pdatagen/internal/files.go

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 @@ -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{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
61 changes: 61 additions & 0 deletions pdata/internal/cmd/pdatagen/internal/plogotlp_structs.go
Original file line number Diff line number Diff line change
@@ -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"`,
},
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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"`,
},
Expand Down
62 changes: 62 additions & 0 deletions pdata/internal/cmd/pdatagen/internal/pmetricotlp_structs.go
Original file line number Diff line number Diff line change
@@ -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"`,
},
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ func (iss *primitiveSliceStruct) generateInternal(sb *bytes.Buffer) {
}

var primitiveSliceFile = &File{
Path: "pdata",
Name: "primitive_slice",
PackageName: "pcommon",
testImports: []string{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
62 changes: 62 additions & 0 deletions pdata/internal/cmd/pdatagen/internal/ptraceotlp_structs.go
Original file line number Diff line number Diff line change
@@ -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"`,
},
},
}
1 change: 1 addition & 0 deletions pdata/internal/cmd/pdatagen/internal/resource_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
46 changes: 46 additions & 0 deletions pdata/internal/generated_wrapper_logs_otlp.go

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

46 changes: 46 additions & 0 deletions pdata/internal/generated_wrapper_metrics_otlp.go

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

Loading