-
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.
Call service.New to validate pipeline types
- Loading branch information
1 parent
d9e74d8
commit e373dd9
Showing
7 changed files
with
112 additions
and
102 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
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,18 @@ | ||
receivers: | ||
nop_logs: | ||
|
||
processors: | ||
nop: | ||
|
||
exporters: | ||
nop: | ||
|
||
service: | ||
telemetry: | ||
metrics: | ||
address: localhost:8888 | ||
pipelines: | ||
traces: | ||
receivers: [nop_logs] | ||
processors: [nop] | ||
exporters: [nop] |
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,54 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package receivertest // import "go.opentelemetry.io/collector/receiver/receivertest" | ||
|
||
import ( | ||
"context" | ||
|
||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/component/componenttest" | ||
"go.opentelemetry.io/collector/consumer" | ||
"go.opentelemetry.io/collector/receiver" | ||
) | ||
|
||
var nopLogsComponentType = component.MustNewType("nop_logs") | ||
|
||
// NewNopLogsCreateSettings returns a new nop settings for Create*Receiver functions. | ||
func NewNopLogsCreateSettings() receiver.CreateSettings { | ||
return receiver.CreateSettings{ | ||
ID: component.NewID(nopLogsComponentType), | ||
TelemetrySettings: componenttest.NewNopTelemetrySettings(), | ||
BuildInfo: component.NewDefaultBuildInfo(), | ||
} | ||
} | ||
|
||
// NewNopLogsFactory returns a receiver.Factory that constructs nop logs receivers. | ||
func NewNopLogsFactory() receiver.Factory { | ||
createLogs := func(context.Context, receiver.CreateSettings, component.Config, consumer.Logs) (receiver.Logs, error) { | ||
return nopInstance, nil | ||
} | ||
|
||
return receiver.NewFactory( | ||
nopLogsComponentType, | ||
func() component.Config { return &nopLogsConfig{} }, | ||
receiver.WithLogs(createLogs, component.StabilityLevelStable)) | ||
} | ||
|
||
type nopLogsConfig struct{} | ||
|
||
var nopLogsInstance = &nopLogsReceiver{} | ||
|
||
// nopLogsReceiver acts as a receiver for testing purposes. | ||
type nopLogsReceiver struct { | ||
component.StartFunc | ||
component.ShutdownFunc | ||
} | ||
|
||
// NewNopLogsBuilder returns a receiver.Builder that constructs nop receivers. | ||
func NewNopLogsBuilder() *receiver.Builder { | ||
nopFactory := NewNopLogsFactory() | ||
return receiver.NewBuilder( | ||
map[component.ID]component.Config{component.NewID(componentType): nopFactory.CreateDefaultConfig()}, | ||
map[component.Type]receiver.Factory{componentType: nopFactory}) | ||
} |
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