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

[receiver/otlp] Switch from InvalidArgument to Internal #9415

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions .chloggen/update-GetStatusFromError-code.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: receiver/otlp

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Update grcp code from `codes.InvalidArgument` to `codes.Internal` when propagating consumer error
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved

# One or more tracking issues or pull requests related to the change
issues: [9415]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func GetStatusFromError(err error) error {
// https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md#failures
code := codes.Unavailable
if consumererror.IsPermanent(err) {
code = codes.InvalidArgument
code = codes.Internal
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved
}
s = status.New(code, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/errors/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func Test_GetStatusFromError(t *testing.T) {
{
name: "Permanent Error",
input: consumererror.NewPermanent(fmt.Errorf("test")),
expected: status.New(codes.InvalidArgument, "Permanent error: test"),
expected: status.New(codes.Internal, "Permanent error: test"),
},
{
name: "Non-Permanent Error",
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/logs/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestExport_PermanentErrorConsumer(t *testing.T) {

logClient := makeLogsServiceClient(t, consumertest.NewErr(consumererror.NewPermanent(errors.New("my error"))))
resp, err := logClient.Export(context.Background(), req)
assert.EqualError(t, err, "rpc error: code = InvalidArgument desc = Permanent error: my error")
assert.EqualError(t, err, "rpc error: code = Internal desc = Permanent error: my error")
assert.IsType(t, status.Error(codes.Unknown, ""), err)
assert.Equal(t, plogotlp.ExportResponse{}, resp)
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/metrics/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestExport_PermanentErrorConsumer(t *testing.T) {

metricsClient := makeMetricsServiceClient(t, consumertest.NewErr(consumererror.NewPermanent(errors.New("my error"))))
resp, err := metricsClient.Export(context.Background(), req)
assert.EqualError(t, err, "rpc error: code = InvalidArgument desc = Permanent error: my error")
assert.EqualError(t, err, "rpc error: code = Internal desc = Permanent error: my error")
assert.IsType(t, status.Error(codes.Unknown, ""), err)
assert.Equal(t, pmetricotlp.ExportResponse{}, resp)
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/trace/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestExport_PermanentErrorConsumer(t *testing.T) {

traceClient := makeTraceServiceClient(t, consumertest.NewErr(consumererror.NewPermanent(errors.New("my error"))))
resp, err := traceClient.Export(context.Background(), req)
assert.EqualError(t, err, "rpc error: code = InvalidArgument desc = Permanent error: my error")
assert.EqualError(t, err, "rpc error: code = Internal desc = Permanent error: my error")
assert.IsType(t, status.Error(codes.Unknown, ""), err)
assert.Equal(t, ptraceotlp.ExportResponse{}, resp)
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ func TestOTLPReceiverGRPCTracesIngestTest(t *testing.T) {
},
{
okToIngest: false,
expectedCode: codes.InvalidArgument,
expectedCode: codes.Internal,
permanent: true,
},
{
Expand Down