@@ -10,8 +10,10 @@ import (
10
10
"go.opentelemetry.io/collector/internal/memorylimiter"
11
11
"go.opentelemetry.io/collector/pdata/plog"
12
12
"go.opentelemetry.io/collector/pdata/pmetric"
13
+ "go.opentelemetry.io/collector/pdata/pprofile"
13
14
"go.opentelemetry.io/collector/pdata/ptrace"
14
15
"go.opentelemetry.io/collector/pipeline"
16
+ "go.opentelemetry.io/collector/pipeline/xpipeline"
15
17
"go.opentelemetry.io/collector/processor"
16
18
)
17
19
@@ -50,11 +52,8 @@ func (p *memoryLimiterProcessor) shutdown(ctx context.Context) error {
50
52
func (p * memoryLimiterProcessor ) processTraces (ctx context.Context , td ptrace.Traces ) (ptrace.Traces , error ) {
51
53
numSpans := td .SpanCount ()
52
54
if p .memlimiter .MustRefuse () {
53
- // TODO: actually to be 100% sure that this is "refused" and not "dropped"
54
- // it is necessary to check the pipeline to see if this is directly connected
55
- // to a receiver (ie.: a receiver is on the call stack). For now it
56
- // assumes that the pipeline is properly configured and a receiver is on the
57
- // callstack and that the receiver will correctly retry the refused data again.
55
+ // TODO:
56
+ // https://github.com/open-telemetry/opentelemetry-collector/issues/12463
58
57
p .obsrep .refused (ctx , numSpans , pipeline .SignalTraces )
59
58
return td , memorylimiter .ErrDataRefused
60
59
}
@@ -68,11 +67,8 @@ func (p *memoryLimiterProcessor) processTraces(ctx context.Context, td ptrace.Tr
68
67
func (p * memoryLimiterProcessor ) processMetrics (ctx context.Context , md pmetric.Metrics ) (pmetric.Metrics , error ) {
69
68
numDataPoints := md .DataPointCount ()
70
69
if p .memlimiter .MustRefuse () {
71
- // TODO: actually to be 100% sure that this is "refused" and not "dropped"
72
- // it is necessary to check the pipeline to see if this is directly connected
73
- // to a receiver (ie.: a receiver is on the call stack). For now it
74
- // assumes that the pipeline is properly configured and a receiver is on the
75
- // callstack.
70
+ // TODO:
71
+ // https://github.com/open-telemetry/opentelemetry-collector/issues/12463
76
72
p .obsrep .refused (ctx , numDataPoints , pipeline .SignalMetrics )
77
73
return md , memorylimiter .ErrDataRefused
78
74
}
@@ -86,11 +82,8 @@ func (p *memoryLimiterProcessor) processMetrics(ctx context.Context, md pmetric.
86
82
func (p * memoryLimiterProcessor ) processLogs (ctx context.Context , ld plog.Logs ) (plog.Logs , error ) {
87
83
numRecords := ld .LogRecordCount ()
88
84
if p .memlimiter .MustRefuse () {
89
- // TODO: actually to be 100% sure that this is "refused" and not "dropped"
90
- // it is necessary to check the pipeline to see if this is directly connected
91
- // to a receiver (ie.: a receiver is on the call stack). For now it
92
- // assumes that the pipeline is properly configured and a receiver is on the
93
- // callstack.
85
+ // TODO:
86
+ // https://github.com/open-telemetry/opentelemetry-collector/issues/12463
94
87
p .obsrep .refused (ctx , numRecords , pipeline .SignalLogs )
95
88
return ld , memorylimiter .ErrDataRefused
96
89
}
@@ -100,3 +93,18 @@ func (p *memoryLimiterProcessor) processLogs(ctx context.Context, ld plog.Logs)
100
93
p .obsrep .accepted (ctx , numRecords , pipeline .SignalLogs )
101
94
return ld , nil
102
95
}
96
+
97
+ func (p * memoryLimiterProcessor ) processProfiles (ctx context.Context , td pprofile.Profiles ) (pprofile.Profiles , error ) {
98
+ numProfiles := td .SampleCount ()
99
+ if p .memlimiter .MustRefuse () {
100
+ // TODO:
101
+ // https://github.com/open-telemetry/opentelemetry-collector/issues/12463
102
+ p .obsrep .refused (ctx , numProfiles , xpipeline .SignalProfiles )
103
+ return td , memorylimiter .ErrDataRefused
104
+ }
105
+
106
+ // Even if the next consumer returns error record the data as accepted by
107
+ // this processor.
108
+ p .obsrep .accepted (ctx , numProfiles , xpipeline .SignalProfiles )
109
+ return td , nil
110
+ }
0 commit comments