Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
eb7f0bd
Add detailed failure attributes to exporter send_failed metrics
iblancasa Dec 3, 2025
ab77cad
Fix CI
iblancasa Dec 3, 2025
bff292f
Apply feedback from code review and failure.retries_exhausted
iblancasa Dec 5, 2025
ecbeb51
Merge branch 'main' into 13956-2
iblancasa Dec 9, 2025
522f200
Add e2e test
iblancasa Dec 9, 2025
30cff73
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Dec 9, 2025
6816b42
Merge branch '13956-2' of github.com:iblancasa/opentelemetry-collecto…
iblancasa Dec 9, 2025
8d444c6
Fix gomod for tests
iblancasa Dec 9, 2025
91c6a61
Improve e2e test
iblancasa Dec 10, 2025
382674b
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Dec 16, 2025
d754e99
Remove retries_exhausted attribute
iblancasa Dec 16, 2025
a9e9e3a
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Dec 17, 2025
ea6db37
Apply changes requested in code review
iblancasa Dec 18, 2025
7b9b44f
Apply changes requested to code review
iblancasa Dec 19, 2025
b9d74bc
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Dec 19, 2025
d297bcf
Fix ci
iblancasa Dec 19, 2025
7a398c3
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Dec 29, 2025
4276caf
Fix ci
iblancasa Dec 29, 2025
d92313b
Merge branch 'main' into 13956-2
iblancasa Jan 5, 2026
f798d84
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Jan 7, 2026
c398d0b
Merge branch '13956-2' of github.com:iblancasa/opentelemetry-collecto…
iblancasa Jan 7, 2026
c5d5d65
Fix CI
iblancasa Jan 7, 2026
44cf342
Fix CI
iblancasa Jan 7, 2026
dfec94a
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Jan 7, 2026
5d43dcf
Remove incorrect added metric
iblancasa Jan 7, 2026
6bdba4b
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Jan 9, 2026
d5dcc50
Merge branch '13956-2' of github.com:iblancasa/opentelemetry-collecto…
iblancasa Jan 9, 2026
fdf0327
Fix CI
iblancasa Jan 9, 2026
0ab847a
Merge branch 'main' into 13956-2
iblancasa Jan 9, 2026
573a436
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Jan 9, 2026
8d6ba7c
Fix CI
iblancasa Jan 9, 2026
47d8471
Merge branch '13956-2' of github.com:iblancasa/opentelemetry-collecto…
iblancasa Jan 9, 2026
fc28464
Merge branch '13956-2' of github.com:iblancasa/opentelemetry-collecto…
iblancasa Jan 9, 2026
5ca12f2
Fix CI
iblancasa Jan 9, 2026
443210c
Merge branch 'main' into 13956-2
iblancasa Jan 12, 2026
f7eaa2f
Merge branches '13956-2' and '13956-2' of github.com:iblancasa/opente…
iblancasa Jan 15, 2026
eb404aa
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Jan 15, 2026
a6a3d4b
Merge branch 'main' into 13956-2
iblancasa Jan 16, 2026
bb2fb5b
Merge branch 'main' into 13956-2
iblancasa Jan 22, 2026
edd4139
Merge branch 'main' into 13956-2
iblancasa Jan 26, 2026
3d2cf44
Merge branch 'main' into 13956-2
iblancasa Jan 26, 2026
820ce0f
Merge branch 'main' into 13956-2
iblancasa Jan 29, 2026
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
32 changes: 32 additions & 0 deletions .chloggen/13956.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Use this changelog template to create an entry for release notes.

# 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. receiver/otlp)
component: all

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add detailed failure attributes to exporter send_failed metrics at detailed telemetry level.

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

# (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: |-
The `otelcol_exporter_send_failed_{spans,metric_points,log_records}` metrics now include
failure attributes when telemetry level is Detailed: `error.type` (OpenTelemetry semantic convention
describing the error class) and `error.permanent` (indicates if error is permanent/non-retryable).
The `error.type` attribute captures gRPC status codes (e.g., "Unavailable", "ResourceExhausted"),
standard Go context errors (e.g., "canceled", "deadline_exceeded"),
and collector-specific errors (e.g., "shutdown").
This enables better alerting and debugging by providing standardized error classification.

# 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: [user]
6 changes: 3 additions & 3 deletions exporter/exporterhelper/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ Current size of the retry queue (in batches). [Alpha]

### otelcol_exporter_send_failed_log_records

Number of log records in failed attempts to send to destination. [Alpha]
Number of log records in failed attempts to send to destination. At detailed telemetry level, includes attributes: error.type (semantic convention), failure.permanent. [Alpha]

