opentelemetry-collector
opentelemetry-collector copied to clipboard
User experience: starting the collector without config file yields a cryptic message
When running the collector without specifying a config file, the error message that is returned doesn't immediately make it clear to users what the problem is:
$ ./bin/otelcorecol_linux_amd64
Error: invalid map resolver config: no URIs
2022/07/07 16:08:11 collector server run finished with error: invalid map resolver config: no URIs
I would prefer to have a validation somewhere before this error, stating that a configuration file is required to run the collector. I believe we even had this a few releases ago.
Feel free to assign this to me.
I am wondering if instead of throwing an error the collector could just start with a minimal configuration (otlp receivers, debug logging exporters for all signals)? Or would this be unexpected behavior / lead to more confusion ?
I am wondering if instead of throwing an error the collector could just start with a minimal configuration (otlp receivers, debug logging exporters for all signals)? Or would this be unexpected behavior / lead to more confusion ?
We have that on the Helm chart, and it seems to have mixed feedback: open-telemetry/opentelemetry-helm-charts#90. We also have it on the Docker images, for which I have heard anecdotal negative feedback when open-telemetry/opentelemetry-collector-releases/issues/59 happened (since the Collector did not fail to start, just started with a different configuration).
IMO it's hard to agree on what this minimal configuration should be: different people have different ideas and use cases in mind, and the official binaries should probably be neutral in this regard and just provide high-quality examples outside of the binary.
I share those mixed feeling, but I thought asking/exploring that would be helpful. From the perspective of a user that's just getting started having some easy defaults would be great, but for someone using the collector in production such a behavior might be harmful (especially what you said about the collector starting with a different/unexpected config vs just failing).
There are probably better ways to serve new comers (and I might raise another issue for that), so my question got answered. Thanks!
Started looking into this and can confirm it used to error with the following message:
$ ./otelcol-dev
Error: failed to get config: invalid configuration: no enabled receivers specified in config
2022/08/13 00:30:23 collector server run finished with error: failed to get config: invalid configuration: no enabled receivers specified in config
It looks like it fails the way it does because the error is returned when creating a new config provider before it's even able to try and validate the configuration and get the friendlier error message.
@jpkrohling when you said "configuration file is required to run the collector" do you mean an actual configuration file, or do you mean configuration provided via any valid source?
@josephwoodward I think we can check for the presence of a --config
flag here, and if there are not any we can error accordingly. Let me know if you are still working on it. If not, I can pick this up.
Sorry, I meant a configuration provided from any valid source.