diff --git a/exporter/otlpexporter/otlp.go b/exporter/otlpexporter/otlp.go index 8933236ae8b..2ca4deadd93 100644 --- a/exporter/otlpexporter/otlp.go +++ b/exporter/otlpexporter/otlp.go @@ -98,7 +98,7 @@ func (e *baseExporter) pushTraces(ctx context.Context, td ptrace.Traces) (err er }() req := ptraceotlp.NewExportRequestFromTraces(td) resp, respErr := e.traceExporter.Export(e.enhanceContext(ctx), req, e.callOptions...) - if err = e.processError(respErr); err != nil { + if err = processError(respErr); err != nil { return } partialSuccess := resp.PartialSuccess() @@ -117,7 +117,7 @@ func (e *baseExporter) pushMetrics(ctx context.Context, md pmetric.Metrics) (err }() req := pmetricotlp.NewExportRequestFromMetrics(md) resp, respErr := e.metricExporter.Export(e.enhanceContext(ctx), req, e.callOptions...) - if err = e.processError(respErr); err != nil { + if err = processError(respErr); err != nil { return } partialSuccess := resp.PartialSuccess() @@ -136,7 +136,7 @@ func (e *baseExporter) pushLogs(ctx context.Context, ld plog.Logs) (err error) { }() req := plogotlp.NewExportRequestFromLogs(ld) resp, respErr := e.logExporter.Export(e.enhanceContext(ctx), req, e.callOptions...) - if err = e.processError(respErr); err != nil { + if err = processError(respErr); err != nil { return } partialSuccess := resp.PartialSuccess() @@ -152,7 +152,7 @@ func (e *baseExporter) pushLogs(ctx context.Context, ld plog.Logs) (err error) { func (e *baseExporter) pushProfiles(ctx context.Context, td pprofile.Profiles) error { req := pprofileotlp.NewExportRequestFromProfiles(td) resp, respErr := e.profileExporter.Export(e.enhanceContext(ctx), req, e.callOptions...) - if err := e.processError(respErr); err != nil { + if err := processError(respErr); err != nil { return err } partialSuccess := resp.PartialSuccess() @@ -172,7 +172,7 @@ func (e *baseExporter) enhanceContext(ctx context.Context) context.Context { return ctx } -func (e *baseExporter) processError(err error) error { +func processError(err error) error { if err == nil { // Request is successful, we are done. return nil @@ -185,11 +185,6 @@ func (e *baseExporter) processError(err error) error { return nil } - // Now, this is a real error. - if isComponentPermanentError(st) { - componentstatus.ReportStatus(e.host, componentstatus.NewPermanentErrorEvent(err)) - } - retryInfo := getRetryInfo(st) if !shouldRetry(st.Code(), retryInfo) { @@ -253,21 +248,3 @@ func getThrottleDuration(t *errdetails.RetryInfo) time.Duration { } return 0 } - -// A component status of PermanentError indicates the component is in a state that will require user -// intervention to fix. Typically this is a misconfiguration detected at runtime. A component -// PermanentError has different semantics than a consumererror. For more information, see: -// https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-status.md -func isComponentPermanentError(st *status.Status) bool { - switch st.Code() { - case codes.NotFound: - return true - case codes.PermissionDenied: - return true - case codes.Unauthenticated: - return true - default: - return false - } - -} diff --git a/exporter/otlpexporter/otlp_test.go b/exporter/otlpexporter/otlp_test.go index ad1241b5f04..4f4fb32e5d7 100644 --- a/exporter/otlpexporter/otlp_test.go +++ b/exporter/otlpexporter/otlp_test.go @@ -1048,21 +1048,6 @@ func TestComponentStatus(t *testing.T) { exportError: nil, componentStatus: componentstatus.StatusOK, }, - { - name: "Permission Denied", - exportError: status.Error(codes.PermissionDenied, "permission denied"), - componentStatus: componentstatus.StatusPermanentError, - }, - { - name: "Not Found", - exportError: status.Error(codes.NotFound, "not found"), - componentStatus: componentstatus.StatusPermanentError, - }, - { - name: "Unauthenticated", - exportError: status.Error(codes.Unauthenticated, "unauthenticated"), - componentStatus: componentstatus.StatusPermanentError, - }, { name: "Resource Exhausted", exportError: status.Error(codes.ResourceExhausted, "resource exhausted"), @@ -1092,7 +1077,7 @@ func TestComponentStatus(t *testing.T) { set := exportertest.NewNopSettings() host := &testHost{Host: componenttest.NewNopHost()} - exp, err := factory.CreateTracesExporter(context.Background(), set, cfg) + exp, err := factory.CreateTraces(context.Background(), set, cfg) require.NoError(t, err) require.NotNil(t, exp) require.NoError(t, exp.Start(context.Background(), host)) @@ -1133,7 +1118,7 @@ func TestComponentStatus(t *testing.T) { set := exportertest.NewNopSettings() host := &testHost{Host: componenttest.NewNopHost()} - exp, err := factory.CreateMetricsExporter(context.Background(), set, cfg) + exp, err := factory.CreateMetrics(context.Background(), set, cfg) require.NoError(t, err) require.NotNil(t, exp) require.NoError(t, exp.Start(context.Background(), host)) @@ -1173,7 +1158,7 @@ func TestComponentStatus(t *testing.T) { set := exportertest.NewNopSettings() host := &testHost{Host: componenttest.NewNopHost()} - exp, err := factory.CreateLogsExporter(context.Background(), set, cfg) + exp, err := factory.CreateLogs(context.Background(), set, cfg) require.NoError(t, err) require.NotNil(t, exp) require.NoError(t, exp.Start(context.Background(), host)) diff --git a/exporter/otlphttpexporter/otlp.go b/exporter/otlphttpexporter/otlp.go index c823a56a4cd..ad066cb343e 100644 --- a/exporter/otlphttpexporter/otlp.go +++ b/exporter/otlphttpexporter/otlp.go @@ -228,10 +228,6 @@ func (e *baseExporter) export(ctx context.Context, url string, request []byte, p } formattedErr = httphelper.NewStatusFromMsgAndHTTPCode(errString, resp.StatusCode).Err() - if isComponentPermanentError(resp.StatusCode) { - componentstatus.ReportStatus(e.host, componentstatus.NewPermanentErrorEvent(formattedErr)) - } - if isRetryableStatusCode(resp.StatusCode) { // A retry duration of 0 seconds will trigger the default backoff policy // of our caller (retry handler). @@ -277,31 +273,6 @@ func isRetryableStatusCode(code int) bool { } } -// A component status of PermanentError indicates the component is in a state that will require user -// intervention to fix. Typically this is a misconfiguration detected at runtime. A component -// PermanentError has different semantics than a consumererror. For more information, see: -// https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-status.md -func isComponentPermanentError(code int) bool { - switch code { - case http.StatusUnauthorized: - return true - case http.StatusForbidden: - return true - case http.StatusNotFound: - return true - case http.StatusMethodNotAllowed: - return true - case http.StatusRequestEntityTooLarge: - return true - case http.StatusRequestURITooLong: - return true - case http.StatusRequestHeaderFieldsTooLarge: - return true - default: - return false - } -} - func readResponseBody(resp *http.Response) ([]byte, error) { if resp.ContentLength == 0 { return nil, nil diff --git a/exporter/otlphttpexporter/otlp_test.go b/exporter/otlphttpexporter/otlp_test.go index a9a271e87c7..3a1b049d826 100644 --- a/exporter/otlphttpexporter/otlp_test.go +++ b/exporter/otlphttpexporter/otlp_test.go @@ -1150,46 +1150,6 @@ func TestComponentStatus(t *testing.T) { responseStatus: http.StatusOK, componentStatus: componentstatus.StatusOK, }, - { - name: "401", - responseStatus: http.StatusUnauthorized, - componentStatus: componentstatus.StatusPermanentError, - }, - { - name: "403", - responseStatus: http.StatusForbidden, - componentStatus: componentstatus.StatusPermanentError, - }, - { - name: "404", - responseStatus: http.StatusNotFound, - componentStatus: componentstatus.StatusPermanentError, - }, - { - name: "405", - responseStatus: http.StatusMethodNotAllowed, - componentStatus: componentstatus.StatusPermanentError, - }, - { - name: "413", - responseStatus: http.StatusRequestEntityTooLarge, - componentStatus: componentstatus.StatusPermanentError, - }, - { - name: "414", - responseStatus: http.StatusRequestURITooLong, - componentStatus: componentstatus.StatusPermanentError, - }, - { - name: "419", - responseStatus: http.StatusTooManyRequests, - componentStatus: componentstatus.StatusRecoverableError, - }, - { - name: "431", - responseStatus: http.StatusRequestHeaderFieldsTooLarge, - componentStatus: componentstatus.StatusPermanentError, - }, { name: "503", responseStatus: http.StatusServiceUnavailable,