>I am trying to make a custom receiver that will Collect and receive traces from applications and store it in MySQL database.(An alternative to zipkin). Later on will work on exporting them when asked.
So for my custom receiver this is the code I have written following the otel's official documentation
Link to code:
GitHub - Umang01-hash/traceCollectorService[
^]
Also after writing the receiver, I included it in components.go file inside otelcol-dev directory.
Changes in compoentns.go
func components() (otelcol.Factories, error) {
var err error
factories := otelcol.Factories{}
factories.Extensions, err = extension.MakeFactoryMap(
)
if err != nil {
return otelcol.Factories{}, err
}
factories.Receivers, err = receiver.MakeFactoryMap(
otlpreceiver.NewFactory(),
traceCollectorService.NewReceiverFactory(),
)
if err != nil {
return otelcol.Factories{}, err
}
And my conifg.yaml looks like this:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
traceCollectorService:
interval: 1m
number_of_traces: 1
processors:
batch:
exporters:
debug:
verbosity: detailed
service:
pipelines:
traces:
receivers: [otlp, traceCollectorService]
processors: [batch]
exporters: [debug]
telemetry:
logs:
level: debug
When trying to run it using this command :
./otelcol-dev --config ../config.yaml
Getting the following error:
Error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding:
error decoding 'receivers': unknown type: "traceCollectorService" for id: "traceCollectorService" (valid values: [otlp]) 2024/03/20 16:22:02 collector server run finished with error: failed to get config: cannot unmarshal the configuration: 1 error(s) decoding:
error decoding 'receivers': unknown type: "traceCollectorService" for id: "traceCollectorService" (valid values: [otlp])
Can someone please guide me on how to resolve it. I have checked there is proper consistency in naming of traceCollectorService. Also feel free to tell if anything is wrong in the receiver code. Thank you in advance.
What I have tried:
I have tried several methods like ensuring the naming traceCollectorService is proper throughout, and also renaming it or cleaning modcache and re-doing go mod tidy etc.