| Unit | Metric Type | Value Type | Monotonic | Stability |
| ---- | ----------- | ---------- | --------- | --------- |
| {records} | Sum | Int | true | Alpha |

### otelcol_exporter_send_failed_metric_points

Number of metric points in failed attempts to send to destination. [Alpha]
Number of metric points in failed attempts to send to destination. At detailed telemetry level, includes attributes: error.type (semantic convention), failure.permanent. [Alpha]

| Unit | Metric Type | Value Type | Monotonic | Stability |
| ---- | ----------- | ---------- | --------- | --------- |
| {datapoints} | Sum | Int | true | Alpha |

### otelcol_exporter_send_failed_spans

Number of spans in failed attempts to send to destination. [Alpha]
Number of spans in failed attempts to send to destination. At detailed telemetry level, includes attributes: error.type (semantic convention), failure.permanent. [Alpha]

| Unit | Metric Type | Value Type | Monotonic | Stability |
| ---- | ----------- | ---------- | --------- | --------- |
Expand Down
2 changes: 1 addition & 1 deletion exporter/exporterhelper/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ require (
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.1
google.golang.org/grpc v1.78.0
google.golang.org/protobuf v1.36.11
)

Expand Down Expand Up @@ -65,7 +66,6 @@ require (
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/sys v0.39.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect
google.golang.org/grpc v1.78.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down

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

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

53 changes: 49 additions & 4 deletions exporter/exporterhelper/internal/obs_report_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ package internal // import "go.opentelemetry.io/collector/exporter/exporterhelpe

import (
"context"
"errors"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
otelcodes "go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/metric"
semconv "go.opentelemetry.io/otel/semconv/v1.38.0"
"go.opentelemetry.io/otel/trace"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer/consumererror"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper/internal/experr"
"go.opentelemetry.io/collector/exporter/exporterhelper/internal/metadata"
"go.opentelemetry.io/collector/exporter/exporterhelper/internal/queuebatch"
"go.opentelemetry.io/collector/exporter/exporterhelper/internal/request"
Expand All @@ -34,6 +40,9 @@ const (
ItemsSent = "items.sent"
// ItemsFailed used to track number of items that failed to be sent by exporters.
ItemsFailed = "items.failed"

// ErrorPermanentKey indicates whether the error is permanent (non-retryable).
ErrorPermanentKey = "error.permanent"
)

type obsReportSender[K request.Request] struct {
Expand Down Expand Up @@ -113,8 +122,9 @@ func (ors *obsReportSender[K]) endOp(ctx context.Context, numLogRecords int, err
ors.itemsSentInst.Add(ctx, numSent, ors.metricAttr)
}
// No metrics recorded for profiles.
if ors.itemsFailedInst != nil {
ors.itemsFailedInst.Add(ctx, numFailedToSend, ors.metricAttr)
if ors.itemsFailedInst != nil && numFailedToSend > 0 {
withFailedAttrs := metric.WithAttributeSet(extractFailureAttributes(err))
ors.itemsFailedInst.Add(ctx, numFailedToSend, ors.metricAttr, withFailedAttrs)
}

span := trace.SpanFromContext(ctx)
Expand All @@ -126,7 +136,7 @@ func (ors *obsReportSender[K]) endOp(ctx context.Context, numLogRecords int, err
attribute.Int64(ItemsFailed, numFailedToSend),
)
if err != nil {
span.SetStatus(codes.Error, err.Error())
span.SetStatus(otelcodes.Error, err.Error())
}
}
}
Expand All @@ -137,3 +147,38 @@ func toNumItems(numExportedItems int, err error) (int64, int64) {
}
return int64(numExportedItems), 0
}

func extractFailureAttributes(err error) attribute.Set {
if err == nil {
return attribute.NewSet()
}

attrs := []attribute.KeyValue{}

errorType := determineErrorType(err)
attrs = append(attrs, attribute.String(string(semconv.ErrorTypeKey), errorType))

isPermanent := consumererror.IsPermanent(err)
attrs = append(attrs, attribute.Bool(ErrorPermanentKey, isPermanent))

return attribute.NewSet(attrs...)
}

func determineErrorType(err error) string {
if experr.IsShutdownErr(err) {
return "shutdown"
}

if errors.Is(err, context.Canceled) {
return "canceled"
}
if errors.Is(err, context.DeadlineExceeded) {
return "deadline_exceeded"
}

if st, ok := status.FromError(err); ok && st.Code() != codes.OK {
return st.Code().String()
}

return "unknown"
}
Loading
Loading