open-telemetry / opentelemetry-collector

OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
4.44k stars 1.46k forks source link

Propose creating an OTEL component generator utility #10682

Open adrielp opened 3 months ago

adrielp commented 3 months ago

Is your feature request related to a problem? Please describe.

Having originally gone through the Building a customer receiver guide but in the context of a scraper receiver (guide is for a tracing component) there was a bit of reverse engineering that I had to do. I've seen many needs for custom components in highly regulated industries, and have found the ability to build them natively into the collector to be immensely valuable. This proposal is to create a CLI utility to generate all the boilerplate for components within an OTEL distribution, perhaps the #10681 example. This idea was originally mentioned in issue #8555 and there is prior art as mentioned in this comment.

Describe the solution you'd like

I'd like to see a utility similar to OCB that would generate the boiler plate code for all component types within the OTEL collector. The outcome would be a component that runs, but does nothing.

A co-worker and I built a prototype of this very thing in the distribution we maintain and dubbed it compgen.

The potential byproduct of this utility would be improving adoption, accelerating component contribution delivery, and widening the ecosystem.

Additionally, it could help reduce bugs. Recently, I had built an auth extension and could not take the latest version of mdatagen because of a small bug in the template. One of the long term fixes I mentioned was to add additional types of components to the test bed. Building this utility could improve the testing for mdatagen templates in this regard and help prevent future issues with templates.

jpkrohling commented 3 months ago

I'm in favor of having this, if the core maintainers are on board to maintain it.

mx-psi commented 3 months ago

This would be much simpler to maintain once we get Go APIs to 1.0