opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

User experience: starting the collector without config file yields a cryptic message

Open jpkrohling opened this issue 2 years ago • 4 comments

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.

jpkrohling avatar Jul 07 '22 19:07 jpkrohling

Feel free to assign this to me.

josephwoodward avatar Jul 07 '22 19:07 josephwoodward

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 ?

svrnm avatar Jul 07 '22 20:07 svrnm

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.

mx-psi avatar Jul 08 '22 08:07 mx-psi

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!

svrnm avatar Jul 08 '22 09:07 svrnm

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.

josephwoodward avatar Aug 12 '22 23:08 josephwoodward

@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?

TylerHelmuth avatar Aug 23 '22 17:08 TylerHelmuth

@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.

TylerHelmuth avatar Aug 23 '22 17:08 TylerHelmuth

Sorry, I meant a configuration provided from any valid source.

jpkrohling avatar Aug 23 '22 20:08 jpkrohling