Skip to content

Commit

Permalink
Define new component type "connector" (open-telemetry#6577)
Browse files Browse the repository at this point in the history
This establishes the new component type without including anything
specific about the design of connectors.
  • Loading branch information
djaglowski authored and jaronoff97 committed Dec 14, 2022
1 parent 5df2587 commit b667ad9
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .chloggen/connector-component.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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: component

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Define new component type 'connectors'

# One or more tracking issues or pull requests related to the change
issues: [6577]

# (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:
1 change: 1 addition & 0 deletions component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const (
KindProcessor
KindExporter
KindExtension
KindConnector
)

// StabilityLevel represents the stability level of the component created by the factory.
Expand Down
46 changes: 46 additions & 0 deletions config/connector.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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 config // import "go.opentelemetry.io/collector/config"

import (
"go.opentelemetry.io/collector/component"
)

// ConnectorSettings defines common settings for a component.Connector configuration.
// Specific connectors can embed this struct and extend it with more fields if needed.
//
// It is highly recommended to "override" the Validate() function.
//
// When embedded in the exporter config, it must be with `mapstructure:",squash"` tag.
type ConnectorSettings struct {
settings
}

// NewConnectorSettings return a new ConnectorSettings with the given ComponentID.
func NewConnectorSettings(id component.ID) ConnectorSettings {
return ConnectorSettings{settings: newSettings(id)}
}

var _ component.Config = (*ConnectorSettings)(nil)

// ID returns the connector ComponentID.
func (cs *ConnectorSettings) ID() component.ID {
return cs.id
}

// SetIDName sets the connector name.
func (cs *ConnectorSettings) SetIDName(idName string) {
cs.id = component.NewIDWithName(cs.id.Type(), idName)
}
37 changes: 37 additions & 0 deletions connector/connector.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// 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 connector // import "go.opentelemetry.io/collector/connector"

import (
"go.opentelemetry.io/collector/component"
)

// Connector sends telemetry data from one pipeline to another. A connector
// is both an exporter and receiver, working together to connect pipelines.
// The purpose is to allow for differentiated processing of telemetry data.
//
// Connectors can be used to replicate or route data, merge data streams,
// derive signals from other signals, etc.
type Connector interface {
component.Component
}

// CreateSettings configures Connector creators.
type CreateSettings struct {
TelemetrySettings component.TelemetrySettings

// BuildInfo can be used by components for informational purposes
BuildInfo component.BuildInfo
}

0 comments on commit b667ad9

Please sign in to comment.