-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prototype "connectors", a new type of pipeline component
- Loading branch information
1 parent
4ff1ff3
commit 67b2867
Showing
98 changed files
with
6,414 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 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. otlpreceiver) | ||
component: connectors | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Add "connectors", a new type of pipeline component | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [2336] | ||
|
||
# (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: | | ||
- Connectors connect pipelines. A connector acts as exporter and a receiver working together. | ||
For example, a `nopconnector`` may be used to replicate signals by exporting data from one | ||
pipeline and receiving the data on two other pipelines, which can each process a copy of the data | ||
in different ways. | ||
Connectors can also derive one signal from another. For example, a `countconnector` can be used as | ||
an exporter on a logs pipeline and emit metrics, describing the number of logs, onto a metrics pipeline. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
bin/ | ||
dist/ | ||
local/ | ||
|
||
# GoLand IDEA | ||
/.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package componenttest // import "go.opentelemetry.io/collector/component/componenttest" | ||
|
||
import ( | ||
"context" | ||
|
||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/config" | ||
"go.opentelemetry.io/collector/consumer" | ||
"go.opentelemetry.io/collector/consumer/consumertest" | ||
"go.opentelemetry.io/collector/pdata/plog" | ||
"go.opentelemetry.io/collector/pdata/pmetric" | ||
"go.opentelemetry.io/collector/pdata/ptrace" | ||
) | ||
|
||
// NewNopConnectorCreateSettings returns a new nop settings for Create*Connector functions. | ||
func NewNopConnectorCreateSettings() component.ConnectorCreateSettings { | ||
return component.ConnectorCreateSettings{ | ||
TelemetrySettings: NewNopTelemetrySettings(), | ||
BuildInfo: component.NewDefaultBuildInfo(), | ||
} | ||
} | ||
|
||
type nopConnectorConfig struct { | ||
config.ConnectorSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct | ||
} | ||
|
||
// NewNopConnectorFactory returns a component.ConnectorFactory that constructs nop processors. | ||
func NewNopConnectorFactory() component.ConnectorFactory { | ||
return component.NewConnectorFactory( | ||
"nop", | ||
func() component.Config { | ||
return &nopConnectorConfig{ | ||
ConnectorSettings: config.NewConnectorSettings(component.NewID("nop")), | ||
} | ||
}, | ||
component.WithTracesToTracesConnector(createTracesToTracesConnector, component.StabilityLevelStable), | ||
component.WithTracesToMetricsConnector(createTracesToMetricsConnector, component.StabilityLevelStable), | ||
component.WithTracesToLogsConnector(createTracesToLogsConnector, component.StabilityLevelStable), | ||
component.WithMetricsToTracesConnector(createMetricsToTracesConnector, component.StabilityLevelStable), | ||
component.WithMetricsToMetricsConnector(createMetricsToMetricsConnector, component.StabilityLevelStable), | ||
component.WithMetricsToLogsConnector(createMetricsToLogsConnector, component.StabilityLevelStable), | ||
component.WithLogsToTracesConnector(createLogsToTracesConnector, component.StabilityLevelStable), | ||
component.WithLogsToMetricsConnector(createLogsToMetricsConnector, component.StabilityLevelStable), | ||
component.WithLogsToLogsConnector(createLogsToLogsConnector, component.StabilityLevelStable), | ||
) | ||
} | ||
|
||
func createTracesToTracesConnector(context.Context, component.ConnectorCreateSettings, component.Config, consumer.Traces) (component.TracesToTracesConnector, error) { | ||
return nopConnectorInstance, nil | ||
} | ||
func createTracesToMetricsConnector(context.Context, component.ConnectorCreateSettings, component.Config, consumer.Metrics) (component.TracesToMetricsConnector, error) { | ||
return nopConnectorInstance, nil | ||
} | ||
func createTracesToLogsConnector(context.Context, component.ConnectorCreateSettings, component.Config, consumer.Logs) (component.TracesToLogsConnector, error) { | ||
return nopConnectorInstance, nil | ||
} | ||
|
||
func createMetricsToTracesConnector(context.Context, component.ConnectorCreateSettings, component.Config, consumer.Traces) (component.MetricsToTracesConnector, error) { | ||
return nopConnectorInstance, nil | ||
} | ||
func createMetricsToMetricsConnector(context.Context, component.ConnectorCreateSettings, component.Config, consumer.Metrics) (component.MetricsToMetricsConnector, error) { | ||
return nopConnectorInstance, nil | ||
} | ||
func createMetricsToLogsConnector(context.Context, component.ConnectorCreateSettings, component.Config, consumer.Logs) (component.MetricsToLogsConnector, error) { | ||
return nopConnectorInstance, nil | ||
} | ||
|
||
func createLogsToTracesConnector(context.Context, component.ConnectorCreateSettings, component.Config, consumer.Traces) (component.LogsToTracesConnector, error) { | ||
return nopConnectorInstance, nil | ||
} | ||
func createLogsToMetricsConnector(context.Context, component.ConnectorCreateSettings, component.Config, consumer.Metrics) (component.LogsToMetricsConnector, error) { | ||
return nopConnectorInstance, nil | ||
} | ||
func createLogsToLogsConnector(context.Context, component.ConnectorCreateSettings, component.Config, consumer.Logs) (component.LogsToLogsConnector, error) { | ||
return nopConnectorInstance, nil | ||
} | ||
|
||
var nopConnectorInstance = &nopConnector{ | ||
Consumer: consumertest.NewNop(), | ||
} | ||
|
||
// nopConnector stores consumed traces and metrics for testing purposes. | ||
type nopConnector struct { | ||
nopComponent | ||
consumertest.Consumer | ||
} | ||
|
||
func (c *nopConnector) ConsumeTracesToTraces(ctx context.Context, td ptrace.Traces) error { | ||
return nil | ||
} | ||
func (c *nopConnector) ConsumeTracesToMetrics(ctx context.Context, td ptrace.Traces) error { | ||
return nil | ||
} | ||
func (c *nopConnector) ConsumeTracesToLogs(ctx context.Context, td ptrace.Traces) error { | ||
return nil | ||
} | ||
|
||
func (c *nopConnector) ConsumeMetricsToTraces(ctx context.Context, md pmetric.Metrics) error { | ||
return nil | ||
} | ||
func (c *nopConnector) ConsumeMetricsToMetrics(ctx context.Context, md pmetric.Metrics) error { | ||
return nil | ||
} | ||
func (c *nopConnector) ConsumeMetricsToLogs(ctx context.Context, md pmetric.Metrics) error { | ||
return nil | ||
} | ||
|
||
func (c *nopConnector) ConsumeLogsToTraces(ctx context.Context, ld plog.Logs) error { | ||
return nil | ||
} | ||
func (c *nopConnector) ConsumeLogsToMetrics(ctx context.Context, ld plog.Logs) error { | ||
return nil | ||
} | ||
func (c *nopConnector) ConsumeLogsToLogs(ctx context.Context, ld plog.Logs) error { | ||
return nil | ||
} |
Oops, something went wrong.