prometheusExporter

Collect metrics data from Prometheus Metrics.

Example

  1. sources:
  2. - type: prometheusExporter
  3. name: metric
  4. endpoints:
  5. - "http://127.0.0.1:9196/metrics"

endpoints

fieldtyperequireddefaultdescription
endpointsstring arraytrueremote exporter address. Please note that Loggie will not add /metrics to the request path by default.

interval

fieldtyperequireddefaultdescription
intervaltime.Durationfalse30sTime interval for regularly request the remote exporter

timeout

fieldtyperequireddefaultdescription
timeouttime.Durationfalse5sThe timeout for the request

toJson

fieldtyperequireddefaultdescription
toJsonboolfalsefalseWhether to convert the captured prometheus native metrics into JSON format

labels

fieldtyperequireddefaultdescription
labelsmapfalseAdd extra labels to all metrics

labels supports ${_env.XX} to obtain environment variables. For example:

labels

  1. sources:
  2. - type: prometheusExporter
  3. name: metric
  4. endpoints:
  5. - "http://127.0.0.1:9196/metrics"
  6. labels:
  7. svc: ${_env.SVC}

Assuming that env SVC=test, the label svc=test will be added to all metrics.