Own Telegraf Plugin -- Need to scrape metrics from Prometheus clients

I want to make use of telegraf as plugin to scrape/pull metrics from applications which have Prometheus clients. How do I make use of Prometheus input plugin after which I need to perform some custom logic on metrics (conversion of prom format to a specific format) and then output the new format of metrics to a remote endpoint. I want to write a GO Application which has telegraf input plugin for Prometheus clients functionality and conversion of metrics from prom format to custom and output to remote endpoint by batches.

PS : I’m a starter to telegraf, please ignore if these are basics

Telegraf has a built-in Prometheus Input plugin which can be used to scrape metrics from Prometheus endpoints.

What type of conversion do you need to do? Where are you sending the data? If the format and remote endpoint are not already supported by Telegraf’s output plugins, you could write your own. This blog post has some more information about writing a plugin; it is specific to input plugins, but will give you a general overview of the process.

We have a GO application with installed Prometheus client and Telegraf container with Prometheus input plugin trying to fetch default metrics. Instrumented app using https://prometheus.io/docs/guides/go-application/,
However when starting telegraf container, it is unable to fetch metrics from the endpoint. My application is exposed as service and telegraf conf are attached. Please let me know what I’m missing here.service.yaml.txt (278 Bytes) Telegraf.txt (270 Bytes)

Error : 2019-12-02T10:13:30Z E! [inputs.prometheus]: Error in plugin: error making HTTP request to Get dial tcp connect: connection refused