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

Find a better way to instrument the collector with the GCP Go Profiler

Open gravelg opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe. We currently use a custom cmd/otelcol/main.go file for our collector deployment, in order to configure the GCP Go profiler and our in-house crash collection tool. We have several custom exporters/receivers that are developed in-house and having these tools are essential to our ability to debug issues.

With the move to use the builder to generate the binary for the collector, this pattern seems to be trickier to execute, possibly necessitating modification of the go templates that the builder uses.

Describe the solution you'd like Needing to essentially copy the main.go from the collector into our local repository is an inelegant solution to this problem but I am not sure there is another way around it.

gravelg avatar Nov 23 '21 18:11 gravelg

@gravelg we no longer have a "main" file, we do rely on the builder tool to generate that file. Is that solution acceptable to you?

bogdandrutu avatar Nov 23 '21 21:11 bogdandrutu

Hey @bogdandrutu, the issue we are facing is that the builder tool does not easily allow us to instrument the collector with the GCP profiler anymore. Here is some info on how it works. Right now, we just have a copy of the main.go in our project and we add the profiler code in there. With the builder, since the main.go has effectively been turned into templates, we can't do this anymore.

gravelg avatar Nov 23 '21 22:11 gravelg

I see this issue as a feature request for the builder to support customization of the bootstrap code. Perhaps we need a change to the collector as well, to allow this? I need to think about what would be a clean solution for this, but I'm open to suggestions.

jpkrohling avatar Nov 25 '21 10:11 jpkrohling

@bogdandrutu, I think we touched on this topic recently when discussing the config providers. Should the collector support a mechanism to execute callbacks before starting the service?

jpkrohling avatar Feb 08 '22 13:02 jpkrohling

Hey @jpkrohling , it's been a while since I though about this issue, we actually built a GCP profiler extension internally and have been using it for a few weeks, the goal being to upstream this back. Let me know if you want to know more about our design, the actual code is very simple.

gravelg avatar Feb 08 '22 13:02 gravelg