Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a sub-command to retrieve configuration #7224

Closed
gbbr opened this issue Feb 21, 2023 · 8 comments
Closed

Add a sub-command to retrieve configuration #7224

gbbr opened this issue Feb 21, 2023 · 8 comments

Comments

@gbbr
Copy link
Member

gbbr commented Feb 21, 2023

I would like to propose adding a sub-command to the core which allows retrieving the configuration from a running collector. I propose this to be done by opening up an endpoint (which listens strictly on the local host) that reports the configuration.

Ideally, I would also like to explore an implementation where each each configuration item also reports its origin (e.g. env, file, remote, etc). This part however may deem tricky and may need to be addressed in a second milestone.

Am happy to start work on this if approved.

Usage

One option would be to simply add the config sub-command, just as we have the components sub-command today.

$ ./bin/otelcorecol_darwin_arm64 --help
Usage:
  otelcorecol [flags]
  otelcorecol [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  components  Outputs available components in this collector distribution
  config      Outputs a running collector's configuration.
  help        Help about any command

Alternative solution

One may also consider doing this as part of an extension. However, the debugging capabilities of a running Collector are reduced if the user is not running such an extension (ref).

@kentquirk
Copy link
Member

The localhost constraint might be difficult to deal with in practice, depending on the way it's deployed.

What about instead specifying some sort of really simple auth model? It could be as simple as a configured token in a custom header that must be specified as part of the GET request.

@dmitryax
Copy link
Member

I would like to propose adding a sub-command to the core which allows retrieving the configuration from a running collector. I propose this to be done by opening up an endpoint (which listens strictly on the local host) that reports the configuration.

I'm not sure I understand how you would get a configuration from a running collector. How'd you call an executable which is already running? And why do you need that? Wouldn't it be enough just to have a flag that validates and shows the configuration provided to the collector?

@kentquirk
Copy link
Member

I understood the proposal to be that the command line switch would cause collector to open an endpoint that would be available to read back the fully hydrated configuration, but that the endpoint would only listen to requests that came from the same machine. If I'm wrong about that, then you can ignore my comment.

The use case I'm describing is most useful in a cluster containing multiple instances where you want to check how the machines are configured, especially in a situation where configs can be hot-reloaded.

@dmitryax
Copy link
Member

I understood the proposal to be that the command line switch would cause collector to open an endpoint that would be available to read back the fully hydrated configuration, but that the endpoint would only listen to requests that came from the same machine. If I'm wrong about that, then you can ignore my comment.

That makes sense. It can be potentially added to https://github.com/open-telemetry/opentelemetry-collector/tree/main/extension/zpagesextension or implemented as another extension

This seems like a duplicate issue #5223

@gbbr
Copy link
Member Author

gbbr commented Apr 13, 2023

Thanks for clarifying @kentquirk. I think you have definitely understood both the issue and the use case, and have described it well.

@dmitryax please allow me some time to study #5223 and make sure they are the same thing, and if so, close this one as a duplicate. An extension is indeed something that was on my mind as an option.

@seankhliao
Copy link
Contributor

zpages has comments like

// TODO: Add config + status info.

but it doesn't seem like it has access to config since now it is only passed a builder for the components with the configs already hidden inside.

@atoulme
Copy link
Contributor

atoulme commented Dec 14, 2023

Can we close in favor of #5223? FWIW the splunk distro exposes a zpages endpoint for effective config, so it can be done.

@mx-psi
Copy link
Member

mx-psi commented Dec 14, 2023

Closing as duplicate of #5223

@mx-psi mx-psi closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants