Skip to content

Commit 01bd0e9

Browse files
authored
Return success on PartialSuccess (#130)
Described and tracked in open-telemetry/opentelemetry-collector#9243. The otelarrow export component copied this code from the core OTLP exporter, so it has the same bug.
1 parent 364a3f3 commit 01bd0e9

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
99
- Remove two deprecated fields, both concurrent batch processor `max_in_flight_bytes`
1010
and otelarrow receiver `memory_limit` fields have corresponding `_mib` field names
1111
for consistency.
12+
- OTel-Arrow exporter: Do not treat PartialSuccess as errors (see https://github.com/open-telemetry/opentelemetry-collector/issues/9243). []()
1213

1314
## [0.13.0](https://github.com/open-telemetry/otel-arrow/releases/tag/v0.13.0) - 2023-12-20
1415

collector/exporter/otelarrowexporter/otlp.go

+16-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
arrowPkg "github.com/apache/arrow/go/v12/arrow"
1414
arrowRecord "github.com/open-telemetry/otel-arrow/pkg/otel/arrow_record"
1515
"go.uber.org/multierr"
16+
"go.uber.org/zap"
1617
"google.golang.org/genproto/googleapis/rpc/errdetails"
1718
"google.golang.org/grpc"
1819
"google.golang.org/grpc/codes"
@@ -201,7 +202,11 @@ func (e *baseExporter) pushTraces(ctx context.Context, td ptrace.Traces) error {
201202
}
202203
partialSuccess := resp.PartialSuccess()
203204
if !(partialSuccess.ErrorMessage() == "" && partialSuccess.RejectedSpans() == 0) {
204-
return consumererror.NewPermanent(fmt.Errorf("OTLP partial success: \"%s\" (%d rejected)", resp.PartialSuccess().ErrorMessage(), resp.PartialSuccess().RejectedSpans()))
205+
// TODO: These should be counted, similar to dropped items.
206+
e.settings.Logger.Warn("partial success",
207+
zap.String("message", resp.PartialSuccess().ErrorMessage()),
208+
zap.Int64("num_rejected", resp.PartialSuccess().RejectedSpans()),
209+
)
205210
}
206211
return nil
207212
}
@@ -219,7 +224,11 @@ func (e *baseExporter) pushMetrics(ctx context.Context, md pmetric.Metrics) erro
219224
}
220225
partialSuccess := resp.PartialSuccess()
221226
if !(partialSuccess.ErrorMessage() == "" && partialSuccess.RejectedDataPoints() == 0) {
222-
return consumererror.NewPermanent(fmt.Errorf("OTLP partial success: \"%s\" (%d rejected)", resp.PartialSuccess().ErrorMessage(), resp.PartialSuccess().RejectedDataPoints()))
227+
// TODO: These should be counted, similar to dropped items.
228+
e.settings.Logger.Warn("partial success",
229+
zap.String("message", resp.PartialSuccess().ErrorMessage()),
230+
zap.Int64("num_rejected", resp.PartialSuccess().RejectedDataPoints()),
231+
)
223232
}
224233
return nil
225234
}
@@ -237,7 +246,11 @@ func (e *baseExporter) pushLogs(ctx context.Context, ld plog.Logs) error {
237246
}
238247
partialSuccess := resp.PartialSuccess()
239248
if !(partialSuccess.ErrorMessage() == "" && partialSuccess.RejectedLogRecords() == 0) {
240-
return consumererror.NewPermanent(fmt.Errorf("OTLP partial success: \"%s\" (%d rejected)", resp.PartialSuccess().ErrorMessage(), resp.PartialSuccess().RejectedLogRecords()))
249+
// TODO: These should be counted, similar to dropped items.
250+
e.settings.Logger.Warn("partial success",
251+
zap.String("message", resp.PartialSuccess().ErrorMessage()),
252+
zap.Int64("num_rejected", resp.PartialSuccess().RejectedLogRecords()),
253+
)
241254
}
242255
return nil
243256
}

collector/exporter/otelarrowexporter/otlp_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,9 @@ func TestSendTraces(t *testing.T) {
412412
// A request with 2 Trace entries.
413413
td = testdata.GenerateTraces(2)
414414

415+
// PartialSuccess is not an error.
415416
err = exp.ConsumeTraces(callCtx1, td)
416-
assert.Error(t, err)
417+
assert.NoError(t, err)
417418
}
418419

419420
func TestSendTracesWhenEndpointHasHttpScheme(t *testing.T) {
@@ -590,7 +591,7 @@ func TestSendMetrics(t *testing.T) {
590591

591592
// Send two metrics.
592593
md = testdata.GenerateMetrics(2)
593-
assert.Error(t, exp.ConsumeMetrics(context.Background(), md))
594+
assert.NoError(t, exp.ConsumeMetrics(context.Background(), md))
594595
}
595596

596597
func TestSendTraceDataServerDownAndUp(t *testing.T) {
@@ -883,7 +884,7 @@ func TestSendLogData(t *testing.T) {
883884
ld = testdata.GenerateLogs(2)
884885

885886
err = exp.ConsumeLogs(context.Background(), ld)
886-
assert.Error(t, err)
887+
assert.NoError(t, err)
887888
}
888889

889890
// TestSendArrowTracesNotSupported tests a successful OTLP export w/

0 commit comments

Comments
 (0)