mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Adds support for `profiles` in the nop receiver.
50 lines
1.6 KiB
Go
50 lines
1.6 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package nopreceiver // import "go.opentelemetry.io/collector/receiver/nopreceiver"
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.opentelemetry.io/collector/component"
|
|
"go.opentelemetry.io/collector/consumer"
|
|
"go.opentelemetry.io/collector/consumer/xconsumer"
|
|
"go.opentelemetry.io/collector/receiver"
|
|
"go.opentelemetry.io/collector/receiver/nopreceiver/internal/metadata"
|
|
"go.opentelemetry.io/collector/receiver/xreceiver"
|
|
)
|
|
|
|
// NewFactory returns a receiver.Factory that constructs nop receivers.
|
|
func NewFactory() xreceiver.Factory {
|
|
return xreceiver.NewFactory(
|
|
metadata.Type,
|
|
func() component.Config { return &struct{}{} },
|
|
xreceiver.WithTraces(createTraces, metadata.TracesStability),
|
|
xreceiver.WithMetrics(createMetrics, metadata.MetricsStability),
|
|
xreceiver.WithProfiles(createProfiles, metadata.ProfilesStability),
|
|
xreceiver.WithLogs(createLogs, metadata.LogsStability))
|
|
}
|
|
|
|
func createTraces(context.Context, receiver.Settings, component.Config, consumer.Traces) (receiver.Traces, error) {
|
|
return nopInstance, nil
|
|
}
|
|
|
|
func createMetrics(context.Context, receiver.Settings, component.Config, consumer.Metrics) (receiver.Metrics, error) {
|
|
return nopInstance, nil
|
|
}
|
|
|
|
func createLogs(context.Context, receiver.Settings, component.Config, consumer.Logs) (receiver.Logs, error) {
|
|
return nopInstance, nil
|
|
}
|
|
|
|
func createProfiles(context.Context, receiver.Settings, component.Config, xconsumer.Profiles) (xreceiver.Profiles, error) {
|
|
return nopInstance, nil
|
|
}
|
|
|
|
var nopInstance = &nopReceiver{}
|
|
|
|
type nopReceiver struct {
|
|
component.StartFunc
|
|
component.ShutdownFunc
|
|
}
|