mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-11-03 02:20:04 +00:00
- add metadata.yaml for all relevant components and use metadata - fix the go routine leaks in component code and tests - add TODO for handling errors wherever they are unchecked or not handled so the behaviour doesn't change - address lint for the most part (so we can enable it soon) except the metricexporter that is due to be deleted and semconv which I don't want to touch right now - other changes required for bump breaking changes to pay attention to - telemetry config, address and level removed and readers should be used - change in attributes for telemetry - metrics at detailed level - failures in embedded config (addressed) --------- Co-authored-by: Nityananda Gohain <[email protected]>
43 lines
987 B
Go
43 lines
987 B
Go
package inmemoryreceiver
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/pkg/errors"
|
|
"go.opentelemetry.io/collector/component"
|
|
"go.opentelemetry.io/collector/confmap/xconfmap"
|
|
"go.opentelemetry.io/collector/consumer"
|
|
"go.opentelemetry.io/collector/receiver"
|
|
)
|
|
|
|
func createDefaultConfig() component.Config {
|
|
return &Config{
|
|
Id: uuid.NewString(),
|
|
}
|
|
}
|
|
|
|
func createLogsReceiver(
|
|
_ context.Context,
|
|
_ receiver.Settings,
|
|
config component.Config,
|
|
consumer consumer.Logs,
|
|
) (receiver.Logs, error) {
|
|
if err := xconfmap.Validate(config); err != nil {
|
|
return nil, errors.Wrap(err, "invalid inmemory receiver config")
|
|
}
|
|
return &InMemoryReceiver{
|
|
id: config.(*Config).Id,
|
|
nextConsumer: consumer,
|
|
}, nil
|
|
|
|
}
|
|
|
|
// NewFactory creates a new OTLP receiver factory.
|
|
func NewFactory() receiver.Factory {
|
|
return receiver.NewFactory(
|
|
component.MustNewType("memory"),
|
|
createDefaultConfig,
|
|
receiver.WithLogs(createLogsReceiver, component.StabilityLevelBeta))
|
|
}
|