英文:
Building custom otel collector/exporter
问题
我正在处理一个使用案例,需要将来自 otel 网关(收集器)的度量数据推送到自定义后端,例如 mongodb/postgresql。
根据我的研究,似乎没有现有的导出器,我需要构建一个自定义的 OTEL 导出器来支持我的使用案例。
我已经构建了一个可以将数据插入自定义后端的服务。
但是我不确定如何构建 OTEL 导出器,以及如何部署或关联自定义导出器到 OTEL。
任何指导都将非常有帮助。
英文:
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.
答案1
得分: 7
以下是翻译好的内容:
虽然我们的网站上有关于此的文档,以下是必要步骤的快速概述:
- 在您拥有的存储库中创建您自己的 Go 模块。
- 您可以使用在实习期间构建的 "ocg" 工具来启动您的组件:https://github.com/Chinwendu20/otel_components_generator 。我不能百分之百确定它是否最新,但生成的代码可能足够接近让您入门。
- 一旦您完成您的组件,使用 "ocb" 将其合并到您自己的二进制文件中:https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder
除了网站上的文档之外,我们还有记录的接口,但没有一个特定的地方会为您提供构建组件所需的所有知识,比如可用的辅助工具或最佳实践。我建议以 OTLP 接收器或 OTLP 导出器这样的组件作为参考,了解如何操作。
英文:
While we have docs about this on our website, here's a quick outline of the necessary steps:
- create your own Go module in a repository you own
- 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
- 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论