@@ -3,18 +3,34 @@ package httpprocessor
33import (
44 "context"
55
6+ "go.opentelemetry.io/collector/component"
7+ "go.opentelemetry.io/collector/consumer"
68 "go.opentelemetry.io/collector/pdata/plog"
79 "go.opentelemetry.io/collector/pdata/pmetric"
810 "go.opentelemetry.io/collector/pdata/ptrace"
911 "go.uber.org/zap"
1012)
1113
14+ // httpProcessor handles traces
1215type httpProcessor struct {
1316 config * Config
1417 logger * zap.Logger
18+ next consumer.Traces
1519}
1620
17- func (p * httpProcessor ) processTraces (ctx context.Context , td ptrace.Traces ) (ptrace.Traces , error ) {
21+ func (p * httpProcessor ) Capabilities () consumer.Capabilities {
22+ return consumer.Capabilities {MutatesData : true }
23+ }
24+
25+ func (p * httpProcessor ) Start (ctx context.Context , host component.Host ) error {
26+ return nil
27+ }
28+
29+ func (p * httpProcessor ) Shutdown (ctx context.Context ) error {
30+ return nil
31+ }
32+
33+ func (p * httpProcessor ) ConsumeTraces (ctx context.Context , td ptrace.Traces ) error {
1834 // Implement your trace processing logic here
1935 p .logger .Info ("Processing traces" , zap .Int ("span_count" , td .SpanCount ()))
2036
@@ -33,17 +49,55 @@ func (p *httpProcessor) processTraces(ctx context.Context, td ptrace.Traces) (pt
3349 }
3450 }
3551
36- return td , nil
52+ return p .next .ConsumeTraces (ctx , td )
53+ }
54+
55+ // httpMetricsProcessor handles metrics
56+ type httpMetricsProcessor struct {
57+ config * Config
58+ logger * zap.Logger
59+ next consumer.Metrics
60+ }
61+
62+ func (p * httpMetricsProcessor ) Capabilities () consumer.Capabilities {
63+ return consumer.Capabilities {MutatesData : true }
64+ }
65+
66+ func (p * httpMetricsProcessor ) Start (ctx context.Context , host component.Host ) error {
67+ return nil
68+ }
69+
70+ func (p * httpMetricsProcessor ) Shutdown (ctx context.Context ) error {
71+ return nil
3772}
3873
39- func (p * httpProcessor ) processMetrics (ctx context.Context , md pmetric.Metrics ) (pmetric. Metrics , error ) {
74+ func (p * httpMetricsProcessor ) ConsumeMetrics (ctx context.Context , md pmetric.Metrics ) error {
4075 // Implement your metric processing logic here
4176 p .logger .Info ("Processing metrics" , zap .Int ("metric_count" , md .MetricCount ()))
4277
43- return md , nil
78+ return p .next .ConsumeMetrics (ctx , md )
79+ }
80+
81+ // httpLogsProcessor handles logs
82+ type httpLogsProcessor struct {
83+ config * Config
84+ logger * zap.Logger
85+ next consumer.Logs
86+ }
87+
88+ func (p * httpLogsProcessor ) Capabilities () consumer.Capabilities {
89+ return consumer.Capabilities {MutatesData : true }
90+ }
91+
92+ func (p * httpLogsProcessor ) Start (ctx context.Context , host component.Host ) error {
93+ return nil
94+ }
95+
96+ func (p * httpLogsProcessor ) Shutdown (ctx context.Context ) error {
97+ return nil
4498}
4599
46- func (p * httpProcessor ) processLogs (ctx context.Context , ld plog.Logs ) (plog. Logs , error ) {
100+ func (p * httpLogsProcessor ) ConsumeLogs (ctx context.Context , ld plog.Logs ) error {
47101 // Implement your log processing logic here
48102 p .logger .Info ("Processing logs" , zap .Int ("log_count" , ld .LogRecordCount ()))
49103
@@ -62,5 +116,5 @@ func (p *httpProcessor) processLogs(ctx context.Context, ld plog.Logs) (plog.Log
62116 }
63117 }
64118
65- return ld , nil
119+ return p . next . ConsumeLogs ( ctx , ld )
66120}
0 commit comments