Ravi Sharma
Ravi Sharma

Reputation: 91

Building custom otel collector/exporter

I am working on a use case where I need to push the metric data from otel gateway(collector) to a custom backend like mongodb/postgresql.

Based on my research looks like there are no existing exporter and I need to build a custom OTEL exporter to support my use case.

I have already built a service that can insert data to the custom backend.

However I am not sure how to build the OTEL exporter and deploy or associate the custom exporter to OTEL.

Any guidance will be be very helpful.

Upvotes: 5

Views: 2891

Answers (1)

jpkroehling
jpkroehling

Reputation: 14061

While we have docs about this on our website, here's a quick outline of the necessary steps:

  1. create your own Go module in a repository you own
  2. you can use "ocg", built during an internship, to bootstrap your component: https://github.com/Chinwendu20/otel_components_generator . I'm not 100% sure it's up to date, but the generated code might be close enough for you to get started
  3. once you have your component done, use ocb to incorporate it in your own binary: https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder

Apart from the documentation on the website, we have the interfaces documented, but not a specific place that would give you all the knowledge to build components, like the available helpers or best practices. I recommend taking a component like the OTLP Receiver or OTLP Exporter as a reference on how to do things.

Upvotes: 9

Related Questions