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

Add a collector flag to list available components.

Open jpeach opened this issue 2 years ago • 14 comments

Description:

Add a --list-components flag to the collector service. This currently show all the available components, their types and their signal stability levels. In future, we could also show the Go module and version, but that would require changes to the builder, so it's omitted for now.

Link to tracking Issue:

This fixes #5709.

Testing:

Just manual.

otelcorecol jpeach$ go build . && ./otelcorecol --list-components
exporters:
	logging (traces: in development, metrics: in development, logs: in development)
	otlp (traces: stable, metrics: stable, logs: beta)
	otlphttp (traces: stable, metrics: stable, logs: beta)
receivers:
	otlp (traces: stable, metrics: stable, logs: beta)
processors:
	batch (traces: stable, metrics: stable, logs: stable)
	memory_limiter (traces: beta, metrics: beta, logs: beta)
extensions:
	memory_ballast
	zpages

Documentation:

None. Visible in usage output.

jpeach avatar Jul 20 '22 06:07 jpeach

Also this overlaps somewhat with what the zpages extension does. It may be a better idea to add it there, rather than on a subcommand, which is something we haven't done before.

mx-psi avatar Jul 20 '22 06:07 mx-psi

Codecov Report

Base: 91.59% // Head: 91.62% // Increases project coverage by +0.03% :tada:

Coverage data is based on head (d699f93) compared to base (fa45027). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5710      +/-   ##
==========================================
+ Coverage   91.59%   91.62%   +0.03%     
==========================================
  Files         217      217              
  Lines       13425    13477      +52     
==========================================
+ Hits        12296    12348      +52     
  Misses        906      906              
  Partials      223      223              
Impacted Files Coverage Δ
service/command.go 81.25% <100.00%> (+26.70%) :arrow_up:
service/flags.go 83.87% <100.00%> (+3.10%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Jul 20 '22 06:07 codecov[bot]

Also this overlaps somewhat with what the zpages extension does. It may be a better idea to add it there, rather than on a subcommand, which is something we haven't done before.

Yeh, this probably makes sense in zpages. However, what I was looking for here is a quick way to see what I have in a collector binary. zpages makes more sense when I have a fleet of collectors.

jpeach avatar Jul 20 '22 06:07 jpeach

Since we all agree that zpages is a must, let's do that and if we find out that is annoying for this case we can revisit. I feel that we are overthinking, let's start with what we know for sure is needed.

bogdandrutu avatar Jul 20 '22 11:07 bogdandrutu

Since we all agree that zpages is a must, let's do that

I think that's a separate PR. It doesn't work for my use case, which is to check which components are in a binary. zpages might not be enabled in the build. To use the data I have to know that zpages is a thing and have read it's documentation, then configure and run the collector as a service and curl it, which is a lot more effort that I think is necessary, and not a good UX for people who are new to the ecosystem.

jpeach avatar Jul 20 '22 22:07 jpeach

Since we all agree that zpages is a must, let's do that

I think that's a separate PR. It doesn't work for my use case, which is to check which components are in a binary. zpages might not be enabled in the build. To use the data I have to know that zpages is a thing and have read it's documentation, then configure and run the collector as a service and curl it, which is a lot more effort that I think is necessary, and not a good UX for people who are new to the ecosystem.

@bogdandrutu so if I'm new to the otel ecosystem, I probably pull down a prebuilt collector binary. I start reading about how I need to configure receivers and exporters and all these optional components. The first thing I need to know is which components I have. IMHO zpages doesn't help this at all.

jpeach avatar Jul 30 '22 01:07 jpeach

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Aug 13 '22 03:08 github-actions[bot]

not stale

jpeach avatar Aug 16 '22 02:08 jpeach

I agree with @jpeach that a subcommand/flag is more useable for this use case. Zpages requires the collector to be running with a valid configuration (that includes the extension) and then you have to know how to use zpages to get to the endpoint that lists all the components. For a brand new user this is not a user-friendly.

I believe that it is a better user experience to directly ask the collector "what components can I use" without first needing to pass it a valid config (which requires knowledge of what components can be used). Relying on Zpages also requires the binary to include the Zpages extension, which custom distributions may not include.

If we really can't add a subcommand or another flag could we at least add the component list to the --help flag?

TylerHelmuth avatar Aug 23 '22 18:08 TylerHelmuth

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Sep 07 '22 04:09 github-actions[bot]

Rebased again. @open-telemetry/collector-approvers can we get consensus here?

jpeach avatar Sep 11 '22 23:09 jpeach

I believe that it is a better user experience to directly ask the collector "what components can I use" without first needing to pass it a valid config

This has my vote.

jpkrohling avatar Sep 12 '22 20:09 jpkrohling

@jpeach if we don't make progress on this in the next week I'll add this PR to the SIG meeting next Wednesday.

TylerHelmuth avatar Sep 15 '22 02:09 TylerHelmuth

@TylerHelmuth @jpeach @jpkrohling please provide exactly the commands/flags that you want to add:

  • Do you list per component type?
  • Do we need to support this for windows service handler? What is the separation of things supported for windows service handler vs non windows service? Needs to better understand this.
  • Do you have a flag or subcommand? I prefer subcommand. If subcommand probably we should also have a "run" subcommand for current "run" behavior of the root command and deprecate the current root. Also if the decision for flag is just because we are worried about the followup work, I am not ok with that.

bogdandrutu avatar Sep 19 '22 21:09 bogdandrutu

please provide exactly the commands/flags that you want to add

Umm, that's in the patch and the description field for this PR?

Do you list per component type?

Do you mean a flag that would let you list one type of component and not others? No, the behavior I'm proposing is what's in the PR.

Do we need to support this for windows service handler?

What is this? If windows has collector components, then this would list them.

Do you have a flag or subcommand?

It's a flag, because the implementation is trivial and doesn't require a lot of refactoring or backwards compatibility.

jpeach avatar Sep 20 '22 23:09 jpeach

What is this? If windows has collector components, then this would list them.

https://github.com/open-telemetry/opentelemetry-collector/blob/main/service/collector_windows.go#L45

It's a flag, because the implementation is trivial and doesn't require a lot of refactoring or backwards compatibility.

I think I already answered to this.

Also if the decision for flag is just because we are worried about the followup work, I am not ok with that.

bogdandrutu avatar Sep 21 '22 00:09 bogdandrutu

OK, sounds like we don't have consensus for this change.

jpeach avatar Sep 21 '22 00:09 jpeach

Do you have a flag or subcommand? I prefer subcommand

Not a strong preference, but as a user, I would prefer a flag like '--help' (as I see this as a specialization of '--help'). When looking at the binary, I know it's for running a collector, but before doing that, I might just want to check what's the version and which components it has.

jpkrohling avatar Sep 27 '22 13:09 jpkrohling