From 8be35c1440fd3b2080ed4ad9fec91fea36e8e0de Mon Sep 17 00:00:00 2001 From: Dinesh Gurumurthy Date: Sun, 4 Feb 2024 08:32:07 -0500 Subject: [PATCH 1/6] local changes --- connector/datadogconnector/connector.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/connector/datadogconnector/connector.go b/connector/datadogconnector/connector.go index fc3d168c5475..8a981438d29e 100644 --- a/connector/datadogconnector/connector.go +++ b/connector/datadogconnector/connector.go @@ -48,7 +48,12 @@ var _ component.Component = (*connectorImp)(nil) // testing that the connectorIm // function to create a new connector func newConnector(set component.TelemetrySettings, cfg component.Config, metricsConsumer consumer.Metrics, tracesConsumer consumer.Traces) (*connectorImp, error) { set.Logger.Info("Building datadog connector") - + if metricsConsumer == nil { + set.Logger.Info("No metrics consumer set, connector will be a no-op for traces pipeline") + return &connectorImp{ + logger: set.Logger, + }, nil + } in := make(chan *pb.StatsPayload, 100) set.MeterProvider = noop.NewMeterProvider() // disable metrics for the connector attributesTranslator, err := attributes.NewTranslator(set) @@ -88,8 +93,8 @@ func getTraceAgentCfg(cfg TracesConfig) *traceconfig.AgentConfig { // Start implements the component.Component interface. func (c *connectorImp) Start(_ context.Context, _ component.Host) error { c.logger.Info("Starting datadogconnector") - c.agent.Start() if c.metricsConsumer != nil { + c.agent.Start() go c.run() } return nil @@ -98,7 +103,10 @@ func (c *connectorImp) Start(_ context.Context, _ component.Host) error { // Shutdown implements the component.Component interface. func (c *connectorImp) Shutdown(context.Context) error { c.logger.Info("Shutting down datadog connector") - c.agent.Stop() + if c.metricsConsumer != nil { + // stop the agent and wait for the run loop to exit + c.agent.Stop() + } c.exit <- struct{}{} // signal exit <-c.exit // wait for close return nil @@ -111,7 +119,9 @@ func (c *connectorImp) Capabilities() consumer.Capabilities { } func (c *connectorImp) ConsumeTraces(ctx context.Context, traces ptrace.Traces) error { - c.agent.Ingest(ctx, traces) + if c.metricsConsumer != nil { + c.agent.Ingest(ctx, traces) + } if c.tracesConsumer != nil { return c.tracesConsumer.ConsumeTraces(ctx, traces) } From 553c02d7c5da72e9a5409b0bb99801d89eb83e9f Mon Sep 17 00:00:00 2001 From: Dinesh Gurumurthy Date: Sun, 4 Feb 2024 16:07:49 -0500 Subject: [PATCH 2/6] Separate out trace to trace datadog connector --- connector/datadogconnector/connector.go | 24 ++------ connector/datadogconnector/connector_test.go | 10 +++- connector/datadogconnector/factory.go | 8 +-- .../datadogconnector/traces_connector.go | 58 +++++++++++++++++++ internal/datadog/agent.go | 7 --- 5 files changed, 74 insertions(+), 33 deletions(-) create mode 100644 connector/datadogconnector/traces_connector.go diff --git a/connector/datadogconnector/connector.go b/connector/datadogconnector/connector.go index 8a981438d29e..ff6ac3ae757c 100644 --- a/connector/datadogconnector/connector.go +++ b/connector/datadogconnector/connector.go @@ -24,7 +24,6 @@ import ( // connectorImp is the schema for connector type connectorImp struct { metricsConsumer consumer.Metrics // the next component in the pipeline to ingest metrics after connector - tracesConsumer consumer.Traces // the next component in the pipeline to ingest traces after connector logger *zap.Logger // agent specifies the agent used to ingest traces and output APM Stats. @@ -46,14 +45,8 @@ type connectorImp struct { var _ component.Component = (*connectorImp)(nil) // testing that the connectorImp properly implements the type Component interface // function to create a new connector -func newConnector(set component.TelemetrySettings, cfg component.Config, metricsConsumer consumer.Metrics, tracesConsumer consumer.Traces) (*connectorImp, error) { - set.Logger.Info("Building datadog connector") - if metricsConsumer == nil { - set.Logger.Info("No metrics consumer set, connector will be a no-op for traces pipeline") - return &connectorImp{ - logger: set.Logger, - }, nil - } +func newConnector(set component.TelemetrySettings, cfg component.Config, metricsConsumer consumer.Metrics) (*connectorImp, error) { + set.Logger.Info("Building datadog connector for traces to metrics") in := make(chan *pb.StatsPayload, 100) set.MeterProvider = noop.NewMeterProvider() // disable metrics for the connector attributesTranslator, err := attributes.NewTranslator(set) @@ -72,7 +65,6 @@ func newConnector(set component.TelemetrySettings, cfg component.Config, metrics translator: trans, in: in, metricsConsumer: metricsConsumer, - tracesConsumer: tracesConsumer, exit: make(chan struct{}), }, nil } @@ -103,10 +95,9 @@ func (c *connectorImp) Start(_ context.Context, _ component.Host) error { // Shutdown implements the component.Component interface. func (c *connectorImp) Shutdown(context.Context) error { c.logger.Info("Shutting down datadog connector") - if c.metricsConsumer != nil { - // stop the agent and wait for the run loop to exit - c.agent.Stop() - } + c.logger.Info("Stopping datadog agent") + // stop the agent and wait for the run loop to exit + c.agent.Stop() c.exit <- struct{}{} // signal exit <-c.exit // wait for close return nil @@ -115,16 +106,13 @@ func (c *connectorImp) Shutdown(context.Context) error { // 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 *connectorImp) Capabilities() consumer.Capabilities { - return consumer.Capabilities{MutatesData: true} // ConsumeTraces puts a new attribute _dd.stats_computed + return consumer.Capabilities{MutatesData: false} } func (c *connectorImp) ConsumeTraces(ctx context.Context, traces ptrace.Traces) error { if c.metricsConsumer != nil { c.agent.Ingest(ctx, traces) } - if c.tracesConsumer != nil { - return c.tracesConsumer.ConsumeTraces(ctx, traces) - } return nil } diff --git a/connector/datadogconnector/connector_test.go b/connector/datadogconnector/connector_test.go index d5410720be71..254f6d1ab043 100644 --- a/connector/datadogconnector/connector_test.go +++ b/connector/datadogconnector/connector_test.go @@ -17,7 +17,6 @@ var _ component.Component = (*connectorImp)(nil) // testing that the connectorIm // create test to create a connector, check that basic code compiles func TestNewConnector(t *testing.T) { - factory := NewFactory() creationParams := connectortest.NewNopCreateSettings() @@ -28,10 +27,17 @@ func TestNewConnector(t *testing.T) { _, ok := traceToMetricsConnector.(*connectorImp) assert.True(t, ok) // checks if the created connector implements the connectorImp struct +} + +func TestTraceToTraceConnector(t *testing.T) { + factory := NewFactory() + + creationParams := connectortest.NewNopCreateSettings() + cfg := factory.CreateDefaultConfig().(*Config) traceToTracesConnector, err := factory.CreateTracesToTraces(context.Background(), creationParams, cfg, consumertest.NewNop()) assert.NoError(t, err) - _, ok = traceToTracesConnector.(*connectorImp) + _, ok := traceToTracesConnector.(*traceToTraceConnector) assert.True(t, ok) // checks if the created connector implements the connectorImp struct } diff --git a/connector/datadogconnector/factory.go b/connector/datadogconnector/factory.go index 90934fb81e9d..d9fb4fbf3a19 100644 --- a/connector/datadogconnector/factory.go +++ b/connector/datadogconnector/factory.go @@ -37,7 +37,7 @@ func createDefaultConfig() component.Config { // defines the consumer type of the connector // we want to consume traces and export metrics therefore define nextConsumer as metrics, consumer is the next component in the pipeline func createTracesToMetricsConnector(_ context.Context, params connector.CreateSettings, cfg component.Config, nextConsumer consumer.Metrics) (connector.Traces, error) { - c, err := newConnector(params.TelemetrySettings, cfg, nextConsumer, nil) + c, err := newConnector(params.TelemetrySettings, cfg, nextConsumer) if err != nil { return nil, err } @@ -45,9 +45,5 @@ func createTracesToMetricsConnector(_ context.Context, params connector.CreateSe } func createTracesToTracesConnector(_ context.Context, params connector.CreateSettings, cfg component.Config, nextConsumer consumer.Traces) (connector.Traces, error) { - c, err := newConnector(params.TelemetrySettings, cfg, nil, nextConsumer) - if err != nil { - return nil, err - } - return c, nil + return newTraceToTraceConnector(params.Logger, nextConsumer), nil } diff --git a/connector/datadogconnector/traces_connector.go b/connector/datadogconnector/traces_connector.go new file mode 100644 index 000000000000..dfa32f7b94b2 --- /dev/null +++ b/connector/datadogconnector/traces_connector.go @@ -0,0 +1,58 @@ +// 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" +) + +// keyStatsComputed specifies the resource attribute key which indicates if stats have been +// computed for the resource spans. +const keyStatsComputed = "_dd.stats_computed" + +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: true} // ConsumeTraces puts a new attribute _dd.stats_computed +} + +// ConsumeTraces implements the consumer interface. +func (c *traceToTraceConnector) ConsumeTraces(ctx context.Context, traces ptrace.Traces) error { + for i := 0; i < traces.ResourceSpans().Len(); i++ { + rs := traces.ResourceSpans().At(i) + // Stats will be computed for p. Mark the original resource spans to ensure that they don't + // get computed twice in case these spans pass through here again. + rs.Resource().Attributes().PutBool(keyStatsComputed, true) + + } + return c.tracesConsumer.ConsumeTraces(ctx, traces) +} diff --git a/internal/datadog/agent.go b/internal/datadog/agent.go index 044cddad0f85..b9c80029265c 100644 --- a/internal/datadog/agent.go +++ b/internal/datadog/agent.go @@ -21,10 +21,6 @@ import ( "go.opentelemetry.io/collector/pdata/ptrace" ) -// keyStatsComputed specifies the resource attribute key which indicates if stats have been -// computed for the resource spans. -const keyStatsComputed = "_dd.stats_computed" - // TraceAgent specifies a minimal trace agent instance that is able to process traces and output stats. type TraceAgent struct { *agent.Agent @@ -148,9 +144,6 @@ func (p *TraceAgent) Ingest(ctx context.Context, traces ptrace.Traces) { // ...the call transforms the OTLP Spans into a Datadog payload and sends the result // down the p.pchan channel - // Stats will be computed for p. Mark the original resource spans to ensure that they don't - // get computed twice in case these spans pass through here again. - rspans.Resource().Attributes().PutBool(keyStatsComputed, true) } } From f5915325a668bc3f9f425d687a3c678912633cd5 Mon Sep 17 00:00:00 2001 From: Dinesh Gurumurthy Date: Sun, 4 Feb 2024 16:20:55 -0500 Subject: [PATCH 3/6] add changelog --- .../dinesh.gurumurthy_fix-connector.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 .chloggen/dinesh.gurumurthy_fix-connector.yaml diff --git a/.chloggen/dinesh.gurumurthy_fix-connector.yaml b/.chloggen/dinesh.gurumurthy_fix-connector.yaml new file mode 100755 index 000000000000..d25b745cbf57 --- /dev/null +++ b/.chloggen/dinesh.gurumurthy_fix-connector.yaml @@ -0,0 +1,22 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: datadog/connector +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [30828] +# (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: Simplify datadog/connector in trace-trace pipeline +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# 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] From 5ef1dc8d3150ec04e0422580f5db05ac78270a61 Mon Sep 17 00:00:00 2001 From: Dinesh Gurumurthy Date: Sun, 4 Feb 2024 16:26:35 -0500 Subject: [PATCH 4/6] update changelog --- .chloggen/dinesh.gurumurthy_fix-connector.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/dinesh.gurumurthy_fix-connector.yaml b/.chloggen/dinesh.gurumurthy_fix-connector.yaml index d25b745cbf57..ce452e26df6d 100755 --- a/.chloggen/dinesh.gurumurthy_fix-connector.yaml +++ b/.chloggen/dinesh.gurumurthy_fix-connector.yaml @@ -5,7 +5,7 @@ change_type: bug_fix # The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) component: datadog/connector # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: +note: A new struct for trace-to-trace pipeline in datadog connector # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. issues: [30828] # (Optional) One or more lines of additional information to render under the primary note. From 3b5ad49d38c6b7f9fb2d189f238497f4a553477b Mon Sep 17 00:00:00 2001 From: Dinesh Gurumurthy Date: Sun, 4 Feb 2024 17:23:35 -0500 Subject: [PATCH 5/6] remove un-needed tests --- connector/datadogconnector/connector.go | 10 +++------- connector/datadogconnector/factory.go | 2 +- internal/datadog/agent_test.go | 23 ----------------------- 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/connector/datadogconnector/connector.go b/connector/datadogconnector/connector.go index ff6ac3ae757c..a380412767f5 100644 --- a/connector/datadogconnector/connector.go +++ b/connector/datadogconnector/connector.go @@ -85,10 +85,8 @@ func getTraceAgentCfg(cfg TracesConfig) *traceconfig.AgentConfig { // Start implements the component.Component interface. func (c *connectorImp) Start(_ context.Context, _ component.Host) error { c.logger.Info("Starting datadogconnector") - if c.metricsConsumer != nil { - c.agent.Start() - go c.run() - } + c.agent.Start() + go c.run() return nil } @@ -110,9 +108,7 @@ func (c *connectorImp) Capabilities() consumer.Capabilities { } func (c *connectorImp) ConsumeTraces(ctx context.Context, traces ptrace.Traces) error { - if c.metricsConsumer != nil { - c.agent.Ingest(ctx, traces) - } + c.agent.Ingest(ctx, traces) return nil } diff --git a/connector/datadogconnector/factory.go b/connector/datadogconnector/factory.go index d9fb4fbf3a19..5fa5abfb53aa 100644 --- a/connector/datadogconnector/factory.go +++ b/connector/datadogconnector/factory.go @@ -44,6 +44,6 @@ func createTracesToMetricsConnector(_ context.Context, params connector.CreateSe return c, nil } -func createTracesToTracesConnector(_ context.Context, params connector.CreateSettings, cfg component.Config, nextConsumer consumer.Traces) (connector.Traces, error) { +func createTracesToTracesConnector(_ context.Context, params connector.CreateSettings, _ component.Config, nextConsumer consumer.Traces) (connector.Traces, error) { return newTraceToTraceConnector(params.Logger, nextConsumer), nil } diff --git a/internal/datadog/agent_test.go b/internal/datadog/agent_test.go index 09133528eda6..a4e61cf4cd58 100644 --- a/internal/datadog/agent_test.go +++ b/internal/datadog/agent_test.go @@ -13,7 +13,6 @@ import ( "github.com/DataDog/datadog-agent/pkg/trace/testutil" "github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/pdata/pcommon" ) func TestTraceAgentConfig(t *testing.T) { @@ -79,26 +78,4 @@ loop: // of groups require.Len(t, stats.Stats[0].Stats[0].Stats, traces.SpanCount()) require.Len(t, a.TraceWriter.In, 0) // the trace writer channel should've been drained - - // Check that the payload is labeled - val, ok := traces.ResourceSpans().At(0).Resource().Attributes().Get(keyStatsComputed) - require.True(t, ok) - require.Equal(t, pcommon.ValueTypeBool, val.Type()) - require.True(t, val.Bool()) - - // Ingest again - a.Ingest(ctx, traces) - timeout = time.After(500 * time.Millisecond) -loop2: - for { - select { - case stats = <-out: - if len(stats.Stats) != 0 { - t.Fatal("got payload when none was expected") - } - case <-timeout: - // We got no stats (expected), thus we end the test - break loop2 - } - } } From 7459120e0146869bad48128d9f1aa947b6100e92 Mon Sep 17 00:00:00 2001 From: Dinesh Gurumurthy Date: Mon, 5 Feb 2024 10:32:06 -0500 Subject: [PATCH 6/6] PR feedback --- .../dinesh.gurumurthy_fix-connector.yaml | 4 ++-- connector/datadogconnector/connector.go | 20 +++++++++---------- connector/datadogconnector/connector_test.go | 4 ++-- connector/datadogconnector/factory.go | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.chloggen/dinesh.gurumurthy_fix-connector.yaml b/.chloggen/dinesh.gurumurthy_fix-connector.yaml index ce452e26df6d..33a8f2abd333 100755 --- a/.chloggen/dinesh.gurumurthy_fix-connector.yaml +++ b/.chloggen/dinesh.gurumurthy_fix-connector.yaml @@ -5,13 +5,13 @@ change_type: bug_fix # The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) component: datadog/connector # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: A new struct for trace-to-trace pipeline in datadog connector +note: Create a separate connector in the Datadog connector for the trace-to-metrics and trace-to-trace pipelines. It should reduce the number of conversions we do and help with Datadog connector performance. # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. issues: [30828] # (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: Simplify datadog/connector in trace-trace pipeline +subtext: Simplify datadog/connector with two separate connectors in trace-to-metrics pipeline and trace-to-trace pipeline. # If your change doesn't affect end users or the exported elements of any package, # you should instead start your pull request title with [chore] or use the "Skip Changelog" label. # Optional: The change log or logs in which this entry should be included. diff --git a/connector/datadogconnector/connector.go b/connector/datadogconnector/connector.go index a380412767f5..550423f0c704 100644 --- a/connector/datadogconnector/connector.go +++ b/connector/datadogconnector/connector.go @@ -21,8 +21,8 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/internal/datadog" ) -// connectorImp is the schema for connector -type connectorImp struct { +// traceToMetricConnector is the schema for connector +type traceToMetricConnector struct { metricsConsumer consumer.Metrics // the next component in the pipeline to ingest metrics after connector logger *zap.Logger @@ -42,10 +42,10 @@ type connectorImp struct { exit chan struct{} } -var _ component.Component = (*connectorImp)(nil) // testing that the connectorImp properly implements the type Component interface +var _ component.Component = (*traceToMetricConnector)(nil) // testing that the connectorImp properly implements the type Component interface // function to create a new connector -func newConnector(set component.TelemetrySettings, cfg component.Config, metricsConsumer consumer.Metrics) (*connectorImp, error) { +func newTraceToMetricConnector(set component.TelemetrySettings, cfg component.Config, metricsConsumer consumer.Metrics) (*traceToMetricConnector, error) { set.Logger.Info("Building datadog connector for traces to metrics") in := make(chan *pb.StatsPayload, 100) set.MeterProvider = noop.NewMeterProvider() // disable metrics for the connector @@ -59,7 +59,7 @@ func newConnector(set component.TelemetrySettings, cfg component.Config, metrics } ctx := context.Background() - return &connectorImp{ + return &traceToMetricConnector{ logger: set.Logger, agent: datadog.NewAgentWithConfig(ctx, getTraceAgentCfg(cfg.(*Config).Traces), in), translator: trans, @@ -83,7 +83,7 @@ func getTraceAgentCfg(cfg TracesConfig) *traceconfig.AgentConfig { } // Start implements the component.Component interface. -func (c *connectorImp) Start(_ context.Context, _ component.Host) error { +func (c *traceToMetricConnector) Start(_ context.Context, _ component.Host) error { c.logger.Info("Starting datadogconnector") c.agent.Start() go c.run() @@ -91,7 +91,7 @@ func (c *connectorImp) Start(_ context.Context, _ component.Host) error { } // Shutdown implements the component.Component interface. -func (c *connectorImp) Shutdown(context.Context) error { +func (c *traceToMetricConnector) Shutdown(context.Context) error { c.logger.Info("Shutting down datadog connector") c.logger.Info("Stopping datadog agent") // stop the agent and wait for the run loop to exit @@ -103,18 +103,18 @@ func (c *connectorImp) Shutdown(context.Context) error { // 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 *connectorImp) Capabilities() consumer.Capabilities { +func (c *traceToMetricConnector) Capabilities() consumer.Capabilities { return consumer.Capabilities{MutatesData: false} } -func (c *connectorImp) ConsumeTraces(ctx context.Context, traces ptrace.Traces) error { +func (c *traceToMetricConnector) ConsumeTraces(ctx context.Context, traces ptrace.Traces) error { c.agent.Ingest(ctx, traces) return nil } // run awaits incoming stats resulting from the agent's ingestion, converts them // to metrics and flushes them using the configured metrics exporter. -func (c *connectorImp) run() { +func (c *traceToMetricConnector) run() { defer close(c.exit) for { select { diff --git a/connector/datadogconnector/connector_test.go b/connector/datadogconnector/connector_test.go index 254f6d1ab043..ad3655c56a40 100644 --- a/connector/datadogconnector/connector_test.go +++ b/connector/datadogconnector/connector_test.go @@ -13,7 +13,7 @@ import ( "go.opentelemetry.io/collector/consumer/consumertest" ) -var _ component.Component = (*connectorImp)(nil) // testing that the connectorImp properly implements the type Component interface +var _ component.Component = (*traceToMetricConnector)(nil) // testing that the connectorImp properly implements the type Component interface // create test to create a connector, check that basic code compiles func TestNewConnector(t *testing.T) { @@ -25,7 +25,7 @@ func TestNewConnector(t *testing.T) { traceToMetricsConnector, err := factory.CreateTracesToMetrics(context.Background(), creationParams, cfg, consumertest.NewNop()) assert.NoError(t, err) - _, ok := traceToMetricsConnector.(*connectorImp) + _, ok := traceToMetricsConnector.(*traceToMetricConnector) assert.True(t, ok) // checks if the created connector implements the connectorImp struct } diff --git a/connector/datadogconnector/factory.go b/connector/datadogconnector/factory.go index 5fa5abfb53aa..782014d99e6f 100644 --- a/connector/datadogconnector/factory.go +++ b/connector/datadogconnector/factory.go @@ -37,7 +37,7 @@ func createDefaultConfig() component.Config { // defines the consumer type of the connector // we want to consume traces and export metrics therefore define nextConsumer as metrics, consumer is the next component in the pipeline func createTracesToMetricsConnector(_ context.Context, params connector.CreateSettings, cfg component.Config, nextConsumer consumer.Metrics) (connector.Traces, error) { - c, err := newConnector(params.TelemetrySettings, cfg, nextConsumer) + c, err := newTraceToMetricConnector(params.TelemetrySettings, cfg, nextConsumer) if err != nil { return nil, err }