Unable to fetch metrics from Application using telegraf

We have a GO application with installed Prometheus client and Telegraf container with Prometheus input plugin trying to fetch default metrics. Instrumented app using promehteus guide for instrumenting go app,
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.

urls = [“https://sample-service.test.svc.cluster.local:2112/metrics”]

Tried using kubernetes_services as well, which are not working

files = [“stdout”]
data_format = “json”


apiVersion: v1
kind: Service
prometheus.io/port: “2112”
prometheus.io/scrape: “true”
name: sample-service
namespace: test
- name: https
port: 2112
targetPort: 2112

Error I’m facing is.

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

dial tcp connect: connection refused

Hi @pavan_kumar, would you exec into the telegraf container and try to curl ?