forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
traces_connector.go
47 lines (38 loc) · 1.56 KB
/
traces_connector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package datadogconnector // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector"
import (
"context"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.uber.org/zap"
)
type traceToTraceConnector struct {
logger *zap.Logger
tracesConsumer consumer.Traces // the next component in the pipeline to ingest traces after connector
}
func newTraceToTraceConnector(logger *zap.Logger, nextConsumer consumer.Traces) *traceToTraceConnector {
logger.Info("Building datadog connector for trace to trace")
return &traceToTraceConnector{
logger: logger,
tracesConsumer: nextConsumer,
}
}
// Start implements the component interface.
func (c *traceToTraceConnector) Start(_ context.Context, _ component.Host) error {
return nil
}
// Shutdown implements the component interface.
func (c *traceToTraceConnector) Shutdown(_ context.Context) error {
return nil
}
// Capabilities implements the consumer interface.
// tells use whether the component(connector) will mutate the data passed into it. if set to true the connector does modify the data
func (c *traceToTraceConnector) Capabilities() consumer.Capabilities {
return consumer.Capabilities{MutatesData: false}
}
// ConsumeTraces implements the consumer interface.
func (c *traceToTraceConnector) ConsumeTraces(ctx context.Context, traces ptrace.Traces) error {
return c.tracesConsumer.ConsumeTraces(ctx, traces)
}